aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-01-15 01:39:57 +0800
committerGitHub <noreply@github.com>2022-01-14 18:39:57 +0100
commit77f926b06d21cdcf484e7e2e84db9becd1b549ab (patch)
tree4090d8c804a87be4b1e8c1339d3e7c2c25b2059c /src/main/java/gregtech/api/gui
parent119de99ec6386aa413480e5dd6a3e815c9fe06f8 (diff)
downloadGT5-Unofficial-77f926b06d21cdcf484e7e2e84db9becd1b549ab.tar.gz
GT5-Unofficial-77f926b06d21cdcf484e7e2e84db9becd1b549ab.tar.bz2
GT5-Unofficial-77f926b06d21cdcf484e7e2e84db9becd1b549ab.zip
Add recipe filter block (#870)
* add recipe filter block * Add tooltip to recipe filter GUI & improve type filter UI interaction now you can click special slot in type filter UI to directly set the oreprefix based on the stack held on the cursor
Diffstat (limited to 'src/main/java/gregtech/api/gui')
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java116
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java18
2 files changed, 134 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java b/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java
new file mode 100644
index 0000000000..31d257c887
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java
@@ -0,0 +1,116 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SpecialFilter;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class GT_Container_SpecialFilter extends GT_ContainerMetaTile_Machine {
+
+ private GT_Slot_Render mSpecialSlot;
+
+ public GT_Container_SpecialFilter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new Slot(this.mTileEntity, 0, 98, 5));
+ addSlotToContainer(new Slot(this.mTileEntity, 1, 116, 5));
+ addSlotToContainer(new Slot(this.mTileEntity, 2, 134, 5));
+ addSlotToContainer(new Slot(this.mTileEntity, 3, 98, 23));
+ addSlotToContainer(new Slot(this.mTileEntity, 4, 116, 23));
+ addSlotToContainer(new Slot(this.mTileEntity, 5, 134, 23));
+ addSlotToContainer(new Slot(this.mTileEntity, 6, 98, 41));
+ addSlotToContainer(new Slot(this.mTileEntity, 7, 116, 41));
+ addSlotToContainer(new Slot(this.mTileEntity, 8, 134, 41));
+
+ addSlotToContainer(mSpecialSlot = new GT_Slot_Render(this.mTileEntity, 9, 35, 23));
+
+ addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 8, 63, false, true, 1));
+ addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 26, 63, false, true, 1));
+ addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 44, 63, false, true, 1));
+ addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 62, 63, false, true, 1));
+ addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 80, 63, false, true, 1));
+ }
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (aSlotIndex < 9) {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex);
+ if (tSlot != null) {
+ if (this.mTileEntity.getMetaTileEntity() == null) {
+ return null;
+ }
+ if (aSlotIndex == 9) {
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).clickTypeIcon(aMouseclick != 0, aPlayer.inventory.getItemStack());
+ return null;
+ }
+ if (aSlotIndex == 10) {
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput);
+ if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bOutput) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("116","Emit Energy to Outputside"));
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("117","Don't emit Energy"));
+ }
+ return null;
+ }
+ if (aSlotIndex == 11) {
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull);
+ if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("122","Emit Redstone if slots contain something"));
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("123","Don't emit Redstone"));
+ }
+ return null;
+ }
+ if (aSlotIndex == 12) {
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert);
+ if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvert) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("120","Invert Redstone"));
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("121","Don't invert Redstone"));
+ }
+ return null;
+ }
+ if (aSlotIndex == 13) {
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter);
+ if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("124","Invert Filter"));
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("125","Don't invert Filter"));
+ }
+ return null;
+ }
+ if (aSlotIndex == 14) {
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed = (!((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed);
+ if (((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("126","Ignore NBT"));
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("127","NBT has to match"));
+ }
+ return null;
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public int getSlotCount() {
+ return 9;
+ }
+
+ @Override
+ public int getShiftClickSlotCount() {
+ return 9;
+ }
+
+ public GT_Slot_Render getSpecialSlot() {
+ return mSpecialSlot;
+ }
+}
diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java
new file mode 100644
index 0000000000..84f6ae68ea
--- /dev/null
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java
@@ -0,0 +1,18 @@
+package gregtech.api.gui;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GT_GUIContainer_SpecialFilter extends GT_GUIContainerMetaTile_Machine {
+ public GT_GUIContainer_SpecialFilter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(new GT_Container_SpecialFilter(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/SpecialFilter.png");
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (this.width - this.xSize) / 2;
+ int y = (this.height - this.ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+}