From c7536873578a600131e5ca647fac664594efbfd3 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 9 Jan 2022 02:29:10 +0000 Subject: Ported some GT4 content: Added GT Crop Managers. Added GT Auto Crafting Tables. Added GT Inventory Managers. --- .../api/gui/basic/GT_Container_CropHarvestor.java | 214 +++++++++++++++++++++ .../gui/basic/GT_GUIContainer_CropHarvestor.java | 72 +++++++ 2 files changed, 286 insertions(+) create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java new file mode 100644 index 0000000000..d56efdf0a4 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java @@ -0,0 +1,214 @@ +package gtPlusPlus.xmod.gregtech.api.gui.basic; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; +import ic2.core.item.DamageHandler; +import ic2.core.item.ItemIC2; +import ic2.core.util.StackUtil; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class GT_Container_CropHarvestor extends GT_ContainerMetaTile_Machine { + + public boolean mModeAlternative = false; + public int mWaterAmount = 0; + public int mWaterRealAmount = 0; + + public GT_Container_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + + + int aSlot = 1; + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 48, 64, false, true, 1)); + addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 8, 14)); + addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 26, 14)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 32)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 32)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 50)); + addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 50)); + + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 7)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 7)); + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 25)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 25)); + + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 43)); + addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 43)); + + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + + GT_MetaTileEntity_CropHarvestor machine = (GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity(); + + if (aSlotIndex == 0) { + machine.mModeAlternative = !machine.mModeAlternative; + return null; + } + + Slot tSlot = (Slot)inventorySlots.get(aSlotIndex); + if (tSlot != null) { + /*if (mTileEntity.getMetaTileEntity() == null) return null; + GT_MetaTileEntity_ElectricBufferSmall mte = (GT_MetaTileEntity_ElectricBufferSmall)mTileEntity.getMetaTileEntity(); + if (aSlotIndex == 1) { + mte.bOutput = !mte.bOutput; + if (aPlayer.worldObj.isRemote) + GT_Utility.sendChatToPlayer(aPlayer, new ChatComponentTranslation("metatileentity.status.energy_out." + mte.bOutput)); + return null; + } else if (aSlotIndex == 2) { + mte.bRedstoneIfFull = !mte.bRedstoneIfFull; + if (aPlayer.worldObj.isRemote) + GT_Utility.sendChatToPlayer(aPlayer, new ChatComponentTranslation("metatileentity.status.redstone_if_full." + mte.bRedstoneIfFull)); + return null; + } else if (aSlotIndex == 3) { + mte.bInvert = !mte.bInvert; + if (aPlayer.worldObj.isRemote) + GT_Utility.sendChatToPlayer(aPlayer, new ChatComponentTranslation("metatileentity.status.redstone_invert." + mte.bInvert)); + return null; + }*/ + } + + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public int getSlotCount() { + return 24; + } + + @Override + public int getSlotStartIndex() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 6; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + + // GT_MetaTileEntity_Boiler.getCapacity() is used for both water and steam capacity. + int capacity = ((GT_MetaTileEntity_CropHarvestor) this.mTileEntity.getMetaTileEntity()).getCapacity(); + + mModeAlternative = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).mModeAlternative; + mWaterRealAmount = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).getFluidAmount(); + this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterRealAmount * 54 / (capacity - 100))); + for (Object crafter : this.crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 102, mModeAlternative ? 1 : 0); + var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); + var1.sendProgressBarUpdate(this, 104, this.mWaterRealAmount); + } + } + + @Override + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 102: + mModeAlternative = (par2 != 0); + break; + case 103: + this.mWaterAmount = par2; + break; + case 104: + this.mWaterRealAmount = par2; + break; + } + } + + public static class SlotWeedEx extends Slot { + + public SlotWeedEx(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + @Override + public synchronized boolean isItemValid(final ItemStack itemstack) { + return isWeedEx(itemstack); + } + + @Override + public int getSlotStackLimit() { + return 1; + } + + private static boolean isWeedEx(ItemStack aStack) { + if (aStack != null && aStack.getItem() instanceof ItemIC2) { + if (aStack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) { + return true; + } + } + return false; + } + } + + public class SlotFertilizer extends Slot { + + public SlotFertilizer(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + @Override + public synchronized boolean isItemValid(final ItemStack aStack) { + if (aStack != null && aStack.getItem() instanceof ItemIC2) { + if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) { + return true; + } + } + return false; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java new file mode 100644 index 0000000000..ff2894f94a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java @@ -0,0 +1,72 @@ +package gtPlusPlus.xmod.gregtech.api.gui.basic; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.gui.GT_Container_Boiler; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_CropHarvestor extends GT_GUIContainerMetaTile_Machine { + + private final String mLocalName; + + public GT_GUIContainer_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_CropHarvestor(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "CropHarvestor.png"); + mLocalName = aLocalName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + drawTooltip(par1, par2); + //fontRendererObj.drawString("Crop Manager ("+this.mContainer.mTileEntity.getInputVoltage()+"v)", 8, 4, 4210752); + //fontRendererObj.drawString(mLocalName, 70, 69, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { + drawTexturedModalRect(x + 48, y + 64, 177, 37, 16, 16); + } + + int tScale = ((GT_Container_CropHarvestor) this.mContainer).mWaterAmount; + if (tScale > 0) { + drawTexturedModalRect(x + 47, y + 61 - tScale, 204, 54 - tScale, 10, tScale); + }; + + } + + private void drawTooltip(int x2, int y2) { + int xStart = (width - xSize) / 2; + int yStart = (height - ySize) / 2; + int x = x2 - xStart; + int y = y2 - yStart + 5; + List list = new ArrayList<>(); + if (y >= 68 && y <= 85) { + if (x >= 47 && x <= 64) { + if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { + list.add("Disable Hydration/Fertilizing/Weed-EX"); + } + else { + list.add("Enable Hydration/Fertilizing/Weed-EX"); + } + } + } + if (y >= 12 && y <= 66) { + if (x >= 47 && x <= 56) { + int aWater = ((GT_Container_CropHarvestor) mContainer).mWaterRealAmount; + list.add("Water: "+aWater+"L / "+((GT_Container_CropHarvestor) mContainer).mTileEntity.getMetaTileEntity().getCapacity()+"L"); + } + } + if (!list.isEmpty()) + drawHoveringText(list, x, y, fontRendererObj); + } + +} -- cgit From b72a9b138fafceab899c1bd86fee64decb9fb98a Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 12 Jan 2022 17:02:56 +0000 Subject: Fix https://github.com/GTNewHorizons/GTplusplus/issues/87. More work on Computer Cube GUI. --- .../api/gui/basic/GT_Container_CropHarvestor.java | 27 - .../gui/computer/GT_Container_ComputerCube.java | 618 +++++++++++---------- .../gui/computer/GT_GUIContainer_ComputerCube.java | 29 +- 3 files changed, 349 insertions(+), 325 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java index d56efdf0a4..9bca97de82 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java @@ -5,19 +5,14 @@ import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler; import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; -import ic2.core.item.DamageHandler; import ic2.core.item.ItemIC2; -import ic2.core.util.StackUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class GT_Container_CropHarvestor extends GT_ContainerMetaTile_Machine { @@ -77,28 +72,6 @@ public class GT_Container_CropHarvestor extends GT_ContainerMetaTile_Machine { return null; } - Slot tSlot = (Slot)inventorySlots.get(aSlotIndex); - if (tSlot != null) { - /*if (mTileEntity.getMetaTileEntity() == null) return null; - GT_MetaTileEntity_ElectricBufferSmall mte = (GT_MetaTileEntity_ElectricBufferSmall)mTileEntity.getMetaTileEntity(); - if (aSlotIndex == 1) { - mte.bOutput = !mte.bOutput; - if (aPlayer.worldObj.isRemote) - GT_Utility.sendChatToPlayer(aPlayer, new ChatComponentTranslation("metatileentity.status.energy_out." + mte.bOutput)); - return null; - } else if (aSlotIndex == 2) { - mte.bRedstoneIfFull = !mte.bRedstoneIfFull; - if (aPlayer.worldObj.isRemote) - GT_Utility.sendChatToPlayer(aPlayer, new ChatComponentTranslation("metatileentity.status.redstone_if_full." + mte.bRedstoneIfFull)); - return null; - } else if (aSlotIndex == 3) { - mte.bInvert = !mte.bInvert; - if (aPlayer.worldObj.isRemote) - GT_Utility.sendChatToPlayer(aPlayer, new ChatComponentTranslation("metatileentity.status.redstone_invert." + mte.bInvert)); - return null; - }*/ - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java index 5c5c7961d8..0ebfd65aeb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -4,8 +4,6 @@ import java.util.Iterator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.gui.GT_Slot_Output; @@ -13,7 +11,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricInventoryManager; import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -21,294 +18,337 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { - - public int mEUOut; - - public int mHeat; - - public int mMaxHeat; - - public int mHEM; - - public int mExplosionStrength; - - public int mEU; - - public int mProgress; - - public int mID; - - public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { - super(aInventoryPlayer, aTileEntity); - mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - int y; - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); - switch (this.mID) { - case 1: - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156, 86, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156, 70, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 156, 54, false, false, 1)); - for (y = 0; y < 6; y++) { - for (int x = 0; x < 9; x++) - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); - } - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 113, 153, 28, false, false, 64)); - break; - case 2: - addSlotToContainer(new Slot((IInventory)this.mTileEntity, 54, 8, 28)); - addSlotToContainer(new Slot((IInventory)this.mTileEntity, 55, 26, 28)); - addSlotToContainer(new GT_Slot_Output((IInventory)this.mTileEntity, 56, 134, 28)); - addSlotToContainer(new GT_Slot_Output((IInventory)this.mTileEntity, 57, 152, 28)); - break; - case 3: - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 122, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 92, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 62, 152, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 63, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 64, 92, 35, false, false, 64)); - break; - case 4: - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 152, 35, false, false, 64)); - break; - case 5: - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 190, 146, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 206, 146, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 206, 38, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 206, 56, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 206, 74, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 62, 206, 92, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 63, 206, 110, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 64, 153, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 65, 169, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 66, 185, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 67, 153, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 68, 169, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 69, 185, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 70, 153, 39, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 71, 169, 39, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 72, 185, 39, false, false, 64)); - break; - case 6: - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 59, 122, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 60, 92, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 61, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 62, 152, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 63, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo((IInventory)this.mTileEntity, 64, 92, 35, false, false, 64)); - break; - } - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - Logger.INFO("Clicked slot "+aSlotIndex); - if (aSlotIndex < 0) { - Logger.INFO(""); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { - Logger.INFO("This ID: "+mID+", Tile: "+((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); - return null; - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - ItemStack tStack = tSlot.getStack(); - if (tSlot == null) { - Logger.INFO("Null Slot?"); - } - else { - Logger.INFO("Good Slot!"); - if (aSlotIndex == 0) { - Logger.INFO("Slot is 0"); - if (aMouseclick == 0) { - Logger.INFO("Forward"); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); - } else { - Logger.INFO("Backwards"); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); - } - //aPlayer.openGui(CORE.MODID, GT_BlockMetaID_Machine.getComputerCubeGUIID((TileEntity)this.mTileEntity), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); - } else if (aSlotIndex <= 2 && this.mID == 3) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } - } else if (aSlotIndex <= 2 && this.mID == 6) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } - } else if (aSlotIndex <= 2 && this.mID == 4) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } - } else if (aSlotIndex <= 2 && this.mID == 5) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } - } else if (aSlotIndex <= 58 && this.mID == 1) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); - onCraftMatrixChanged((IInventory)this.mTileEntity); - } else if (aSlotIndex == 3) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); - } else { - if (aShifthold == 1) { - tSlot.putStack(null); - return null; - } - if (aMouseclick == 0) { - if (tStack == null) { - if (getSlot(58).getStack() != null && aSlotIndex != 58) { - tSlot.putStack(getSlot(58).getStack().copy()); - } else { - tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); - } - return null; - } - for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { - if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { - tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); - if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) - tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); - return null; - } - } - tSlot.putStack(null); - return null; - } - if (tStack == null) - return null; - if (tStack.stackSize < tStack.getMaxStackSize()) { - tStack.stackSize++; - return null; - } - tStack.stackSize = 1; - return null; - } - } else { - Logger.INFO("Super 2"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - } - Logger.INFO("???"); - return null; - } - - public boolean doesBindPlayerInventory() { - return (this.mID != 1 && this.mID != 5); - } - - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; + + public int mEUOut; + + public int mHeat; + + public int mMaxHeat; + + public int mHEM; + + public int mExplosionStrength; + + public int mEU; + + public int mProgress; + + public int mID; + + public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { + super(aInventoryPlayer, aTileEntity); + // addSlotsComputer(aInventoryPlayer); + detectAndSendChanges(); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotsComputer(aInventoryPlayer); + } + + private int getMode() { + return ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + } + + public void addSlotsComputer(InventoryPlayer aInventoryPlayer) { + int y; + mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + Logger.INFO("Mode: " + mID); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); + switch (this.mID) { + case 1 : + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 156, 86, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 156, 70, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 156, 54, false, false, 1)); + for (y = 0; y < 6; y++) { + for (int x = 0; x < 9; x++) + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); + } + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 113, 153, 28, false, false, 64)); + break; + case 2 : + addSlotToContainer(new Slot((IInventory) this.mTileEntity, 54, 8, 28)); + addSlotToContainer(new Slot((IInventory) this.mTileEntity, 55, 26, 28)); + addSlotToContainer(new GT_Slot_Output((IInventory) this.mTileEntity, 56, 134, 28)); + addSlotToContainer(new GT_Slot_Output((IInventory) this.mTileEntity, 57, 152, 28)); + break; + case 3 : + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + case 4 : + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 59, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 60, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 61, 152, 35, false, false, 64)); + break; + case 5 : + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 190, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 206, 146, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 59, 206, 38, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 60, 206, 56, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 61, 206, 74, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 62, 206, 92, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 63, 206, 110, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 64, 153, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 65, 169, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 66, 185, 7, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 67, 153, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 68, 169, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 69, 185, 23, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 70, 153, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 71, 169, 39, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 72, 185, 39, false, false, 64)); + break; + case 6 : + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 88, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 104, 65, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 59, 122, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 60, 92, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 61, 122, 5, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 62, 152, 35, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 63, 122, 65, false, false, 64)); + addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 64, 92, 35, false, false, 64)); + break; + } + } + + public int getComputerCubeGUIID() { + switch (getMode()) { + case 1 : + return 32; + case 2 : + return 34; + case 3 : + return 35; + case 4 : + return 36; + case 5 : + return 37; + case 6 : + return 38; + } + return 4; + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + Logger.INFO("Clicked slot " + aSlotIndex); + if (aSlotIndex < 0) { + Logger.INFO(""); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { + Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + return null; + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + ItemStack tStack = tSlot.getStack(); + if (tSlot == null) { + Logger.INFO("Null Slot?"); + } + else { + Logger.INFO("Good Slot!"); + if (aSlotIndex == 0) { + Logger.INFO("Slot is 0"); + if (aMouseclick == 0) { + Logger.INFO("Forward"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); + } + else { + Logger.INFO("Backwards"); + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); + } + aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); + } + else if (aSlotIndex <= 2 && this.mID == 3) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + } + else if (aSlotIndex <= 2 && this.mID == 6) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + } + else if (aSlotIndex <= 2 && this.mID == 4) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + } + else if (aSlotIndex <= 2 && this.mID == 5) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + } + else if (aSlotIndex <= 58 && this.mID == 1) { + if (aSlotIndex == 1) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + else if (aSlotIndex == 2) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); + onCraftMatrixChanged((IInventory) this.mTileEntity); + } + else if (aSlotIndex == 3) { + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); + } + else { + if (aShifthold == 1) { + tSlot.putStack(null); + return null; + } + if (aMouseclick == 0) { + if (tStack == null) { + if (getSlot(58).getStack() != null && aSlotIndex != 58) { + tSlot.putStack(getSlot(58).getStack().copy()); + } + else { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); + } + return null; + } + for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { + if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); + /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { + tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); + }*/ + return null; + } + } + tSlot.putStack(null); + return null; + } + if (tStack == null) + return null; + if (tStack.stackSize < tStack.getMaxStackSize()) { + tStack.stackSize++; + return null; + } + tStack.stackSize = 1; + return null; + } + } + else { + Logger.INFO("Super 2"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + } + Logger.INFO("???"); + return null; + } + + public boolean doesBindPlayerInventory() { + return (this.mID != 1 && this.mID != 5); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { + return; + } + this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; + this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; + this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; + this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; + this.mHEM = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); + this.mExplosionStrength = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); + this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; + this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = var2.next(); + var1.sendProgressBarUpdate((Container) this, 101, this.mEUOut); + var1.sendProgressBarUpdate((Container) this, 102, this.mHeat & 0xFFFF); + var1.sendProgressBarUpdate((Container) this, 103, this.mMaxHeat & 0xFFFF); + var1.sendProgressBarUpdate((Container) this, 104, this.mHEM); + var1.sendProgressBarUpdate((Container) this, 105, this.mExplosionStrength); + var1.sendProgressBarUpdate((Container) this, 106, this.mHeat >>> 16); + var1.sendProgressBarUpdate((Container) this, 107, this.mMaxHeat >>> 16); + var1.sendProgressBarUpdate((Container) this, 108, this.mEU & 0xFFFF); + var1.sendProgressBarUpdate((Container) this, 109, this.mEU >>> 16); + var1.sendProgressBarUpdate((Container) this, 110, this.mProgress); + var1.sendProgressBarUpdate((Container) this, 111, this.mID); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 101 : + this.mEUOut = par2; + break; + case 102 : + this.mHeat = this.mHeat & 0xFFFF0000 | par2; + break; + case 103 : + this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; + break; + case 104 : + this.mHEM = par2; + break; + case 105 : + this.mExplosionStrength = par2; + break; + case 106 : + this.mHeat = this.mHeat & 0xFFFF | par2 << 16; + break; + case 107 : + this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; + break; + case 108 : + this.mEU = this.mEU & 0xFFFF0000 | par2; + case 109 : + this.mEU = this.mEU & 0xFFFF | par2 << 16; + break; + case 110 : + this.mProgress = par2; + break; + case 111 : + this.mID = par2; + break; + } + } + + public int getSlotStartIndex() { + return 1; + } + + public int getSlotCount() { + return (this.mID == 2) ? 4 : 0; + } + + public int getShiftClickSlotCount() { + return (this.mID == 2) ? 2 : 0; } - //this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; - this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; - this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; - this.mHEM = (int)(((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); - this.mExplosionStrength = (int)(((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); - this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; - this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = var2.next(); - var1.sendProgressBarUpdate((Container)this, 101, this.mEUOut); - var1.sendProgressBarUpdate((Container)this, 102, this.mHeat & 0xFFFF); - var1.sendProgressBarUpdate((Container)this, 103, this.mMaxHeat & 0xFFFF); - var1.sendProgressBarUpdate((Container)this, 104, this.mHEM); - var1.sendProgressBarUpdate((Container)this, 105, this.mExplosionStrength); - var1.sendProgressBarUpdate((Container)this, 106, this.mHeat >>> 16); - var1.sendProgressBarUpdate((Container)this, 107, this.mMaxHeat >>> 16); - var1.sendProgressBarUpdate((Container)this, 108, this.mEU & 0xFFFF); - var1.sendProgressBarUpdate((Container)this, 109, this.mEU >>> 16); - var1.sendProgressBarUpdate((Container)this, 110, this.mProgress); - //var1.sendProgressBarUpdate((Container)this, 111, this.mEUOut); - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 101: - this.mEUOut = par2; - break; - case 102: - this.mHeat = this.mHeat & 0xFFFF0000 | par2; - break; - case 103: - this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; - break; - case 104: - this.mHEM = par2; - break; - case 105: - this.mExplosionStrength = par2; - break; - case 106: - this.mHeat = this.mHeat & 0xFFFF | par2 << 16; - break; - case 107: - this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; - break; - case 108: - this.mEU = this.mEU & 0xFFFF0000 | par2; - case 109: - this.mEU = this.mEU & 0xFFFF | par2 << 16; - break; - case 110: - this.mProgress = par2; - break; - case 111: - //this.mID = par2; - break; - } - } - - public int getSlotStartIndex() { - return 1; - } - - public int getSlotCount() { - return (this.mID == 2) ? 4 : 0; - } - - public int getShiftClickSlotCount() { - return (this.mID == 2) ? 2 : 0; - } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java index 0006ce8823..d226503b9c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -15,6 +15,21 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin if (aID == 5) this.xSize += 50; } + + + public static ResourceLocation[] mGUIbackground = new ResourceLocation[8]; + + static { + mGUIbackground[0] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/0.png"); + mGUIbackground[1] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/1.png"); + mGUIbackground[2] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/2.png"); + mGUIbackground[3] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/3.png"); + mGUIbackground[4] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/4.png"); + mGUIbackground[5] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/5.png"); + mGUIbackground[6] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/6.png"); + mGUIbackground[7] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/Redstone.png"); + + } protected void drawGuiContainerForegroundLayer(int par1, int par2) { GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; @@ -83,23 +98,19 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin } protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - if (mContainer != null) { GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; - mGUIbackground = new ResourceLocation(mGUIbackgroundPath = CORE.RES_PATH_GUI + "computer/"+ ((GT_Container_ComputerCube) this.mContainer).mID + ".png"); - + mc.renderEngine.bindTexture(mGUIbackground[((GT_Container_ComputerCube) this.mContainer).mID]); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); switch (tContainer.mID) { case 5 : if (tContainer.mExplosionStrength != 0) drawTexturedModalRect(x + 152, y + 6, 0, 166, 50, 50); break; } - } - + } } public String toNumber(int aNumber) { -- cgit From c3e70a79b79294f6de6e6e553acd5f700f8898bb Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 19 Jan 2022 14:31:09 +0000 Subject: Added textures for Redstone Circuit Block. Fixed GUI tooltips breaking block lighting. Fixed creative energy buffer not keeping it's tier on world load. --- .../GT_GUIContainer_ElectricAutoWorkbench.java | 5 +- .../gui/basic/GT_GUIContainer_CropHarvestor.java | 5 +- .../api/gui/basic/GUI_PollutionCleaner.java | 2 + .../GT_GUIContainer_RedstoneCircuitBlock.java | 33 +++++ .../api/gui/fluidreactor/GUI_FluidReactor.java | 3 + .../GT_GUIContainer_AdvancedWorkbench.java | 2 + .../creative/GregtechMetaCreativeEnergyBuffer.java | 120 ++++++++--------- .../GT_MetaTileEntity_RedstoneCircuitBlock.java | 143 +++++++++++++++------ .../storage/GregtechMetaEnergyBuffer.java | 12 +- 9 files changed, 214 insertions(+), 111 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java index 7d381c0e8a..90f8380d14 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java @@ -7,6 +7,7 @@ import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_Container_CropHarvestor; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_ElectricAutoWorkbench extends GT_GUIContainerMetaTile_Machine { @@ -53,7 +54,9 @@ public class GT_GUIContainer_ElectricAutoWorkbench extends GT_GUIContainerMetaTi }*/ } } - if (!list.isEmpty()) + if (!list.isEmpty()) { drawHoveringText(list, x3, y3, fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java index ff2894f94a..504ae61b4a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java @@ -7,6 +7,7 @@ import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.common.gui.GT_Container_Boiler; import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_CropHarvestor extends GT_GUIContainerMetaTile_Machine { @@ -65,8 +66,10 @@ public class GT_GUIContainer_CropHarvestor extends GT_GUIContainerMetaTile_Machi list.add("Water: "+aWater+"L / "+((GT_Container_CropHarvestor) mContainer).mTileEntity.getMetaTileEntity().getCapacity()+"L"); } } - if (!list.isEmpty()) + if (!list.isEmpty()) { drawHoveringText(list, x, y, fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java index 3b96731f00..96e8e362ef 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java @@ -6,6 +6,7 @@ import java.util.List; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { @@ -52,6 +53,7 @@ public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { } if (!list.isEmpty()) { this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java index 89636fbaf2..53d60c3a68 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java @@ -1,11 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.gui.computer; +import java.util.ArrayList; +import java.util.List; + import gregtech.api.GregTech_API; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_CircuitryBehavior; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_RedstoneCircuitBlock extends GT_GUIContainerMetaTile_Machine { @@ -36,6 +40,7 @@ public class GT_GUIContainer_RedstoneCircuitBlock extends GT_GUIContainerMetaTil tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3); this.fontRendererObj.drawString(tString == null ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[3]) : tString, 99, 66, 16448255); } + this.drawTooltip(par1, par2); } @Override @@ -59,4 +64,32 @@ public class GT_GUIContainer_RedstoneCircuitBlock extends GT_GUIContainerMetaTil drawTexturedModalRect(x + 140, y + 9, 201, 0, 7, 7); } } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + final List list = new ArrayList(); + + int y = 10; + if (x3 >= 151 && x3 <= 168) { + if (y3 >= y && y3 <= (y + 17)) { + list.add("Toggle EU Output"); + } + if (y3 >= (y + 18) && y3 <= (y + 35)) { + list.add("Toggle Active State"); + } + if (y3 >= (y + 36) && y3 <= (y + 53)) { + list.add("Change Redstone Circuit"); + } + } + + if (!list.isEmpty()) { + //RenderHelper.enableGUIStandardItemLighting(); + this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); + } + //RenderHelper.enableStandardItemLighting(); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java index 1be79b40cc..4d35df251c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java @@ -7,6 +7,8 @@ import gtPlusPlus.core.lib.CORE; import java.util.ArrayList; import java.util.List; + +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { @@ -54,6 +56,7 @@ public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { if (!list.isEmpty()) { this.drawHoveringText(list, x, y, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java index fc3041f553..094a7a7eb9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java @@ -8,6 +8,7 @@ import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_AdvancedWorkbench extends GT_GUIContainerMetaTile_Machine { @@ -71,6 +72,7 @@ public class GT_GUIContainer_AdvancedWorkbench extends GT_GUIContainerMetaTile_M } if (!list.isEmpty()) { this.drawHoveringText(list, x3, y3, this.fontRendererObj); + RenderHelper.enableGUIStandardItemLighting(); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java index a62a5d16c8..2e4e1ce7dd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java @@ -5,18 +5,12 @@ import static gregtech.api.enums.GT_Values.V; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; @@ -26,34 +20,35 @@ import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! * - * This is the main construct for my Basic Machines such as the Automatic Extractor - * Extend this class to make a simple Machine + * This is the main construct for my Basic Machines such as the Automatic + * Extractor Extend this class to make a simple Machine */ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { - - public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier, - final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) { + private int mVoltageTier = 3; + + public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) { super(aName, aTier, aDescription, aTextures, aSlotCount); // TODO Auto-generated constructor stub } - public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName, - final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { + public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount); } @Override public String[] getDescription() { - return new String[] {this.mDescription, - "Use Screwdriver to change voltage", - "Hold Shift while using Screwdriver to change amperage", - EnumChatFormatting.GREEN+"CREATIVE MACHINE", - CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.GREEN + + "CREATIVE MACHINE", CORE.GT_Tooltip}; } /* @@ -66,27 +61,23 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { CustomIcon k; boolean j = MathUtils.isNumberEven(this.mTier); final ITexture[][][] rTextures = new ITexture[2][17][]; - k = j ? g : h; + k = j ? g : h; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(k) }; - rTextures[1][i + 1] = new ITexture[] { - new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] - : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; + rTextures[0][i + 1] = new ITexture[]{new GT_RenderedTexture(k)}; + rTextures[1][i + + 1] = new ITexture[]{new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } return rTextures; } @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription, - this.mTextures, this.mInventory.length); + return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length); } @Override @@ -101,43 +92,49 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public long maxEUInput() { - return V[this.mTier]; + return V[mVoltageTier]; } @Override public long maxEUOutput() { - return V[this.mTier]; + return V[mVoltageTier]; } @Override public long maxAmperesIn() { - return 16; + return aCurrentOutputAmperage; } @Override public long maxAmperesOut() { - return 16; + return aCurrentOutputAmperage; } - @Override public int getProgresstime() {return Integer.MAX_VALUE;} - @Override public int maxProgresstime() {return Integer.MAX_VALUE;} - @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} + @Override + public int getProgresstime() { + return Integer.MAX_VALUE; + } + @Override + public int maxProgresstime() { + return Integer.MAX_VALUE; + } + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } @Override - public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return null; } @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return null; } @Override public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true); if (aBaseMetaTileEntity.isServerSide()) { aBaseMetaTileEntity.increaseStoredEnergyUnits(Integer.MAX_VALUE, true); } @@ -156,12 +153,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public String[] getInfoData() { String[] infoData = super.getInfoData(); - return new String[] { - infoData[0], - "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: "+this.mTier, - infoData[1], - infoData[2] - }; + return new String[]{infoData[0], "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: " + this.mTier, infoData[1], infoData[2]}; } @Override @@ -171,59 +163,59 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setByte("mTier", this.mTier); + aNBT.setInteger("mVoltageTier", this.mVoltageTier); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { + this.mVoltageTier = aNBT.getInteger("mVoltageTier"); super.loadNBTData(aNBT); - this.mTier = aNBT.getByte("mTier"); } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (KeyboardUtils.isShiftKeyDown()) { - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } else { - if (this.mTier < (CORE.GTNH ? GT_Values.V.length-1 : 9)) { - this.mTier++; + if (this.mVoltageTier < (GT_Values.VN[9].equals("UHV") ? GT_Values.V.length - 1 : 9)) { + this.mVoltageTier++; } else { - this.mTier = 0; + this.mVoltageTier = 0; } this.markDirty(); try { - Field field = ReflectionUtils.getField(this.getClass(), "mTextures"); + Field field = ReflectionUtils.getField(this.getClass(), "mTextures"); field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); ITexture[][][] V = getTextureSet(null); if (V != null) { - Logger.REFLECTION("Got Valid Textures."); + Logger.REFLECTION("Got Valid Textures."); if (this.getBaseMetaTileEntity().isClientSide()) { - Logger.REFLECTION("Clientside Call."); + Logger.REFLECTION("Clientside Call."); Logger.REFLECTION("Refreshing Textures on buffer."); field.set(this, V); Logger.REFLECTION("Refreshed Textures on buffer."); } else { - Logger.REFLECTION("Serverside Call."); + Logger.REFLECTION("Serverside Call."); } } else { - Logger.REFLECTION("Bad mTextures setter."); - } + Logger.REFLECTION("Bad mTextures setter."); + } } catch (Throwable t) { - //Bad refresh. + // Bad refresh. t.printStackTrace(); Logger.REFLECTION("Bad mTextures setter."); } - PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+"."); - } - + PlayerUtils.messagePlayer(aPlayer, "Now running at " + GT_Values.VOLTAGE_NAMES[this.mTier] + "."); + } + } -} \ No newline at end of file +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java index e3779d1e9b..180091b2eb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java @@ -3,15 +3,18 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.redstone; import java.util.*; import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.IRedstoneCircuitBlock; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.*; import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_RedstoneCircuitBlock; import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_RedstoneCircuitBlock; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -25,18 +28,18 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re public boolean bOutput = true; public GT_MetaTileEntity_RedstoneCircuitBlock(int aID) { - super(aID, "redstone.circuit", "Redstone Circuit Block", 0, 0, "Computes Redstone"); + super(aID, "redstone.circuit", "Redstone Circuit Block", 1, 5, "Computes Redstone"); } public GT_MetaTileEntity_RedstoneCircuitBlock(final String aName, String aDescription, final ITexture[][][] aTextures) { - super(aName, 0, 0, aDescription, aTextures); + super(aName, 1, 5, aDescription, aTextures); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_RedstoneCircuitBlock(this.mName, mDescription, this.mTextures); } - + @Override public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_RedstoneCircuitBlock(aPlayerInventory, aBaseMetaTileEntity); @@ -51,50 +54,75 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re public boolean hasSidedRedstoneOutputBehavior() { return true; } - + @Override public boolean isEnetInput() { return true; } - + @Override public boolean isEnetOutput() { return true; } - + @Override public boolean isInputFacing(byte aSide) { - return !isOutputFacing(aSide); + return true; + } + + @Override + public boolean isElectric() { + return true; + } + + @Override + public boolean isPneumatic() { + return false; + } + + @Override + public boolean isSteampowered() { + return false; } - + @Override public boolean isOutputFacing(byte aSide) { - return getBaseMetaTileEntity().getBackFacing() == aSide; + return true; } - + @Override public long getMinimumStoredEU() { - return 500; + return 512; } - + @Override public long maxEUInput() { - return 32; + return GT_Values.V[1]; } - + @Override public long maxEUOutput() { - return bOutput ? 32 : 0; + return bOutput ? GT_Values.V[1] : 0; } - + + @Override + public long maxAmperesIn() { + return 2; + } + + @Override + public long maxAmperesOut() { + return 1; + } + @Override public int getSizeInventory() { return 5; } - + @Override public long maxEUStore() { - return 1000; + return GT_Values.V[3] * 1024; } @Override @@ -106,7 +134,6 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re return true; } - @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setInteger("mGate", mGate); @@ -202,9 +229,9 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re try { tBehaviour.initParameters(mGateData, this); } - catch (Throwable e) { - GT_Log.err.print(e); - } + catch (Throwable e) { + GT_Log.err.print(e); + } validateGateData(); } @@ -214,9 +241,9 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re try { tBehaviour.validateParameters(mGateData, this); } - catch (Throwable e) { - GT_Log.err.print(e); - } + catch (Throwable e) { + GT_Log.err.print(e); + } } @Override @@ -232,7 +259,7 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re getBaseMetaTileEntity().setGenericRedstoneOutput(true); if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide()) { mInventory[0] = mInventory[1] = mInventory[2] = mInventory[3] = mInventory[4] = null; - if (getBaseMetaTileEntity().getUniversalEnergyStored() > 400) { + if (getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU()) { if (getBaseMetaTileEntity().isActive()) { GT_CircuitryBehavior tBehaviour = GregTech_API.sCircuitryBehaviors.get(mGate); if (tBehaviour != null) { @@ -257,29 +284,28 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re else { getBaseMetaTileEntity().setErrorDisplayID(1); } - } + } } - /** The Item List for Covers */ public static final Map sCoversItems = new HashMap(); - + private static void initCovers() { for (GT_ItemStack aKey : GregTech_API.sCovers.keySet()) { ItemStack aStack = aKey.toStack().copy(); if (aStack != null) { - sCoversItems.put(GT_Utility.stackToInt(aStack), aStack); + sCoversItems.put(GT_Utility.stackToInt(aStack), aStack); } } } - + public static ItemStack getCoverByID(int aStack) { if (sCoversItems.isEmpty()) { initCovers(); } return sCoversItems.get(Integer.valueOf(aStack)); } - + @Override public byte getOutputFacing() { return getBaseMetaTileEntity().getBackFacing(); @@ -378,14 +404,55 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - // TODO Auto-generated method stub - return null; + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getSides(i); + rTextures[1][i + 1] = this.getSides(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getSidesActive(i); + rTextures[6][i + 1] = this.getSidesActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + return rTextures; } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - // TODO Auto-generated method stub - return null; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + + 1]; } + + private GT_RenderedTexture getBase() { + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); + } + + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_Off)}; + } + + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_On)}; + } + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_Off)}; + } + + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_On)}; + } + + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Off)}; + } + + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_On)}; + } + } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index 320e2175b0..5c7cfed334 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -2,12 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; import static gregtech.api.enums.GT_Values.V; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_1by1; import gregtech.api.gui.GT_GUIContainer_1by1; @@ -17,12 +11,16 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { -- cgit