Skip to content

Commit cac13ba

Browse files
committed
Fix NBT saving.
1 parent a20b6b8 commit cac13ba

File tree

1 file changed

+5
-0
lines changed
  • fluids/src/main/java/sunsetsatellite/catalyst/fluids/util

1 file changed

+5
-0
lines changed

fluids/src/main/java/sunsetsatellite/catalyst/fluids/util/NBTHelper.java

+5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
public class NBTHelper {
1010

11+
private static boolean preventSaving = false;
12+
1113
public static void saveInvToNBT(ItemStack source_item, IInventory inv){
14+
if(preventSaving) return;
1215
CompoundTag itemData = source_item.getData().getCompound("inventory");
1316
for(int i = 0; i < inv.getSizeInventory();i++){
1417
ItemStack item = inv.getStackInSlot(i);
@@ -39,6 +42,7 @@ public static void saveInvToNBT(ItemStack source_item, IInventory inv){
3942
}
4043

4144
public static void loadInvFromNBT(ItemStack source_item, IInventory inv, int amount, int fluidAmount){
45+
preventSaving = true;
4246
CompoundTag itemNBT = source_item.getData().getCompound("inventory");
4347
CompoundTag fluidNBT = source_item.getData().getCompound("fluidInventory");
4448
for(int i = 0; i < amount;i++){
@@ -54,5 +58,6 @@ public static void loadInvFromNBT(ItemStack source_item, IInventory inv, int amo
5458
fluidInv.setFluidInSlot(i,fluid);
5559
}
5660
}
61+
preventSaving = false;
5762
}
5863
}

0 commit comments

Comments
 (0)