mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Save infusion storage and gas tanks in machines. Fixes #4819
This commit is contained in:
1 parent
e21e72052f
commit
c481c70c6c
5 files changed
+94
-4
No files matched your search
@@ -8,11 +8,13 @@ import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.capabilities.Capabilities;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -177,4 +179,22 @@ public final class GasUtils
|
||||
|
||||
return prevSending-toSend;
|
||||
}
|
||||
|
||||
public static void writeSustainedData(GasTank gasTank, ItemStack itemStack)
|
||||
{
|
||||
if(gasTank.stored != null && gasTank.stored.getGas() != null)
|
||||
{
|
||||
ItemDataUtils.setCompound(itemStack, "gasStored", gasTank.stored.write(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void readSustainedData(GasTank gasTank, ItemStack itemStack)
|
||||
{
|
||||
if(ItemDataUtils.hasData(itemStack, "gasStored"))
|
||||
{
|
||||
gasTank.stored = GasStack.readFromNBT(ItemDataUtils.getCompound(itemStack, "gasStored"));
|
||||
} else {
|
||||
gasTank.stored = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user