From a265085bd7742ebf1e2e95e4bf7397ba5bea01dc Mon Sep 17 00:00:00 2001 From: miozune Date: Sun, 9 Oct 2022 18:10:02 +0900 Subject: updateBuildScript & spotlessApply --- .../container/Container_ItemProxyEndpoint.java | 86 ++++++------ .../container/Container_ItemProxySource.java | 111 ++++++++------- .../container/Container_ModularNuclearReactor.java | 154 ++++++++++----------- 3 files changed, 173 insertions(+), 178 deletions(-) (limited to 'src/main/java/common/container') diff --git a/src/main/java/common/container/Container_ItemProxyEndpoint.java b/src/main/java/common/container/Container_ItemProxyEndpoint.java index 63f836e001..8f509e789c 100644 --- a/src/main/java/common/container/Container_ItemProxyEndpoint.java +++ b/src/main/java/common/container/Container_ItemProxyEndpoint.java @@ -8,20 +8,20 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class Container_ItemProxyEndpoint extends Container { - - private final IInventory teInventory; - - private int slotID = 0; - - public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { - this.teInventory = (IInventory) te; - - // Source Slot - addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); - // Config slot - addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); - - //Inventory + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slot + addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); + // Config slot + addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); + + // Inventory for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); @@ -31,38 +31,36 @@ public class Container_ItemProxyEndpoint extends Container { for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); + } - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); - if (stackInSlot.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return teInventory.isUseableByPlayer(player); - } + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } -} + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } +} diff --git a/src/main/java/common/container/Container_ItemProxySource.java b/src/main/java/common/container/Container_ItemProxySource.java index 2f59b97b73..23af97e5bb 100644 --- a/src/main/java/common/container/Container_ItemProxySource.java +++ b/src/main/java/common/container/Container_ItemProxySource.java @@ -8,33 +8,33 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class Container_ItemProxySource extends Container { - - private final IInventory teInventory; - - private int slotID = 0; - - public Container_ItemProxySource(TileEntity te, EntityPlayer player) { - this.teInventory = (IInventory) te; - - // Source Slots - addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); - - //Inventory + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxySource(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slots + addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); + + // Inventory for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); @@ -44,37 +44,36 @@ public class Container_ItemProxySource extends Container { for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); + } - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); - if (stackInSlot.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return teInventory.isUseableByPlayer(player); - } + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } } diff --git a/src/main/java/common/container/Container_ModularNuclearReactor.java b/src/main/java/common/container/Container_ModularNuclearReactor.java index f5430351e5..da96a0b24b 100644 --- a/src/main/java/common/container/Container_ModularNuclearReactor.java +++ b/src/main/java/common/container/Container_ModularNuclearReactor.java @@ -1,78 +1,76 @@ -package common.container; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import reactor.ButtonSlot; - -public class Container_ModularNuclearReactor extends Container { - - private int nextSlotID = 0; - private final Slot[] REACTOR_SLOTS = new Slot[54]; - private final Slot SLOT_CONFIGURATION; - private final Slot BUTTON_EU_MODE; - private final Slot BUTTON_FLUID_MODE; - private final Slot BUTTON_CONDITION; - private final Slot BUTTON_CONFIGURE; - private final Slot BUTTON_RESET; - - - public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) { - - // Add the reactor chamber - for(int x = 0; x < 9; x++) { - for(int y = 0; y < 6; y++){ - REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y))); - } - } - // Add the configuration slot - SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, getNextSlotID(), 0, 0)); - - // Add buttons (they're also slots) - BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); - - } - - private int getNextSlotID() { - nextSlotID++; - return nextSlotID - 1; - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); - - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } - - if (stackInSlot.stackSize == 0) { - slot.putStack(null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) { - return true; - } - -} +package common.container; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import reactor.ButtonSlot; + +public class Container_ModularNuclearReactor extends Container { + + private int nextSlotID = 0; + private final Slot[] REACTOR_SLOTS = new Slot[54]; + private final Slot SLOT_CONFIGURATION; + private final Slot BUTTON_EU_MODE; + private final Slot BUTTON_FLUID_MODE; + private final Slot BUTTON_CONDITION; + private final Slot BUTTON_CONFIGURE; + private final Slot BUTTON_RESET; + + public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) { + + // Add the reactor chamber + for (int x = 0; x < 9; x++) { + for (int y = 0; y < 6; y++) { + REACTOR_SLOTS[nextSlotID] = + super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y))); + } + } + // Add the configuration slot + SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, getNextSlotID(), 0, 0)); + + // Add buttons (they're also slots) + BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + } + + private int getNextSlotID() { + nextSlotID++; + return nextSlotID - 1; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack(null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } +} -- cgit