Added basic fluid merging
This commit is contained in:
parent
ba6a56ab7e
commit
d6df9bb0a3
2 changed files with 36 additions and 4 deletions
|
@ -31,6 +31,7 @@ import resonantinduction.machine.crusher.ItemDust;
|
||||||
import resonantinduction.machine.furnace.BlockAdvancedFurnace;
|
import resonantinduction.machine.furnace.BlockAdvancedFurnace;
|
||||||
import resonantinduction.machine.furnace.TileAdvancedFurnace;
|
import resonantinduction.machine.furnace.TileAdvancedFurnace;
|
||||||
import resonantinduction.machine.liquid.BlockFluidMixture;
|
import resonantinduction.machine.liquid.BlockFluidMixture;
|
||||||
|
import resonantinduction.machine.liquid.TileFluidMixture;
|
||||||
import resonantinduction.transport.battery.BlockBattery;
|
import resonantinduction.transport.battery.BlockBattery;
|
||||||
import resonantinduction.transport.battery.ItemBlockBattery;
|
import resonantinduction.transport.battery.ItemBlockBattery;
|
||||||
import resonantinduction.transport.battery.TileBattery;
|
import resonantinduction.transport.battery.TileBattery;
|
||||||
|
@ -236,6 +237,7 @@ public class ResonantInduction
|
||||||
GameRegistry.registerTileEntity(TileTesla.class, blockTesla.getUnlocalizedName());
|
GameRegistry.registerTileEntity(TileTesla.class, blockTesla.getUnlocalizedName());
|
||||||
GameRegistry.registerTileEntity(TileEMLevitator.class, blockEMContractor.getUnlocalizedName());
|
GameRegistry.registerTileEntity(TileEMLevitator.class, blockEMContractor.getUnlocalizedName());
|
||||||
GameRegistry.registerTileEntity(TileBattery.class, blockBattery.getUnlocalizedName());
|
GameRegistry.registerTileEntity(TileBattery.class, blockBattery.getUnlocalizedName());
|
||||||
|
GameRegistry.registerTileEntity(TileFluidMixture.class, blockFluidMixture.getUnlocalizedName());
|
||||||
|
|
||||||
ResonantInduction.proxy.registerRenderers();
|
ResonantInduction.proxy.registerRenderers();
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package resonantinduction.machine.liquid;
|
package resonantinduction.machine.liquid;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.TreeSet;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
@ -15,7 +13,39 @@ import calclavia.lib.prefab.tile.TileAdvanced;
|
||||||
*/
|
*/
|
||||||
public class TileFluidMixture extends TileAdvanced
|
public class TileFluidMixture extends TileAdvanced
|
||||||
{
|
{
|
||||||
public final Set<FluidStack> fluids = new HashSet<FluidStack>();
|
public final TreeSet<FluidStack> fluids = new TreeSet<FluidStack>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUpdate()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mix(FluidStack fluid)
|
||||||
|
{
|
||||||
|
if (fluids.contains(fluid))
|
||||||
|
{
|
||||||
|
for (FluidStack checkFluid : fluids)
|
||||||
|
{
|
||||||
|
if (fluid.equals(checkFluid))
|
||||||
|
{
|
||||||
|
checkFluid.amount += fluid.amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fluids.add(fluid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The color of the liquid based on the fluidStacks stored.
|
||||||
|
*/
|
||||||
|
public int getColor()
|
||||||
|
{
|
||||||
|
return 0xFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
|
|
Loading…
Reference in a new issue