aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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.java (renamed from src/main/java/gregtech/common/gui/GT_Container_TypeFilter.java)42
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java (renamed from src/main/java/gregtech/common/gui/GT_GUIContainer_TypeFilter.java)9
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SpecialFilter.java67
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java10
-rw-r--r--src/main/java/gregtech/common/gui/GT_GUIContainer_RecipeFilter.java21
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java89
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java52
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java21
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang2
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER.pngbin0 -> 1614 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER_GLOW.pngbin0 -> 143 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/SpecialFilter.png (renamed from src/main/resources/assets/gregtech/textures/gui/TypeFilter.png)bin2669 -> 2669 bytes
14 files changed, 267 insertions, 59 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/common/gui/GT_Container_TypeFilter.java b/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java
index 762a9868bf..31d257c887 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_TypeFilter.java
+++ b/src/main/java/gregtech/api/gui/GT_Container_SpecialFilter.java
@@ -1,18 +1,18 @@
-package gregtech.common.gui;
+package gregtech.api.gui;
-import gregtech.api.gui.GT_ContainerMetaTile_Machine;
-import gregtech.api.gui.GT_Slot_Holo;
-import gregtech.api.gui.GT_Slot_Render;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SpecialFilter;
import gregtech.api.util.GT_Utility;
-import gregtech.common.tileentities.automation.GT_MetaTileEntity_TypeFilter;
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_TypeFilter extends GT_ContainerMetaTile_Machine {
- public GT_Container_TypeFilter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+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);
}
@@ -28,7 +28,7 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
addSlotToContainer(new Slot(this.mTileEntity, 7, 116, 41));
addSlotToContainer(new Slot(this.mTileEntity, 8, 134, 41));
- addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 9, 35, 23));
+ 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));
@@ -48,12 +48,12 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
return null;
}
if (aSlotIndex == 9) {
- ((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).clickTypeIcon(aMouseclick != 0);
+ ((GT_MetaTileEntity_SpecialFilter) this.mTileEntity.getMetaTileEntity()).clickTypeIcon(aMouseclick != 0, aPlayer.inventory.getItemStack());
return null;
}
if (aSlotIndex == 10) {
- ((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bOutput);
- if (((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bOutput) {
+ ((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"));
@@ -61,8 +61,8 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
return null;
}
if (aSlotIndex == 11) {
- ((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull);
- if (((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) {
+ ((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"));
@@ -70,8 +70,8 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
return null;
}
if (aSlotIndex == 12) {
- ((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bInvert = (!((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bInvert);
- if (((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bInvert) {
+ ((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"));
@@ -79,8 +79,8 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
return null;
}
if (aSlotIndex == 13) {
- ((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter = (!((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter);
- if (((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bInvertFilter) {
+ ((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"));
@@ -88,8 +88,8 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
return null;
}
if (aSlotIndex == 14) {
- ((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed = (!((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed);
- if (((GT_MetaTileEntity_TypeFilter) this.mTileEntity.getMetaTileEntity()).bNBTAllowed) {
+ ((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"));
@@ -109,4 +109,8 @@ public class GT_Container_TypeFilter extends GT_ContainerMetaTile_Machine {
public int getShiftClickSlotCount() {
return 9;
}
+
+ public GT_Slot_Render getSpecialSlot() {
+ return mSpecialSlot;
+ }
}
diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_TypeFilter.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java
index d312c0b76a..84f6ae68ea 100644
--- a/src/main/java/gregtech/common/gui/GT_GUIContainer_TypeFilter.java
+++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_SpecialFilter.java
@@ -1,12 +1,11 @@
-package gregtech.common.gui;
+package gregtech.api.gui;
-import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
-public class GT_GUIContainer_TypeFilter extends GT_GUIContainerMetaTile_Machine {
- public GT_GUIContainer_TypeFilter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
- super(new GT_Container_TypeFilter(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/TypeFilter.png");
+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
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);
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index 946325f5f4..bcc6d7e14c 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -43,6 +43,16 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem {
setCreativeTab(GregTech_API.TAB_GREGTECH);
}
+ public static IMetaTileEntity getMetaTileEntity(ItemStack aStack) {
+ if (GT_Utility.isStackInvalid(aStack))
+ return null;
+ if (!(aStack.getItem() instanceof GT_Item_Machines))
+ return null;
+ if (aStack.getItemDamage() < 0 || aStack.getItemDamage() > GregTech_API.METATILEENTITIES.length)
+ return null;
+ return GregTech_API.METATILEENTITIES[aStack.getItemDamage()];
+ }
+
@Override
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) {
try {
diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_RecipeFilter.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_RecipeFilter.java
new file mode 100644
index 0000000000..07f81ccf80
--- /dev/null
+++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_RecipeFilter.java
@@ -0,0 +1,21 @@
+package gregtech.common.gui;
+
+import gregtech.api.gui.GT_Container_SpecialFilter;
+import gregtech.api.gui.GT_GUIContainer_SpecialFilter;
+import gregtech.api.gui.widgets.GT_GuiSlotTooltip;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GT_GUIContainer_RecipeFilter extends GT_GUIContainer_SpecialFilter {
+
+ private static final String REPRESENTATION_SLOT_TOOLTIP = "GT5U.recipe_filter.representation_slot.tooltip";
+
+ public GT_GUIContainer_RecipeFilter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ protected void setupTooltips() {
+ addToolTip(new GT_GuiSlotTooltip(((GT_Container_SpecialFilter) mContainer).getSpecialSlot(), mTooltipCache.getData(REPRESENTATION_SLOT_TOOLTIP)));
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java
new file mode 100644
index 0000000000..a2f86103f5
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java
@@ -0,0 +1,89 @@
+package gregtech.common.tileentities.automation;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SpecialFilter;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GT_Recipe;
+import gregtech.common.blocks.GT_Item_Machines;
+import gregtech.common.gui.GT_GUIContainer_RecipeFilter;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_RECIPEFILTER;
+import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_RECIPEFILTER_GLOW;
+
+public class GT_MetaTileEntity_RecipeFilter extends GT_MetaTileEntity_SpecialFilter {
+ public GT_Recipe.GT_Recipe_Map mRecipeMap;
+
+ public GT_MetaTileEntity_RecipeFilter(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, new String[]{
+ "Filters 1 Recipe Type",
+ "Use Screwdriver to regulate output stack size",
+ "Does not consume energy to move Item"});
+ }
+
+ public GT_MetaTileEntity_RecipeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_RecipeFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_RecipeFilter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public void clickTypeIcon(boolean aRightClick, ItemStack aHandStack) {
+ if (!aRightClick) {
+ IMetaTileEntity mte = GT_Item_Machines.getMetaTileEntity(aHandStack);
+ if (mte instanceof GT_MetaTileEntity_BasicMachine) {
+ GT_MetaTileEntity_BasicMachine machine = (GT_MetaTileEntity_BasicMachine) mte;
+ GT_Recipe.GT_Recipe_Map recipeList = machine.getRecipeList();
+ if (recipeList != null) {
+ mInventory[SPECIAL_SLOT_INDEX] = machine.getStackForm(1);
+ mRecipeMap = recipeList;
+ return;
+ }
+ }
+ }
+ mInventory[SPECIAL_SLOT_INDEX] = null;
+ mRecipeMap = null;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RecipeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures);
+ }
+
+ @Override
+ public ITexture getOverlayIcon() {
+ return TextureFactory.of(
+ TextureFactory.of(AUTOMATION_RECIPEFILTER),
+ TextureFactory.builder().addIcon(AUTOMATION_RECIPEFILTER_GLOW).glow().build());
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ if (mRecipeMap != null)
+ aNBT.setString("mRecipeMap", this.mRecipeMap.mUniqueIdentifier);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mRecipeMap = GT_Recipe.GT_Recipe_Map.sIndexedMappings.getOrDefault(aNBT.getString("mRecipeMap"), null);
+ }
+
+ @Override
+ protected boolean isStackAllowed(ItemStack aStack) {
+ return mRecipeMap != null && mRecipeMap.containsInput(aStack);
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java
index 61f0b5cb29..95b11bcb54 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java
@@ -4,14 +4,11 @@ import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SpecialFilter;
import gregtech.api.objects.ItemData;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
-import gregtech.common.gui.GT_Container_TypeFilter;
-import gregtech.common.gui.GT_GUIContainer_TypeFilter;
-import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -19,14 +16,12 @@ import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER;
import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER_GLOW;
-public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer {
- public boolean bNBTAllowed = false;
- public boolean bInvertFilter = false;
+public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_SpecialFilter {
public int mRotationIndex = 0;
public OrePrefixes mPrefix = OrePrefixes.ore;
public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 11, new String[]{
+ super(aID, aName, aNameRegional, aTier, new String[]{
"Filters 1 Item Type",
"Use Screwdriver to regulate output stack size",
"Does not consume energy to move Item"});
@@ -52,23 +47,14 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer {
TextureFactory.builder().addIcon(AUTOMATION_TYPEFILTER_GLOW).glow().build());
}
- @Override
- public boolean isValidSlot(int aIndex) {
- return aIndex < 9;
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_TypeFilter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_TypeFilter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public void clickTypeIcon(boolean aRightClick) {
+ public void clickTypeIcon(boolean aRightClick, ItemStack aHandStack) {
if (getBaseMetaTileEntity().isServerSide()) {
+ ItemData data = GT_OreDictUnificator.getAssociation(aHandStack);
+ if (data != null && data.hasValidPrefixData()) {
+ this.mPrefix = data.mPrefix;
+ this.mRotationIndex = -1;
+ return;
+ }
for (int i = 0; i < OrePrefixes.values().length; i++) {
if (this.mPrefix == OrePrefixes.values()[i]) {
for (this.mPrefix = null; this.mPrefix == null; this.mPrefix = OrePrefixes.values()[i]) {
@@ -101,33 +87,29 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer {
super.onPreTick(aBaseMetaTileEntity, aTick);
if ((!getBaseMetaTileEntity().isServerSide()) || ((aTick % 8L != 0L) && mRotationIndex != -1)) return;
if (this.mPrefix.mPrefixedItems.isEmpty()) {
- this.mInventory[9] = null;
+ this.mInventory[SPECIAL_SLOT_INDEX] = null;
return;
}
- this.mInventory[9] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()));
- if (this.mInventory[9] == null) return;
- if (this.mInventory[9].getItemDamage() == W) this.mInventory[9].setItemDamage(0);
- this.mInventory[9].setStackDisplayName(this.mPrefix.toString());
+ this.mInventory[SPECIAL_SLOT_INDEX] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()));
+ if (this.mInventory[SPECIAL_SLOT_INDEX] == null) return;
+ if (this.mInventory[SPECIAL_SLOT_INDEX].getItemDamage() == W) this.mInventory[9].setItemDamage(0);
+ this.mInventory[SPECIAL_SLOT_INDEX].setStackDisplayName(this.mPrefix.toString());
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setString("mPrefix", this.mPrefix.toString());
- aNBT.setBoolean("bInvertFilter", this.bInvertFilter);
- aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
this.mPrefix = OrePrefixes.getPrefix(aNBT.getString("mPrefix"), this.mPrefix);
- this.bInvertFilter = aNBT.getBoolean("bInvertFilter");
- this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed");
}
@Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ protected boolean isStackAllowed(ItemStack aStack) {
boolean tAllowPrefix = this.mPrefix.contains(aStack);
if (this.mPrefix == OrePrefixes.ore) {
ItemData tData = GT_OreDictUnificator.getItemData(aStack);
@@ -148,6 +130,6 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer {
tFix == OrePrefixes.oreMarble) tAllowPrefix = true;
}
}
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (tAllowPrefix != this.bInvertFilter);
+ return tAllowPrefix;
}
}
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
index c912bf49db..a1ddd35e45 100644
--- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
+++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
@@ -1350,6 +1350,27 @@ public class GT_Loader_MetaTileEntities implements Runnable {//TODO CHECK CIRCUI
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_UV.get(1L), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_UV, 'V', ItemList.Conveyor_Module_UV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Basic)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_MAX.get(1L), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_MAX, 'V', ItemList.Conveyor_Module_UHV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ ItemList.Automation_RecipeFilter_ULV.set(new GT_MetaTileEntity_RecipeFilter(9330, "automation.recipefilter.tier.00", "Ultra Low Voltage Recipe Filter", 0).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_LV.set(new GT_MetaTileEntity_RecipeFilter(9331, "automation.recipefilter.tier.01", "Low Voltage Recipe Filter", 1).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_MV.set(new GT_MetaTileEntity_RecipeFilter(9332, "automation.recipefilter.tier.02", "Medium Voltage Recipe Filter", 2).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_HV.set(new GT_MetaTileEntity_RecipeFilter(9333, "automation.recipefilter.tier.03", "High Voltage Recipe Filter", 3).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_EV.set(new GT_MetaTileEntity_RecipeFilter(9334, "automation.recipefilter.tier.04", "Extreme Voltage Recipe Filter", 4).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_IV.set(new GT_MetaTileEntity_RecipeFilter(9335, "automation.recipefilter.tier.05", "Insane Voltage Recipe Filter", 5).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_LuV.set(new GT_MetaTileEntity_RecipeFilter(9336, "automation.recipefilter.tier.06", "Ludicrous Voltage Recipe Filter", 6).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_ZPM.set(new GT_MetaTileEntity_RecipeFilter(9337, "automation.recipefilter.tier.07", "ZPM Voltage Recipe Filter", 7).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_UV.set(new GT_MetaTileEntity_RecipeFilter(9338, "automation.recipefilter.tier.08", "Ultimate Voltage Recipe Filter", 8).getStackForm(1L));
+ ItemList.Automation_RecipeFilter_MAX.set(new GT_MetaTileEntity_RecipeFilter(9339, "automation.recipefilter.tier.09", "Highly Ultimate Voltage Recipe Filter", 9).getStackForm(1L));
+
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_ULV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_ULV, 'V', ItemList.Robot_Arm_LV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_LV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_LV, 'V', ItemList.Robot_Arm_LV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_MV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_MV, 'V', ItemList.Robot_Arm_MV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_HV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_HV, 'V', ItemList.Robot_Arm_HV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_EV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_EV, 'V', ItemList.Robot_Arm_EV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_IV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_IV, 'V', ItemList.Robot_Arm_IV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_LuV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_LuV, 'V', ItemList.Robot_Arm_LuV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_ZPM.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_ZPM, 'V', ItemList.Robot_Arm_ZPM, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_UV.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_UV, 'V', ItemList.Robot_Arm_UV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
+ GT_ModHandler.addCraftingRecipe(ItemList.Automation_RecipeFilter_MAX.get(1L), bitsd, new Object[]{" F ", "VMC", " X ", 'M', ItemList.Hull_MAX, 'V', ItemList.Robot_Arm_UHV, 'C', OreDictNames.craftingChest, 'F', OreDictNames.craftingFilter, 'X', OrePrefixes.circuit.get(Materials.Basic)});
}
private static void makeWires(Materials aMaterial, int aStartID, long aLossInsulated, long aLoss, long aAmperage, long aVoltage, boolean aInsulatable, boolean aAutoInsulated) {
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index e430765d48..81714022e9 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -133,6 +133,8 @@ GT5U.machines.stalled_vent.tooltip.3=§7vent towards an empty space.
GT5U.machines.stalled_vent.tooltip.extended=§7Progress was lost, but not
GT5U.machines.stalled_vent.tooltip.extended.1=§7the recipe's output.
+GT5U.recipe_filter.representation_slot.tooltip=Click with a machine to set filter
+
GT5U.gui.select.current=Current:
GT5U.item.programmed_circuit.select.header=Reprogram Circuit
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER.png
new file mode 100644
index 0000000000..4a156f0cf1
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER.png
Binary files differ
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER_GLOW.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER_GLOW.png
new file mode 100644
index 0000000000..6c7e63b924
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/AUTOMATION_RECIPEFILTER_GLOW.png
Binary files differ
diff --git a/src/main/resources/assets/gregtech/textures/gui/TypeFilter.png b/src/main/resources/assets/gregtech/textures/gui/SpecialFilter.png
index 78695e82e5..78695e82e5 100644
--- a/src/main/resources/assets/gregtech/textures/gui/TypeFilter.png
+++ b/src/main/resources/assets/gregtech/textures/gui/SpecialFilter.png
Binary files differ