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/core/container | |
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/core/container')
4 files changed, 15 insertions, 266 deletions
diff --git a/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java b/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java index 4b71fefdb9..a98097967a 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java +++ b/src/main/java/gtPlusPlus/core/container/Container_ProjectTable.java @@ -65,8 +65,6 @@ public class Container_ProjectTable extends Container { // Storage Side for (var6 = 0; var6 < 3; ++var6) { for (var7 = 0; var7 < 3; ++var7) { - // Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * - // 18)); this.addSlotToContainer( new Slot(this.craftMatrix, nextFreeSlot, 8 + 18 + (var7 * 18), 8 + (var6 * 18))); this.slotGrid[o] = nextFreeSlot; diff --git a/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java deleted file mode 100644 index a9a7b33ad7..0000000000 --- a/src/main/java/gtPlusPlus/core/container/Container_RoundRobinator.java +++ /dev/null @@ -1,241 +0,0 @@ -package gtPlusPlus.core.container; - -import java.util.Iterator; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_RoundRobinator; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; - -public class Container_RoundRobinator extends Container { - - public TileEntityRoundRobinator tile_entity; - public final Inventory_RoundRobinator inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - private final boolean[] mActiveData = new boolean[] { false, false, false, false }; - - public static int mStorageSlotNumber = 4; // Number of slots in storage area - public static int mInventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int mFullSlotNumber = mInventorySlotNumber + mStorageSlotNumber; // All - // slots - - public Container_RoundRobinator(final InventoryPlayer inventory, final TileEntityRoundRobinator te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - boolean[] aTemp = te.getActiveSides(); - if (aTemp != null && aTemp.length == 4) { - for (int i = 0; i < 4; i++) { - mActiveData[i] = aTemp[i]; - } - } - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int o = 0; - int xStart = 134; - int yStart = 32; - - try { - // 0 - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart + 18, yStart)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart + 17)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart + 18, yStart + 17)); - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer( - new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - } catch (Throwable t) { - t.printStackTrace(); - } - this.detectAndSendChanges(); - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, - final EntityPlayer aPlayer) { - - if (!aPlayer.worldObj.isRemote) { - if (aSlotIndex < 4) { - this.tile_entity.toggleSide(ForgeDirection.getOrientation(aSlotIndex + 2)); - // Logger.INFO("Toggling side: "+(aSlotIndex+2)+" | Active: - // "+this.tile_entity.getSideActive(aSlotIndex+2)+" | Data:"+this.tile_entity.getDataString()); - } - } - return GT_Values.NI; - // return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockRoundRobinator) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public final void addCraftingToCrafters(ICrafting par1ICrafting) { - try { - super.addCraftingToCrafters(par1ICrafting); - } catch (Throwable var3) { - var3.printStackTrace(); - } - } - - @Override - public final void removeCraftingFromCrafters(ICrafting par1ICrafting) { - try { - super.removeCraftingFromCrafters(par1ICrafting); - } catch (Throwable var3) { - var3.printStackTrace(); - } - } - - @Override - public final void detectAndSendChanges() { - try { - super.detectAndSendChanges(); - detectAndSendChangesEx(); - } catch (Throwable var2) { - var2.printStackTrace(); - } - } - - @Override - public final void updateProgressBar(int par1, int par2) { - try { - super.updateProgressBar(par1, par2); - updateProgressBarEx(par1, par2); - } catch (Throwable var4) { - var4.printStackTrace(); - } - } - - public int mSide_1 = 0; - public int mSide_2 = 0; - public int mSide_3 = 0; - public int mSide_4 = 0; - public int mTier = 1; - public int mTickRate = 50; - - private int oSide_1 = 0; - private int oSide_2 = 0; - private int oSide_3 = 0; - private int oSide_4 = 0; - private int oTier = 1; - private int oTickRate = 50; - - private int mTimer = 0; - - public void detectAndSendChangesEx() { - super.detectAndSendChanges(); - if (!this.tile_entity.getWorldObj().isRemote) { - boolean[] aTemp = tile_entity.getActiveSides(); - for (int i = 0; i < 4; i++) { - mActiveData[i] = aTemp[i]; - } - this.mSide_1 = aTemp[0] ? 1 : 0; - this.mSide_2 = aTemp[1] ? 1 : 0; - this.mSide_3 = aTemp[2] ? 1 : 0; - this.mSide_4 = aTemp[3] ? 1 : 0; - this.mTier = this.tile_entity.getTier(); - this.mTickRate = this.tile_entity.getTickRate(); - ++this.mTimer; - Iterator var2 = this.crafters.iterator(); - - while (true) { - ICrafting var1; - do { - if (!var2.hasNext()) { - this.oSide_1 = this.mSide_1; - this.oSide_2 = this.mSide_2; - this.oSide_3 = this.mSide_3; - this.oSide_4 = this.mSide_4; - this.oTier = this.mTier; - this.oTickRate = this.mTickRate; - return; - } - var1 = (ICrafting) var2.next(); - if (this.mTimer % 500 == 10 || this.oSide_1 != this.mSide_1) { - var1.sendProgressBarUpdate(this, 2, this.mSide_1); - } - if (this.mTimer % 500 == 10 || this.oSide_2 != this.mSide_2) { - var1.sendProgressBarUpdate(this, 4, this.mSide_2); - } - if (this.mTimer % 500 == 10 || this.oSide_3 != this.mSide_3) { - var1.sendProgressBarUpdate(this, 6, this.mSide_3); - } - if (this.mTimer % 500 == 10 || this.oSide_4 != this.mSide_4) { - var1.sendProgressBarUpdate(this, 8, this.mSide_4); - } - if (this.mTimer % 500 == 10 || this.oTier != this.mTier) { - var1.sendProgressBarUpdate(this, 10, this.mTier); - } - if (this.mTimer % 500 == 10 || this.oTickRate != this.mTickRate) { - var1.sendProgressBarUpdate(this, 12, this.mTickRate); - } - } while (this.mTimer % 500 != 10); - } - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBarEx(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 2: - this.mSide_1 = par2; - break; - case 4: - this.mSide_2 = par2; - break; - case 6: - this.mSide_3 = par2; - case 8: - this.mSide_4 = par2; - case 10: - this.mTier = par2; - case 12: - this.mTickRate = par2; - break; - } - } -} diff --git a/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java index f9b4a43641..4f54a0795a 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java +++ b/src/main/java/gtPlusPlus/core/container/Container_SuperJukebox.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.container; -import java.util.Iterator; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -177,21 +175,25 @@ public class Container_SuperJukebox extends Container { public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { if (tile_entity == null || tile_entity.getWorldObj().isRemote) return null; switch (aSlotIndex) { - case SLOT_HOLO_PLAY: + case SLOT_HOLO_PLAY -> { if (tile_entity == null) return null; tile_entity.mIsPlaying = !tile_entity.mIsPlaying; Logger.INFO("Jukebox | Playing: " + tile_entity.mIsPlaying); tile_entity.jukeboxLogicUpdate(); return null; - case SLOT_HOLO_LOOP: + } + case SLOT_HOLO_LOOP -> { if (tile_entity == null) return null; tile_entity.mIsLooping = !tile_entity.mIsLooping; Logger.INFO("Jukebox | Looping: " + tile_entity.mIsLooping); return null; - case 20: + } + case 20 -> { return null; - default: + } + default -> { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } } } @@ -206,9 +208,8 @@ public class Container_SuperJukebox extends Container { isPlaying = tile_entity.mIsPlaying; isLooping = tile_entity.mIsLooping; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; var1.sendProgressBarUpdate(this, 102, isPlaying ? 1 : 0); var1.sendProgressBarUpdate(this, 103, isLooping ? 1 : 0); } @@ -224,12 +225,8 @@ public class Container_SuperJukebox extends Container { public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { - case 102: - isPlaying = (par2 != 0); - break; - case 103: - isLooping = (par2 != 0); - break; + case 102 -> isPlaying = (par2 != 0); + case 103 -> isLooping = (par2 != 0); } } } diff --git a/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java b/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java index 5af33d3684..2f2d69364f 100644 --- a/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java +++ b/src/main/java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.container; -import java.util.Iterator; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -147,9 +145,8 @@ public class Container_VolumetricFlaskSetter extends Container { mCustomValue = mTileEntity.getCustomValue(); mTimer++; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; if (mTimer % 20 == 10 || oCustomValue != mCustomValue) { var1.sendProgressBarUpdate(this, 0, mCustomValue); } @@ -163,9 +160,7 @@ public class Container_VolumetricFlaskSetter extends Container { public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { - case 0: - mCustomValue = (short) par2; - break; + case 0 -> mCustomValue = (short) par2; } } |