Added sustained fluid and gas tanks to PRC and Electrolytic Separator, fixed Gas Generator losing energy when being picked up

This commit is contained in:
Aidan C. Brady 2014-07-26 17:37:25 -04:00
parent bb8985b6f8
commit ba289ced25
3 changed files with 63 additions and 2 deletions

View file

@ -73,7 +73,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
@ -1168,6 +1167,46 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
itemStack.stackTagCompound.setTag("leftTank", infuser.centerTank.getGas().write(new NBTTagCompound()));
}
}
if(tileEntity instanceof TileEntityElectrolyticSeparator)
{
TileEntityElectrolyticSeparator separator = (TileEntityElectrolyticSeparator)tileEntity;
if(separator.fluidTank.getFluid() != null)
{
itemStack.stackTagCompound.setTag("fluidTank", separator.fluidTank.getFluid().writeToNBT(new NBTTagCompound()));
}
if(separator.leftTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("leftTank", separator.leftTank.getGas().write(new NBTTagCompound()));
}
if(separator.rightTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("rightTank", separator.rightTank.getGas().write(new NBTTagCompound()));
}
}
if(tileEntity instanceof TileEntityPRC)
{
TileEntityPRC prc = (TileEntityPRC)tileEntity;
if(prc.inputFluidTank.getFluid() != null)
{
itemStack.stackTagCompound.setTag("inputFluidTank", prc.inputFluidTank.getFluid().writeToNBT(new NBTTagCompound()));
}
if(prc.inputGasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("inputGasTank", prc.inputGasTank.getGas().write(new NBTTagCompound()));
}
if(prc.outputGasTank.getGas() != null)
{
itemStack.stackTagCompound.setTag("outputGasTank", prc.outputGasTank.getGas().write(new NBTTagCompound()));
}
}
return itemStack;
}

View file

@ -34,8 +34,10 @@ import mekanism.common.tile.TileEntityChemicalOxidizer;
import mekanism.common.tile.TileEntityDigitalMiner;
import mekanism.common.tile.TileEntityElectricBlock;
import mekanism.common.tile.TileEntityElectricChest;
import mekanism.common.tile.TileEntityElectrolyticSeparator;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.tile.TileEntityPRC;
import mekanism.common.tile.TileEntityPortableTank;
import mekanism.common.tile.TileEntityRotaryCondensentrator;
import mekanism.common.transporter.TransporterFilter;
@ -378,6 +380,26 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
((TileEntityChemicalInfuser)tileEntity).centerTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("centerTank")));
}
}
if(tileEntity instanceof TileEntityElectrolyticSeparator)
{
if(stack.stackTagCompound != null)
{
((TileEntityElectrolyticSeparator)tileEntity).fluidTank.setFluid(FluidStack.loadFluidStackFromNBT(stack.stackTagCompound.getCompoundTag("fluidTank")));
((TileEntityElectrolyticSeparator)tileEntity).leftTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("leftTank")));
((TileEntityElectrolyticSeparator)tileEntity).rightTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("rightTank")));
}
}
if(tileEntity instanceof TileEntityPRC)
{
if(stack.stackTagCompound != null)
{
((TileEntityPRC)tileEntity).inputFluidTank.setFluid(FluidStack.loadFluidStackFromNBT(stack.stackTagCompound.getCompoundTag("inputFluidTank")));
((TileEntityPRC)tileEntity).inputGasTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("inputGasTank")));
((TileEntityPRC)tileEntity).outputGasTank.setGas(GasStack.readFromNBT(stack.stackTagCompound.getCompoundTag("outputGasTank")));
}
}
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));

View file

@ -526,7 +526,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
{
HEAT_GENERATOR(0, "HeatGenerator", 0, 160000, TileEntityHeatGenerator.class, true),
SOLAR_GENERATOR(1, "SolarGenerator", 1, 96000, TileEntitySolarGenerator.class, true),
GAS_GENERATOR(3, "GasGenerator", 3, 40000, TileEntityGasGenerator.class, true),
GAS_GENERATOR(3, "GasGenerator", 3, Mekanism.FROM_H2*100, TileEntityGasGenerator.class, true),
BIO_GENERATOR(4, "BioGenerator", 4, 160000, TileEntityBioGenerator.class, true),
ADVANCED_SOLAR_GENERATOR(5, "AdvancedSolarGenerator", 1, 200000, TileEntityAdvancedSolarGenerator.class, true),
WIND_TURBINE(6, "WindTurbine", 5, 200000, TileEntityWindTurbine.class, true);