mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-23 13:29:40 +00:00
Finished off new system of sustained data
This commit is contained in:
1 parent
94c3a6aa60
commit
ab34edc46a
9 files changed
+165
-198
No files matched your search
@@ -15,6 +15,7 @@ import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.ISustainedData;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
@@ -41,7 +42,7 @@ import cpw.mods.fml.common.Optional.Method;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
|
||||
public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandler, IGasHandler, ITubeConnection
|
||||
public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandler, IGasHandler, ITubeConnection, ISustainedData
|
||||
{
|
||||
public FluidTank inputFluidTank = new FluidTank(10000);
|
||||
public GasTank inputGasTank = new GasTank(10000);
|
||||
@@ -438,4 +439,31 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
|
||||
{
|
||||
return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSustainedData(ItemStack itemStack)
|
||||
{
|
||||
if(inputFluidTank.getFluid() != null)
|
||||
{
|
||||
itemStack.stackTagCompound.setTag("inputFluidTank", inputFluidTank.getFluid().writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
if(inputGasTank.getGas() != null)
|
||||
{
|
||||
itemStack.stackTagCompound.setTag("inputGasTank", inputGasTank.getGas().write(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
if(outputGasTank.getGas() != null)
|
||||
{
|
||||
itemStack.stackTagCompound.setTag("outputGasTank", outputGasTank.getGas().write(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSustainedData(ItemStack itemStack)
|
||||
{
|
||||
inputFluidTank.setFluid(FluidStack.loadFluidStackFromNBT(itemStack.stackTagCompound.getCompoundTag("inputFluidTank")));
|
||||
inputGasTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("inputGasTank")));
|
||||
outputGasTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("outputGasTank")));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user