From 2c31bf8538f3d4b2fa77f39c40fa5f1a01c9bfd8 Mon Sep 17 00:00:00 2001 From: NexusNull Date: Wed, 28 Dec 2022 23:10:58 +0100 Subject: Remove void break from fluid tanks and chests (#1602) * Remove void break from fluid tanks Previously, sneaking while breaking a fluid tank would void the contents of the tank, leading to potential loss of valuable resources. However, this behavior is not consistent with other blocks, such as chests and furnaces, which retain their contents when broken while sneaking. This commit removes the sneak breaking voiding behavior for fluid tanks, bringing them in line with other blocks and reducing the risk of unintended loss for players. * run spotless * fix stray check for voidBreak Signed-off-by: NexusNull * remove override Signed-off-by: NexusNull * remove void tooltip Signed-off-by: NexusNull Signed-off-by: NexusNull --- .../GT_MetaTileEntity_DigitalChestBase.java | 10 +------ .../storage/GT_MetaTileEntity_DigitalTankBase.java | 27 +++++++------------ .../storage/GT_MetaTileEntity_QuantumChest.java | 31 +++++++++++----------- 3 files changed, 25 insertions(+), 43 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java index 747116400a..8ef639e89e 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -41,7 +41,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti implements appeng.api.storage.IMEMonitor, IAddUIWidgets { protected boolean mVoidOverflow = false; protected boolean mDisableFilter; - public boolean voidBreak; private Map, Object> listeners = null; @@ -50,8 +49,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti "This Chest stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + " Blocks", "Use a screwdriver to enable", "voiding items on overflow", - "Can keep its contents when harvested", - "Sneak when harvesting to void its contents" + "Will keep its contents when harvested", }); } @@ -359,12 +357,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return true; } - @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - voidBreak = aPlayer.isSneaking(); - super.onLeftclick(aBaseMetaTileEntity, aPlayer); - } - @Override public boolean isFacingValid(byte aFacing) { return true; diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java index a4d1f1113f..278e4b3d15 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java @@ -42,7 +42,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit implements IFluidLockable, IAddUIWidgets { public boolean mOutputFluid = false, mVoidFluidPart = false, mVoidFluidFull = false, mLockFluid = false; protected String lockedFluidName = null; - private boolean voidBreak; public boolean mAllowInputFromOutputSide = false; public GT_MetaTileEntity_DigitalTankBase(int aID, String aName, String aNameRegional, int aTier) { @@ -50,7 +49,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit StatCollector.translateToLocalFormatted( "GT5U.machines.digitaltank.tooltip", GT_Utility.formatNumbers(commonSizeCompute(aTier))), StatCollector.translateToLocal("GT5U.machines.digitaltank.tooltip1"), - StatCollector.translateToLocal("GT5U.machines.digitaltank.tooltip2") }); } @@ -96,17 +94,16 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit @Override public void setItemNBT(NBTTagCompound aNBT) { - if (!voidBreak) { - if (mFluid != null && mFluid.amount >= 0) { - aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - } - if (mOutputFluid) aNBT.setBoolean("mOutputFluid", true); - if (mVoidFluidPart) aNBT.setBoolean("mVoidOverflow", true); - if (mVoidFluidFull) aNBT.setBoolean("mVoidFluidFull", true); - if (mLockFluid) aNBT.setBoolean("mLockFluid", true); - if (GT_Utility.isStringValid(lockedFluidName)) aNBT.setString("lockedFluidName", lockedFluidName); - if (this.mAllowInputFromOutputSide) aNBT.setBoolean("mAllowInputFromOutputSide", true); + if (mFluid != null && mFluid.amount >= 0) { + aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); } + if (mOutputFluid) aNBT.setBoolean("mOutputFluid", true); + if (mVoidFluidPart) aNBT.setBoolean("mVoidOverflow", true); + if (mVoidFluidFull) aNBT.setBoolean("mVoidFluidFull", true); + if (mLockFluid) aNBT.setBoolean("mLockFluid", true); + if (GT_Utility.isStringValid(lockedFluidName)) aNBT.setString("lockedFluidName", lockedFluidName); + if (this.mAllowInputFromOutputSide) aNBT.setBoolean("mAllowInputFromOutputSide", true); + super.setItemNBT(aNBT); } @@ -250,12 +247,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit return true; } - @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - voidBreak = aPlayer.isSneaking(); - super.onLeftclick(aBaseMetaTileEntity, aPlayer); - } - @Override public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java index 384b55cc4c..18d54215a1 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java @@ -33,25 +33,24 @@ public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_DigitalChe @Override public void setItemNBT(NBTTagCompound aNBT) { mInvData = new NBTTagList(); - if (!voidBreak) { - for (int i = 0; i < 3; i++) { - if (mInventory[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - tNBT.setByte("Count", (byte) mInventory[i].stackSize); - tNBT.setShort("Damage", (short) mInventory[i].getItemDamage()); - tNBT.setShort("id", (short) Item.getIdFromItem(mInventory[i].getItem())); - tNBT.setInteger("IntSlot", i); - if (mInventory[i].hasTagCompound()) { - tNBT.setTag("tag", mInventory[i].getTagCompound()); - } - mInvData.appendTag(tNBT); + for (int i = 0; i < 3; i++) { + if (mInventory[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + tNBT.setByte("Count", (byte) mInventory[i].stackSize); + tNBT.setShort("Damage", (short) mInventory[i].getItemDamage()); + tNBT.setShort("id", (short) Item.getIdFromItem(mInventory[i].getItem())); + tNBT.setInteger("IntSlot", i); + if (mInventory[i].hasTagCompound()) { + tNBT.setTag("tag", mInventory[i].getTagCompound()); } + mInvData.appendTag(tNBT); } - if (mItemStack != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); - aNBT.setTag("Inventory", mInvData); - aNBT.setInteger("mItemCount", getItemCount()); - aNBT.setBoolean("mVoidOverflow", mVoidOverflow); } + if (mItemStack != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + aNBT.setTag("Inventory", mInvData); + aNBT.setInteger("mItemCount", getItemCount()); + aNBT.setBoolean("mVoidOverflow", mVoidOverflow); + super.setItemNBT(aNBT); } -- cgit