diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-10-18 17:03:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 18:03:23 +0200 |
| commit | fbdbb388c369fae549cfde3eed38b536f7461d90 (patch) | |
| tree | b46f7fc949d7e4c6e3be910b81ed725e6dc1648e /src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities | |
| parent | b670446fdf49991093b485f0aa14050039632775 (diff) | |
| download | GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.gz GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.tar.bz2 GT5-Unofficial-fbdbb388c369fae549cfde3eed38b536f7461d90.zip | |
Cleaning up (#767)
* Kill playerAPI
* Gut more events and compat that is now obsolete
* Remove commented out code
* Remove final modifier from methods
* Make more stuff final
* Remove slow building ring
* Protected -> private in final classes
* More cleaning
* More cleaning v2
* Purging
* Clean DevHelper
* Clean DevHelper 2
* delete DevHelper
* remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files
* check for obfuscation only once in the IFMLloadingPlugin.injectData
* don't instantiate the static class ASMConfig
* delete unused and empty implementation of IFMLCallHook
* delete empty class
* delete ClassesToTransform class that just holds the class names constants
* delete unused methods and unsless logging in dummymod container
* delete unused transformer ClassTransformer_TT_ThaumicRestorer
* spotless
* Clean
* Clean utils
* Build checkpoint
* Purge
* Stage 2
* Stage 3
* Stage 4
* Stage 5
* Stage 6
* Spotless
* Imports
* Stage idk
* Stage 1
* Fix issue
* Spotless
* Format numbers
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities')
39 files changed, 232 insertions, 2643 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java index 8c7ca4c9e1..886500457b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java @@ -260,7 +260,7 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mCurrentSlot = (mCurrentSlot + 1) % 18; } switch (mMode) { - case 0: + case 0 -> { if (mInventory[mCurrentSlot] != null && !isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2 && mCurrentSlot < 8) { @@ -277,8 +277,8 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B tRecipe[i].stackSize = 1; } } - break; - case 1: + } + case 1 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; @@ -308,10 +308,9 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } - break; - case 2: + } + case 2 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; @@ -329,10 +328,9 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } - break; - case 3: + } + case 3 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; @@ -353,10 +351,9 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } - break; - case 4: + } + case 4 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; @@ -382,10 +379,9 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } - break; - case 5: + } + case 5 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; @@ -397,11 +393,8 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); tTempStack.stackSize = 1; tRecipe[0] = tTempStack; - tOutput = GT_OreDictUnificator.get(true, tTempStack); - if (tOutput != null && GT_Utility.areStacksEqual(tOutput, tTempStack)) tOutput = null; - if (tOutput == null) { tRecipe[0] = null; if (mInventory[18] == null) { @@ -410,15 +403,14 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mTicksUntilNextUpdate = 1; } } - break; - case 6: + } + case 6 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } else if (OrePrefixes.dustSmall.contains(mInventory[mCurrentSlot])) { tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); tTempStack.stackSize = 1; @@ -433,7 +425,6 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } } else if (OrePrefixes.dustTiny.contains(mInventory[mCurrentSlot])) { tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]); @@ -454,7 +445,6 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } } else { if (mInventory[18] == null && mThroughPut < 2) { @@ -462,10 +452,9 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } - break; - case 7: + } + case 7 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot]) || !OrePrefixes.nugget.contains(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { @@ -492,10 +481,9 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B mInventory[mCurrentSlot] = null; mTicksUntilNextUpdate = 1; } - break; } - break; - case 8: + } + case 8 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot]) || mInventory[mCurrentSlot].getItemDamage() <= 0 || !mInventory[mCurrentSlot].getItem().isRepairable()) { @@ -525,8 +513,8 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B break; } } - break; - case 9: + } + case 9 -> { if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) { if (mInventory[18] == null && mThroughPut < 2) { mInventory[18] = mInventory[mCurrentSlot]; @@ -547,7 +535,7 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B } } if (tRecipe[1] == null) tRecipe[0] = null; - break; + } } } @@ -677,13 +665,13 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B } private ArrayList<ItemStack> recipeContent(ItemStack[] tRecipe) { - ArrayList<ItemStack> tList = new ArrayList<ItemStack>(); + ArrayList<ItemStack> tList = new ArrayList<>(); for (byte i = 0; i < 9; i++) { if (tRecipe[i] != null) { boolean temp = false; - for (byte j = 0; j < tList.size(); j++) { - if (GT_Utility.areStacksEqual(tRecipe[i], tList.get(j))) { - tList.get(j).stackSize++; + for (ItemStack itemStack : tList) { + if (GT_Utility.areStacksEqual(tRecipe[i], itemStack)) { + itemStack.stackSize++; temp = true; break; } @@ -695,7 +683,7 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B } private ArrayList<ItemStack> benchContent() { - ArrayList<ItemStack> tList = new ArrayList<ItemStack>(); + ArrayList<ItemStack> tList = new ArrayList<>(); for (byte i = 0; i < 18; i++) { if (mInventory[i] != null) { boolean temp = false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java deleted file mode 100644 index 2c9a50dfa5..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java +++ /dev/null @@ -1,686 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.automation; - -import static net.minecraftforge.common.util.ForgeDirection.DOWN; -import static net.minecraftforge.common.util.ForgeDirection.EAST; -import static net.minecraftforge.common.util.ForgeDirection.NORTH; -import static net.minecraftforge.common.util.ForgeDirection.SOUTH; -import static net.minecraftforge.common.util.ForgeDirection.UP; -import static net.minecraftforge.common.util.ForgeDirection.WEST; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.oredict.OreDictionary; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.ModularUITextures; -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; -import com.gtnewhorizons.modularui.common.widget.ButtonWidget; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.modularui.IAddGregtechLogo; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntity_TieredMachineBlock - implements IAddGregtechLogo, IAddUIWidgets { - - public int[] mSlotRange = new int[4]; - public boolean mWorkedLastTick = false; - protected String mLocalName; - - public GT_MetaTileEntity_ElectricInventoryManager(final int aID, final int aTier, final String aDescription) { - super( - aID, - "basicmachine.automation.inventorymanager.0" + aTier, - "Electric Inventory Manager (" + GT_Values.VN[aTier] + ")", - aTier, - 16, - aDescription); - mLocalName = "Auto Workbench (" + GT_Values.VN[aTier] + ")"; - } - - public GT_MetaTileEntity_ElectricInventoryManager(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, 16, aDescription, aTextures); - } - - @Override - public boolean isTransformerUpgradable() { - return true; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public long maxEUInput() { - return GT_Values.V[mTier]; - } - - @Override - public long maxEUOutput() { - return GT_Values.V[mTier]; - } - - @Override - public long getMinimumStoredEU() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxEUStore() { - return GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier]); - } - - @Override - public long maxAmperesIn() { - return 4; - } - - @Override - public long maxAmperesOut() { - return 4; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < 3; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return !isOutputFacing(side); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - for (int i = 0; i < mSlotRange.length; i++) { - if (side == getRangeDirection(i) && getRangeEnergy(i)) { - return true; - } - } - return false; - } - - @Override - public int getSizeInventory() { - return 16; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ElectricInventoryManager( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mSlotRange0", mSlotRange[0]); - aNBT.setInteger("mSlotRange1", mSlotRange[1]); - aNBT.setInteger("mSlotRange2", mSlotRange[2]); - aNBT.setInteger("mSlotRange3", mSlotRange[3]); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mSlotRange[0] = aNBT.getInteger("mSlotRange0"); - mSlotRange[1] = aNBT.getInteger("mSlotRange1"); - mSlotRange[2] = aNBT.getInteger("mSlotRange2"); - mSlotRange[3] = aNBT.getInteger("mSlotRange3"); - } - - public void iterateRangeDirection(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~7) | (((mSlotRange[aIndex] & 7) + 1) % 6); - } - - public void switchRangeEnergy(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~8) | ((mSlotRange[aIndex] & 8) > 0 ? 0 : 8); - } - - public void iterateSlot1Direction(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~112) | (((((mSlotRange[aIndex] & 112) >> 4) + 1) % 6) << 4); - } - - public void iterateSlot2Direction(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~896) | (((((mSlotRange[aIndex] & 896) >> 7) + 1) % 6) << 7); - } - - public void iterateSlot3Direction(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~7168) | (((((mSlotRange[aIndex] & 7168) >> 10) + 1) % 6) << 10); - } - - public void switchSlot1InOut(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~8192) | ((mSlotRange[aIndex] & 8192) > 0 ? 0 : 8192); - } - - public void switchSlot2InOut(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~16384) | ((mSlotRange[aIndex] & 16384) > 0 ? 0 : 16384); - } - - public void switchSlot3InOut(int aIndex) { - mSlotRange[aIndex] = (mSlotRange[aIndex] & ~32768) | ((mSlotRange[aIndex] & 32768) > 0 ? 0 : 32768); - } - - public ForgeDirection getRangeDirection(int aIndex) { - return ForgeDirection.getOrientation(mSlotRange[aIndex] & 7); - } - - public ForgeDirection getSlot1Direction(int aIndex) { - return ForgeDirection.getOrientation((mSlotRange[aIndex] & 112) >> 4); - } - - public ForgeDirection getSlot2Direction(int aIndex) { - return ForgeDirection.getOrientation((mSlotRange[aIndex] & 896) >> 7); - } - - public ForgeDirection getSlot3Direction(int aIndex) { - return ForgeDirection.getOrientation((mSlotRange[aIndex] & 7168) >> 10); - } - - public boolean getRangeEnergy(int aIndex) { - return (mSlotRange[aIndex] & 8) > 0; - } - - public boolean getSlot1InOut(int aIndex) { - return (mSlotRange[aIndex] & 8192) > 0; - } - - public boolean getSlot2InOut(int aIndex) { - return (mSlotRange[aIndex] & 16384) > 0; - } - - public boolean getSlot3InOut(int aIndex) { - return (mSlotRange[aIndex] & 32768) > 0; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide() - && getBaseMetaTileEntity().getUniversalEnergyStored() >= 5000 - && (getBaseMetaTileEntity().hasWorkJustBeenEnabled() || getBaseMetaTileEntity().getTimer() % 100 == 0 - || mWorkedLastTick - || getBaseMetaTile |
