From a1e612c8b8d95652b78ffe2167445f4914baf75a Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Mon, 12 Oct 2020 20:57:59 +0200 Subject: add overflow voiding to digital chests --- .../GT_MetaTileEntity_DigitalChestBase.java | 36 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'src/main/java') 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 43c1778d8f..9cbb032de2 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 @@ -15,11 +15,12 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; @Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2") public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEInventory { public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks"); + super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks Use screwdrive to enable void items on over flow"); } public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -56,6 +57,14 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti aBaseMetaTileEntity.openGUI(aPlayer); return true; } + + protected boolean mVoidOverflow = false; + + @Override + public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mVoidOverflow = !mVoidOverflow; + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.voidoveflow") +" "+mVoidOverflow); + } @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { @@ -80,10 +89,13 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } int count = getItemCount(); ItemStack stack = getItemStack(); - if ((mInventory[0] != null) && (count < getMaxItemCount()) && GT_Utility.areStacksEqual(mInventory[0], stack)) { + if ((mInventory[0] != null) && ((count < getMaxItemCount())|| mVoidOverflow ) && GT_Utility.areStacksEqual(mInventory[0], stack)) { count += mInventory[0].stackSize; if (count > getMaxItemCount()) { - mInventory[0].stackSize = (count - getMaxItemCount()); + if (mVoidOverflow) + mInventory[0] = null; + else + mInventory[0].stackSize = (count - getMaxItemCount()); count = getMaxItemCount(); } else { mInventory[0] = null; @@ -106,7 +118,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti mInventory[2] = null; } } - } + }} abstract protected int getItemCount(); abstract public void setItemCount(int aCount); @@ -182,6 +194,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti aNBT.setInteger("mItemCount", getItemCount()); if (getItemStack() != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + aNBT.setBoolean("mVoidOverflow", mVoidOverflow); } @Override @@ -190,6 +203,8 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti setItemCount(aNBT.getInteger("mItemCount")); if (aNBT.hasKey("mItemStack")) setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"))); + mVoidOverflow = aNBT.getBoolean("mVoidOverflow"); + } @Override @@ -235,7 +250,18 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti if (storedStack != null) { if (GT_Utility.areStacksEqual(storedStack, inputStack)) { if (input.getStackSize() + getItemCount() > getMaxItemCount()) - return createOverflowStack(input.getStackSize() + getItemCount(), mode); + { + if (mVoidOverflow) + { + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount(getMaxItemCount()); + return null; + } + else + { + return createOverflowStack(input.getStackSize() + getItemCount(), mode); + } + } else { if (mode != appeng.api.config.Actionable.SIMULATE) setItemCount(getItemCount() + (int) input.getStackSize()); -- cgit From 51c8b661564bcd3c2b99572ec9dfb522076442bf Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Mon, 12 Oct 2020 21:28:23 +0200 Subject: speling --- .../common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') 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 9cbb032de2..52e0acd72e 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 @@ -20,7 +20,7 @@ import net.minecraft.util.StatCollector; @Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2") public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEInventory { public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks Use screwdrive to enable void items on over flow"); + super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks Use a screwdriver to enable voiding items on overflow"); } public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { -- cgit From 7d49c433e2dfb6f422b366fd3fb60632be2d70c7 Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Mon, 12 Oct 2020 22:40:47 +0200 Subject: fix extra } in post tick --- .../common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') 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 52e0acd72e..35d1849a6e 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 @@ -118,7 +118,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti mInventory[2] = null; } } - }} + } abstract protected int getItemCount(); abstract public void setItemCount(int aCount); -- cgit From d2f9c3c10f44a50fa07c16f1d93891e797a599b0 Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Tue, 13 Oct 2020 01:18:37 +0200 Subject: remove extra if else --- .../storage/GT_MetaTileEntity_DigitalChestBase.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/main/java') 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 35d1849a6e..15b6c28f6d 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 @@ -91,14 +91,11 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti ItemStack stack = getItemStack(); if ((mInventory[0] != null) && ((count < getMaxItemCount())|| mVoidOverflow ) && GT_Utility.areStacksEqual(mInventory[0], stack)) { count += mInventory[0].stackSize; - if (count > getMaxItemCount()) { - if (mVoidOverflow) - mInventory[0] = null; - else - mInventory[0].stackSize = (count - getMaxItemCount()); - count = getMaxItemCount(); - } else { + if (count <= getMaxItemCount() || mVoidOverflow ) { mInventory[0] = null; + } else { + mInventory[0].stackSize = (count - getMaxItemCount()); + count = getMaxItemCount(); } } if (mInventory[1] == null && stack != null) { -- cgit From 344b00012aca59c4b0372185e41f529baffa5da3 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Tue, 13 Oct 2020 22:26:49 +0800 Subject: Make cleanroom workspeed based on height and tier It is now 225 second per block height. A standard 3x4x3 cleanroom will take 7.5 minute to fire up (down from 8.33 minute). Any wider will not cause it to slowdown. The cleanroom will be overclockable (not perfect). --- .../machines/multi/GT_MetaTileEntity_Cleanroom.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 673c2cabaf..6ceebc3877 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -18,8 +18,10 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import static gregtech.api.enums.GT_Values.debugCleanroom; +import static gregtech.api.enums.GT_Values.V; public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase { + private int mHeight = -1; public GT_MetaTileEntity_Cleanroom(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -46,17 +48,20 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas "Up to 10 Machine Hull Item & Energy transfer through walls", "Remaining Blocks: Plascrete, 20 min", GT_Values.cleanroomGlass+"% of the Plascrete can be Reinforced Glass (min 20 Plascrete still apply)", - "Consumes 40 EU/t when first turned on and 4 EU/t once at 100% efficiency", + "Consumes 40 EU/t when first turned on and 4 EU/t once at 100% efficiency when not overclocked", "An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV", "2 LV batteries + 1 LV generator or 1 MV generator", + "Time required to reach full efficiency is propotional to the height of empty space within.", "Make sure your Energy Hatch matches!"}; } @Override public boolean checkRecipe(ItemStack aStack) { mEfficiencyIncrease = 100; - mMaxProgresstime = 100; - mEUt = -4; + // use the standard overclock mechanism to determine duration and estimate a maximum consumption + calculateOverclockedNessMulti(40, 45 * Math.min(1, mHeight - 1), 1, getMaxInputVoltage()); + // negate it to trigger the special energy consumption function. divide by 10 to get the actual final consumption. + mEUt /= -10; return true; } @@ -231,6 +236,8 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas float ratio = (((float)mPlascreteCount)/100f)* GT_Values.cleanroomGlass; + this.mHeight = -y; + return mPlascreteCount>=20 && mGlassCount < (int) Math.floor(ratio); } -- cgit From cf5760685cb16758329f32df8eadfc703ec8abae Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Tue, 13 Oct 2020 17:31:28 +0200 Subject: better localisation handeling --- .../tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java | 2 +- src/main/resources/assets/gregtech/lang/en_US.lang | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java') 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 15b6c28f6d..6d97d9011d 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 @@ -63,7 +63,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mVoidOverflow = !mVoidOverflow; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.voidoveflow") +" "+mVoidOverflow); + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); } @Override diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index bb76bb3c9c..88616c6041 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -41,7 +41,8 @@ GT5U.machines.separatebus=Input busses are separated GT5U.machines.pumpareaset=Pumping area set to GT5U.machines.oilfluidpump=Oil/Fluid Pump GT5U.machines.minermulti=Multiblock Miner -GT5U.machines.voidoveflow=Void Over Flow +GT5U.machines.voidoveflow.enabled=Overflow voiding enabled +GT5U.machines.voidoveflow.disabled=Overflow voiding disabled -- cgit