aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/basic')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java45
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java89
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java16
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java560
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java90
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java22
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java79
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java30
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java51
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java9
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java224
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java61
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java46
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java90
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java34
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java38
16 files changed, 1137 insertions, 347 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
index 28f661c339..10bfd92f37 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
@@ -3,13 +3,12 @@ package gregtech.common.tileentities.machines.basic;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
-import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
-import gregtech.api.objects.GT_RenderedTexture;
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.blocks.GT_Block_Ores_Abstract;
@@ -25,8 +24,12 @@ import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidStack;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
@@ -44,18 +47,35 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
1, // output slot count
"Default.png", // GUI name
"", // NEI name
- new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) });
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build()));
radius = aRadius;
step = aStep;
}
+ @Override
public String[] getDescription() {
return new String[]{
"Place, activate with explosives",
@@ -79,6 +99,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
step = aStep;
}
+ @Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures,
this.mGUIName, this.mNEIName, this.radius, this.step);
@@ -220,7 +241,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
ItemData association = GT_OreDictUnificator.getAssociation(is);
if ((association != null) && (association.mPrefix.toString().startsWith("ore")))
return association.mMaterial.mMaterial.mDefaultLocalName;
- else if (GT_Utility.isOre(is))
+ else if (GT_Utility.isOre(tBlock, tMetaID))
return tBlock.getLocalizedName();
}
return null;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
index 6895310b46..98ddf665c0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
@@ -1,26 +1,49 @@
package gregtech.common.tileentities.machines.basic;
import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.item.ItemStack;
-public class GT_MetaTileEntity_Boxinator
- extends GT_MetaTileEntity_BasicMachine {
+import static gregtech.api.enums.Textures.BlockIcons.*;
+
+public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine {
ItemStack aInputCache;
ItemStack aOutputCache;
int aTypeCache = 0;
public GT_MetaTileEntity_Boxinator(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR)});
+ super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "",
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_SIDE_BOXINATOR_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_BOXINATOR_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_SIDE_BOXINATOR),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_BOXINATOR_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_FRONT_BOXINATOR_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_ACTIVE).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_FRONT_BOXINATOR),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_TOP_BOXINATOR_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_BOXINATOR_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_TOP_BOXINATOR),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_BOXINATOR_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_BOXINATOR_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_BOXINATOR_GLOW).glow().build()));
}
public GT_MetaTileEntity_Boxinator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
@@ -31,10 +54,12 @@ public class GT_MetaTileEntity_Boxinator
super(aName, aTier, 1, aDescription, aTextures, 2, 1, aGUIName, aNEIName);
}
+ @Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_Boxinator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName);
}
+ @Override
public GT_Recipe.GT_Recipe_Map getRecipeList() {
return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes;
}
@@ -61,6 +86,7 @@ public class GT_MetaTileEntity_Boxinator
aInputCache = mInputItem.copy();
}
+ @Override
public int checkRecipe() {
int tCheck = super.checkRecipe();
if (tCheck != DID_NOT_FIND_RECIPE) {
@@ -71,9 +97,9 @@ public class GT_MetaTileEntity_Boxinator
if ((GT_Utility.isStackValid(tSlot0)) && (GT_Utility.isStackValid(tSlot1)) && (GT_Utility.getContainerItem(tSlot0, true) == null)) {
if ((ItemList.Schematic_1by1.isStackEqual(tSlot1)) && (tSlot0.stackSize >= 1)) {
boolean tIsCached = hasValidCache(tSlot0,1,true);
- this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0});
+ this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0);
if (this.mOutputItems[0] != null) {
- if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ if (canOutput(this.mOutputItems[0])) {
tSlot0.stackSize -= 1;
calculateOverclockedNess(32,16);
//In case recipe is too OP for that machine
@@ -88,9 +114,9 @@ public class GT_MetaTileEntity_Boxinator
}
if ((ItemList.Schematic_2by2.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 4)) {
boolean tIsCached = hasValidCache(tSlot0,2,true);
- this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0, tSlot0, null, tSlot0, tSlot0});
+ this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, null, tSlot0, tSlot0);
if (this.mOutputItems[0] != null) {
- if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ if (canOutput(this.mOutputItems[0])) {
getInputAt(0).stackSize -= 4;
calculateOverclockedNess(32,32);
//In case recipe is too OP for that machine
@@ -105,9 +131,9 @@ public class GT_MetaTileEntity_Boxinator
}
if ((ItemList.Schematic_3by3.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 9)) {
boolean tIsCached = hasValidCache(tSlot0,3,true);
- this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0});
+ this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0);
if (this.mOutputItems[0] != null) {
- if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ if (canOutput(this.mOutputItems[0])) {
getInputAt(0).stackSize -= 9;
calculateOverclockedNess(32,64);
//In case recipe is too OP for that machine
@@ -124,27 +150,26 @@ public class GT_MetaTileEntity_Boxinator
return DID_NOT_FIND_RECIPE;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- ItemStack tInput1 = getInputAt(1);
- if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) {
- if (hasValidCache(aStack,aTypeCache,false))
- return true;
- if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), tInput1}) != null) {
- return true;
- }
- if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null)
- return true;
- if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, null, aStack, aStack}) != null) {
- return true;
- }
- if (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack}) != null)) {
- return true;
- }
- } else {
- return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
+ return false;
+ }
+ ItemStack tInput1 = getInputAt(1);
+ if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) {
+ if (hasValidCache(aStack,aTypeCache,false))
+ return true;
+ if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, GT_Utility.copyAmount(64L, aStack), tInput1) != null) {
+ return true;
+ }
+ if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(aStack) != null)
+ return true;
+ if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(aStack, aStack, null, aStack, aStack) != null) {
+ return true;
}
+ return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack) != null);
+ } else {
+ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);
}
- return false;
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
index e2663a15e4..d249cae2a1 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
@@ -10,17 +10,16 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.render.TextureFactory;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-public class GT_MetaTileEntity_CuringOven
- extends GT_MetaTileEntity_BasicMachine {
+public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine {
public GT_MetaTileEntity_CuringOven(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 1, "Heats tools for hardening", 1, 1, "E_Oven.png", "", new ITexture[]{new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))});
+ super(aID, aName, aNameRegional, aTier, 1, "Heats tools for hardening", 1, 1, "E_Oven.png", "", TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM")));
}
public GT_MetaTileEntity_CuringOven(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
@@ -31,14 +30,17 @@ public class GT_MetaTileEntity_CuringOven
super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
}
+ @Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_CuringOven(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName);
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (ItemList.Cell_Empty.isStackEqual(aStack));
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ItemList.Cell_Empty.isStackEqual(aStack);
}
+ @Override
public boolean isFluidInputAllowed(FluidStack aFluid) {
return false;
}
@@ -84,4 +86,4 @@ public class GT_MetaTileEntity_CuringOven
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index ce1812a9cf..b820dd44fd 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -1,20 +1,87 @@
package gregtech.common.tileentities.machines.basic;
+import com.google.common.collect.ArrayListMultimap;
+import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+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.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.ItemData;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.oredict.OreDictionary;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static gregtech.api.enums.Textures.BlockIcons.*;
+
+public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachine {
-public class GT_MetaTileEntity_Disassembler
- extends GT_MetaTileEntity_BasicMachine {
public GT_MetaTileEntity_Disassembler(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 1, "Disassembles Machines at " + Math.min(50 + 10 * aTier,100) + "% Efficiency", 1, 9, "Disassembler.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER)});
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 1,
+ new String[]{
+ "Disassembles Machines up to " + GT_Values.TIER_COLORS[aTier] + GT_Values.VOLTAGE_NAMES[aTier],
+ "Can also disassemble most assembler recipes!"
+ },
+ 1,
+ 9,
+ "Disassembler.png",
+ "",
+
+ //Textures
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_DISASSEMBLER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER),
+ TextureFactory.builder().addIcon(OVERLAY_SIDE_DISASSEMBLER_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER),
+ TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_TOP_DISASSEMBLER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_TOP_DISASSEMBLER),
+ TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE_GLOW).glow().build()),
+ TextureFactory.of(
+ TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER),
+ TextureFactory.builder().addIcon(OVERLAY_BOTTOM_DISASSEMBLER_GLOW).glow().build())
+ );
}
public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
@@ -25,83 +92,438 @@ public class GT_MetaTileEntity_Disassembler
super(aName, aTier, 1, aDescription, aTextures, 1, 9, aGUIName, aNEIName);
}
+ @Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_Disassembler(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName);
}
+ private static final ItemStack[][] alwaysReplace = {
+ {
+ //ItemStack to look for
+ new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE)
+ },
+ {
+ //ItemStack to replace
+ new ItemStack(Blocks.chest)
+ }
+ };
+
+ private static final Object[][] OreDictionaryOverride = {
+ {
+ //String to look for
+ "plankWood",
+ "stoneCobble",
+ "gemDiamond",
+ "logWood",
+ "stickWood",
+ "treeSapling"
+ },
+ {
+ //ItemStack to replace
+ new ItemStack(Blocks.planks),
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Items.diamond),
+ new ItemStack(Blocks.log),
+ new ItemStack(Items.stick),
+ new ItemStack(Blocks.sapling)
+ }
+ };
+
+ public static ArrayListMultimap<GT_ItemStack, ItemStack> getOutputHardOverrides() {
+ return outputHardOverrides;
+ }
+
+ private static final ArrayListMultimap<GT_ItemStack, ItemStack> outputHardOverrides;
+
+ private static final Set<GT_ItemStack> blackList;
+
+ public static Set<GT_ItemStack> getBlackList() {
+ return blackList;
+ }
+
+ static {
+ outputHardOverrides = ArrayListMultimap.create();
+ outputHardOverrides.put(new GT_ItemStack(new ItemStack(Blocks.torch,6)), new ItemStack(Items.stick));
+ blackList = new HashSet<>();
+ blackList.add(new GT_ItemStack(ItemList.Casing_Coil_Superconductor.get(1L)));
+ }
+
+ private boolean compareToUnpacker(ItemStack is){
+ return null != GT_Recipe.GT_Recipe_Map.sUnboxinatorRecipes.findRecipe(
+ null,
+ true,
+ true,
+ Long.MAX_VALUE,
+ null,
+ is);
+ }
+
+ @Override
public int checkRecipe() {
- //if ((getInputAt(0) != null) && (isOutputEmpty())) {
- // if(GT_Utility.areStacksEqual(getInputAt(0), new ItemStack(Items.egg))){
- // getInputAt(0).stackSize -= 1;
- // this.mEUt = (16 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- // this.mMaxProgresstime = 2400;
- // this.mMaxProgresstime = this.mMaxProgresstime >> (mTier);
- //if (getBaseMetaTileEntity().getRandomNumber(100) < (this.mTier+1)) {
- // this.mOutputItems[0] = ItemList.Circuit_Chip_Stemcell.get(1, new Object[0]);
- //}
- //return 2;
- //}
- NBTTagCompound tNBT = getInputAt(0).getTagCompound();
- if (tNBT != null) {
- tNBT = tNBT.getCompoundTag("GT.CraftingComponents");
- if (tNBT != null) {
- boolean isAnyOutput=false;
- calculateOverclockedNessDisassembler(16);
- this.mMaxProgresstime = 80;
- //In case recipe is too OP for that machine
- if (mEUt == Integer.MAX_VALUE - 1)//&& mMaxProgresstime==Integer.MAX_VALUE-1
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- for (int i = 0; i < this.mOutputItems.length; i++) {
- if (getBaseMetaTileEntity().getRandomNumber(100) < 50 + 10 * this.mTier) {
- this.mOutputItems[i] = GT_Utility.loadItem(tNBT, "Ingredient." + i);
- if (this.mOutputItems[i] != null) {
- this.mMaxProgresstime *= 1.7F;
- isAnyOutput=true;
- }
- }
- }
- if(!isAnyOutput)
- return DID_NOT_FIND_RECIPE;
- for(int i=mTier-5;i>0;i--){
- this.mMaxProgresstime>>=1;
- if(this.mMaxProgresstime==0)
- this.mEUt = this.mEUt>>1;
- }
- if(this.mEUt==0)
- mEUt = 1;
- if(this.mMaxProgresstime==0)
- this.mMaxProgresstime = 1;
- getInputAt(0).stackSize -= 1;
- return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
- }
+ ItemStack is = getInputAt(0);
+
+ if (GT_Utility.isStackInvalid(is))
+ return DID_NOT_FIND_RECIPE;
+
+ if (
+ is.getItem() instanceof GT_MetaGenerated_Tool
+ || blackList.contains(new GT_ItemStack(is))
+ || compareToUnpacker(is)
+ )
+ return DID_NOT_FIND_RECIPE;
+
+ if (checkTier(is))
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+
+ Integer handleHardOverride = handleHardOverride(is);
+ if (handleHardOverride != null)
+ return handleHardOverride;
+
+ return process();
+ }
+
+ private Integer handleHardOverride(ItemStack is) {
+ Set<GT_ItemStack> stacks = outputHardOverrides.keySet();
+ for (GT_ItemStack stack : stacks) {
+ ItemStack in = is.copy();
+ in.stackSize = 1;
+ if (stack.isStackEqual(in) && stack.mStackSize <= is.stackSize) {
+ return setOutputsAndTime(outputHardOverrides.get(stack).toArray(new ItemStack[0]), stack.mStackSize)
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : DID_NOT_FIND_RECIPE;
}
+ }
+ return null;
+ }
+
+ private boolean checkTier(ItemStack is) {
+ ItemStack comp = new ItemStack(GregTech_API.sBlockMachines);
+ if (is.getItem() == comp.getItem()) {
+ IMetaTileEntity iMetaTileEntity = GregTech_API.METATILEENTITIES[is.getItemDamage()];
+
+ return iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock &&
+ ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier;
+ }
+ return false;
+ }
+
+ private int process(){
+ int statusCode = checkRecipeMap();
+ if (statusCode != DID_NOT_FIND_RECIPE)
+ return statusCode;
+
+ return onTheFlyGeneration();
+ }
+
+ private int onTheFlyGeneration() {
+ Collection<DissassembleReference> recipes = this.findRecipeFromMachine();
+ if (recipes.isEmpty())
+ return DID_NOT_FIND_RECIPE;
+
+ DissassembleReference recipe = ensureDowncasting(recipes);
+
+ removeInvalidStacks(recipe);
+
+ return setOutputsAndTime(recipe.inputs, recipe.stackSize)
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+
+ private void removeInvalidStacks(DissassembleReference recipe) {
+ for (int i = 0; i < recipe.inputs.length; i++)
+ if (GT_Utility.isStackInvalid(recipe.inputs[i]) || recipe.inputs[i].stackSize < 1)
+ recipe.inputs[i] = null;
+
+ recipe.inputs = GT_Utility.getArrayListWithoutNulls(recipe.inputs).toArray(new ItemStack[0]);
+ }
+
+ private int checkRecipeMap() {
+ GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs());
+ if (gt_recipe == null)
+ return DID_NOT_FIND_RECIPE;
+ if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs()))
+ return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize)
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+
+ private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize){
+ if (this.getInputAt(0).stackSize >= stackSize)
+ this.getInputAt(0).stackSize -= stackSize;
+ else
+ return false;
+
+ System.arraycopy(inputs, 0, this.mOutputItems, 0, inputs.length);
+ this.calculateOverclockedNess(30,600);
-