aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java11
-rw-r--r--src/main/java/gregtech/api/enums/Textures.java2
-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
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java67
5 files changed, 214 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index bf74ae6b1d..06502b3491 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -926,6 +926,17 @@ public enum ItemList implements IItemContainer {
Automation_ItemDistributor_UV,
Automation_ItemDistributor_MAX,
+ Automation_RecipeFilter_ULV,
+ Automation_RecipeFilter_LV,
+ Automation_RecipeFilter_MV,
+ Automation_RecipeFilter_HV,
+ Automation_RecipeFilter_EV,
+ Automation_RecipeFilter_IV,
+ Automation_RecipeFilter_LuV,
+ Automation_RecipeFilter_ZPM,
+ Automation_RecipeFilter_UV,
+ Automation_RecipeFilter_MAX,
+
Hatch_Dynamo_ULV,
Hatch_Dynamo_LV,
Hatch_Dynamo_MV,
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java
index fc47ee459a..1d0234a8cf 100644
--- a/src/main/java/gregtech/api/enums/Textures.java
+++ b/src/main/java/gregtech/api/enums/Textures.java
@@ -138,6 +138,8 @@ public class Textures {
AUTOMATION_FILTER_GLOW,
AUTOMATION_TYPEFILTER,
AUTOMATION_TYPEFILTER_GLOW,
+ AUTOMATION_RECIPEFILTER,
+ AUTOMATION_RECIPEFILTER_GLOW,
AUTOMATION_CHESTBUFFER,
AUTOMATION_CHESTBUFFER_GLOW,
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);
+ }
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java
new file mode 100644
index 0000000000..f5d43faffc
--- /dev/null
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java
@@ -0,0 +1,67 @@
+package gregtech.api.metatileentity.implementations;
+
+import gregtech.api.gui.GT_Container_SpecialFilter;
+import gregtech.api.gui.GT_GUIContainer_SpecialFilter;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public abstract class GT_MetaTileEntity_SpecialFilter extends GT_MetaTileEntity_Buffer {
+ public static final int BUFFER_SLOT_COUNT = 9;
+ public static final int SPECIAL_SLOT_INDEX = 9;
+ public boolean bNBTAllowed = false;
+ public boolean bInvertFilter = false;
+
+ public GT_MetaTileEntity_SpecialFilter(int aID, String aName, String aNameRegional, int aTier, String[] aDescription) {
+ // 9 buffer slot, 1 representation slot, 1 holo slot. last seems not needed...
+ super(aID, aName, aNameRegional, aTier, 11, aDescription);
+ }
+
+ public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_SpecialFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 9;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_SpecialFilter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_SpecialFilter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public abstract void clickTypeIcon(boolean aRightClick, ItemStack aHandStack);
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("bInvertFilter", this.bInvertFilter);
+ aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.bInvertFilter = aNBT.getBoolean("bInvertFilter");
+ this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed");
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (this.isStackAllowed(aStack) != this.bInvertFilter);
+ }
+
+ protected abstract boolean isStackAllowed(ItemStack aStack);
+}