From e05aadf2752c27a66822e7d4b92693a88ec4470e Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Thu, 16 Dec 2021 01:20:23 +0800 Subject: Fix oversight in cover NBT migration --- src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java | 6 ++++-- src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index fc5fa64d91..806b0c6e53 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -901,14 +901,16 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, mID); NBTTagCompound tNBT = new NBTTagCompound(); if (mStrongRedstone > 0) tNBT.setByte("mStrongRedstone", mStrongRedstone); + boolean hasCover = false; for (byte i = 0; i < mCoverSides.length; i++) { if (mCoverSides[i] != 0) { if (mCoverData[i] != null) // this really shouldn't be null if a cover is there already, but whatever tNBT.setTag(COVER_DATA_NBT_KEYS[i], mCoverData[i].saveDataToNBT()); - tNBT.setIntArray("mCoverSides", mCoverSides); - break; + hasCover = true; } } + if (hasCover) + tNBT.setIntArray("mCoverSides", mCoverSides); if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT); if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT); return new ArrayList(Arrays.asList(rStack)); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index f2514f1290..585f8394d3 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1439,14 +1439,16 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (mColor > 0) tNBT.setByte("mColor", mColor); if (mOtherUpgrades > 0) tNBT.setByte("mOtherUpgrades", mOtherUpgrades); if (mStrongRedstone > 0) tNBT.setByte("mStrongRedstone", mStrongRedstone); + boolean hasCover = false; for (byte i = 0; i < mCoverSides.length; i++) { if (mCoverSides[i] != 0) { if (mCoverData[i] != null) // this really shouldn't be null if a cover is there already, but whatever tNBT.setTag(COVER_DATA_NBT_KEYS[i], mCoverData[i].saveDataToNBT()); - tNBT.setIntArray("mCoverSides", mCoverSides); - break; + hasCover = true; } } + if (hasCover) + tNBT.setIntArray("mCoverSides", mCoverSides); if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT); if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT); return new ArrayList(Arrays.asList(rStack)); -- cgit