aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-03-28 23:20:04 +0800
committerGitHub <noreply@github.com>2022-03-28 17:20:04 +0200
commit604f27d847ce408126427bd2e742ebe94c24bc13 (patch)
tree24a2ba69b6725f1e64d6cd02ba923100a0716929 /src/main/java/gregtech
parent31be1f73d6e6e3fb599e9470176269cadb83742f (diff)
downloadGT5-Unofficial-604f27d847ce408126427bd2e742ebe94c24bc13.tar.gz
GT5-Unofficial-604f27d847ce408126427bd2e742ebe94c24bc13.tar.bz2
GT5-Unofficial-604f27d847ce408126427bd2e742ebe94c24bc13.zip
Also update existing sticks on load (#994)
Diffstat (limited to 'src/main/java/gregtech')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java
index a2971e0e86..ab6ba80f1b 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java
@@ -12,6 +12,7 @@ import gregtech.api.util.GT_AssemblyLineUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DATA_ACCESS;
@@ -125,6 +126,23 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch
}
@Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ if (aNBT.getByte("mSticksUpdated") != 1) {
+ for (int i = 0; i < getSizeInventory(); i++) {
+ GT_AssemblyLineUtils.processDataStick(getStackInSlot(i));
+ }
+ }
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ // reminder: remove this marker after many years
+ aNBT.setByte("mSticksUpdated", (byte) 1);
+ }
+
+ @Override
public void setInventorySlotContents(int aIndex, ItemStack aStack) {
super.setInventorySlotContents(aIndex, aStack);
GT_AssemblyLineUtils.processDataStick(aStack);