aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorJason Mitchell <mitchej+github@gmail.com>2020-12-31 09:30:05 -0800
committerGitHub <noreply@github.com>2020-12-31 09:30:05 -0800
commit0ed11a6794e34ef4b104ff3a6ebc224d5efa80df (patch)
tree744a8d24726da1b06beb5f0490306ad0dde77a66 /src/main/java
parent23b550192c3b528dac9ef25c85da99611e00529f (diff)
parent116009659e461ac81f451406a5041a9b55f80a6f (diff)
downloadGT5-Unofficial-0ed11a6794e34ef4b104ff3a6ebc224d5efa80df.tar.gz
GT5-Unofficial-0ed11a6794e34ef4b104ff3a6ebc224d5efa80df.tar.bz2
GT5-Unofficial-0ed11a6794e34ef4b104ff3a6ebc224d5efa80df.zip
Merge branch 'experimental' into long_distance_transfer
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/gregtech/GT_Mod.java5
-rw-r--r--src/main/java/gregtech/api/enums/GT_Values.java11
-rw-r--r--src/main/java/gregtech/api/enums/HeatingCoilLevel.java69
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java2
-rw-r--r--src/main/java/gregtech/api/enums/Textures.java2
-rw-r--r--src/main/java/gregtech/api/interfaces/IHeatingCoil.java18
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java67
-rw-r--r--src/main/java/gregtech/api/objects/ReverseShapedRecipe.java43
-rw-r--r--src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java43
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_Shaped_Recipe.java25
-rw-r--r--src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java36
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java179
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings5.java71
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings5.java39
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java6
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java9
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java1
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java1
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java446
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java98
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java505
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java298
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java350
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java365
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java8
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java4
30 files changed, 1757 insertions, 955 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index b0ac434c61..fe44141324 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -32,6 +32,8 @@ import gregtech.api.enums.SubTag;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.internal.IGT_Mod;
import gregtech.api.objects.ItemData;
+import gregtech.api.objects.ReverseShapedRecipe;
+import gregtech.api.objects.ReverseShapelessRecipe;
import gregtech.api.objects.XSTR;
import gregtech.api.threads.GT_Runnable_MachineBlockUpdate;
import gregtech.api.util.GT_Assemblyline_Server;
@@ -1077,6 +1079,9 @@ public class GT_Mod implements IGT_Mod {
achievements = new GT_Achievements();
+ ReverseShapedRecipe.runReverseRecipes();
+ ReverseShapelessRecipe.runReverseRecipes();
+
GT_Recipe.GTppRecipeHelper = true;
GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables.");
GregTech_API.sBeforeGTPreload = null;
diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java
index 66b2e8a08f..8545f42bea 100644
--- a/src/main/java/gregtech/api/enums/GT_Values.java
+++ b/src/main/java/gregtech/api/enums/GT_Values.java
@@ -4,6 +4,7 @@ import gregtech.api.interfaces.internal.IGT_Mod;
import gregtech.api.interfaces.internal.IGT_RecipeAdder;
import gregtech.api.net.IGT_NetworkHandler;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
@@ -126,6 +127,16 @@ public class GT_Values {
"Ultimate High Voltage", "Ultimate Extreme Voltage", "Ultimate Insane Voltage",
"Ultimate Mega Voltage", "Ultimate Extended Mega Voltage", "Overpowered Voltage",
"Maximum Voltage"};
+
+ public static final String[] TIER_COLORS =
+ new String[]{
+ EnumChatFormatting.RED.toString(), EnumChatFormatting.GRAY.toString(), EnumChatFormatting.AQUA.toString(),
+ EnumChatFormatting.GOLD.toString(), EnumChatFormatting.DARK_PURPLE.toString(), EnumChatFormatting.DARK_BLUE.toString(),
+ EnumChatFormatting.LIGHT_PURPLE.toString(), EnumChatFormatting.WHITE.toString(), EnumChatFormatting.DARK_AQUA.toString(),
+ EnumChatFormatting.DARK_RED.toString(), EnumChatFormatting.GREEN.toString(), EnumChatFormatting.DARK_GREEN.toString(),
+ EnumChatFormatting.YELLOW.toString(), EnumChatFormatting.UNDERLINE.toString(), EnumChatFormatting.BOLD.toString(),
+ EnumChatFormatting.OBFUSCATED.toString()};
+
/**
* This way it is possible to have a Call Hierarchy of NullPointers in ItemStack based Functions, and also because most of the time I don't know what kind of Data Type the "null" stands for
*/
diff --git a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
new file mode 100644
index 0000000000..f4b28ede2b
--- /dev/null
+++ b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
@@ -0,0 +1,69 @@
+package gregtech.api.enums;
+
+import net.minecraft.util.EnumChatFormatting;
+
+public enum HeatingCoilLevel {
+ None, // 0
+ ULV, //Not implemented 901
+ LV, //Cupronickel 1801
+ MV, //KANTHAL 2701
+ HV, //NICHROME 3601
+ EV, //TUNGSTENSTEEL 4501
+ IV, //HSSG 5401
+ LuV, //HSSS 6301
+ ZPM, //NAQUADAH 7201
+ UV, //NAQUADAHALLOY 8101
+ UHV, //TRINIUM 9001
+ UEV, //ELECTRUMFLUX 9901
+ UIV, //AWAKENEDDRACONIUM 10801
+ //Not Implemented yet
+ UMV,
+ UXV,
+ OpV,
+ MAX,
+ ;
+
+ /**
+ * @return the Coils Tier Name
+ */
+ public String getTierName() {
+ if (this.ordinal() < 1 || (this.ordinal()-1) >= GT_Values.VN.length)
+ return "ERROR!";
+ return GT_Values.TIER_COLORS[this.ordinal() - 1] + GT_Values.VOLTAGE_NAMES[this.ordinal() - 1] + EnumChatFormatting.RESET;
+ }
+
+ /**
+ * @return the coil heat, used for recipes in the Electronic Blast Furnace for example
+ */
+ public long getHeat() {
+ return this == None ? 0 : 1L + (900L * this.ordinal());
+ }
+
+ /**
+ * @return the coil tier, used for discount in the Pyrolyse Ofen for example
+ */
+ public byte getTier() {
+ return (byte) (this.ordinal() - 2);
+ }
+
+ /**
+ * @return the coil Level, used for Parallels in the Multi Furnace for example
+ */
+ public byte getLevel() {
+ return (byte) Math.min(16, 2 << (this.ordinal() - 2));
+ }
+
+ /**
+ * @return the coil Discount, used for discount in the Multi Furnace for example
+ */
+ public byte getCostDiscount() {
+ return (byte) Math.max(1, 2 << (this.ordinal() - 1 - 6)); //-1 bcs. of none, -4 = offset
+ }
+
+ public static HeatingCoilLevel getFromTier(byte tier){
+ if (tier < 0 || tier > HeatingCoilLevel.values().length -1)
+ return HeatingCoilLevel.None;
+
+ return HeatingCoilLevel.values()[tier+2];
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index 5336e93068..94efa0605f 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -1443,7 +1443,9 @@ public enum ItemList implements IItemContainer {
Casing_Coil_Nichrome,
Casing_Coil_TungstenSteel,
Casing_Coil_HSSG,
+ Casing_Coil_HSSS,
Casing_Coil_Naquadah,
+ Casing_Coil_Trinium,
Casing_Coil_NaquadahAlloy,
Casing_Coil_ElectrumFlux,
Casing_Coil_AwakenedDraconium,
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java
index 18203faed1..de2c0919e7 100644
--- a/src/main/java/gregtech/api/enums/Textures.java
+++ b/src/main/java/gregtech/api/enums/Textures.java
@@ -294,6 +294,8 @@ public class Textures {
MACHINE_COIL_NAQUADAHALLOY,
MACHINE_COIL_ELECTRUMFLUX,
MACHINE_COIL_AWAKENEDDRACONIUM,
+ MACHINE_COIL_HSSS,
+ MACHINE_COIL_TRINIUM,
BOILER_SOLAR,
BOILER_FRONT,
diff --git a/src/main/java/gregtech/api/interfaces/IHeatingCoil.java b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java
new file mode 100644
index 0000000000..c8ceccf941
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/IHeatingCoil.java
@@ -0,0 +1,18 @@
+package gregtech.api.interfaces;
+
+import gregtech.api.enums.HeatingCoilLevel;
+import net.minecraft.item.ItemStack;
+
+import java.util.function.Consumer;
+
+public interface IHeatingCoil {
+
+ HeatingCoilLevel getCoilHeat(int meta);
+ default HeatingCoilLevel getCoilHeat(ItemStack stack) {
+ return getCoilHeat(stack.getItemDamage());
+ }
+
+ void setOnCoilCheck(Consumer<IHeatingCoil> callback);
+ Consumer<IHeatingCoil> getOnCoilCheck();
+}
+
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index 2c632c596b..497e42b9aa 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -516,8 +516,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (tMaxStacks > mOutputItems.length)
tMaxStacks = mOutputItems.length;
- int tCost = moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks);
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCost, true);
+ moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks);
// for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
// tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
// if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
index 8758ea1a02..82cda6c670 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
@@ -248,7 +248,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {
+ if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {
mSuccess--;
moveItems(aBaseMetaTileEntity, aTimer);
for(byte b = 0;b<6;b++)
@@ -261,7 +261,6 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
if (mInventory[i] == null) {
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,bInvert ? (byte)15 : (byte)0);
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(1, true);
break;
}
}
@@ -284,7 +283,6 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
mSuccess = 50;
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 202e542c88..e15166cf62 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -34,21 +34,21 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public static boolean disableMaintenance;
public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false;
public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0;
- public volatile int mUpdate = 0;
+ public volatile int mUpdate = 0; //TODO: Replace with AtomicInteger
public ItemStack[] mOutputItems = null;
public FluidStack[] mOutputFluids = null;
public String mNEI;
public int damageFactorLow = 5;
public float damageFactorHigh = 0.6f;
- public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Input>();
- public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Output>();
- public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>();
- public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<GT_MetaTileEntity_Hatch_OutputBus>();
- public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch_Dynamo>();
- public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>();
- public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>();
- public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>();
public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 2);
@@ -791,7 +791,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public ArrayList<ItemStack> getStoredOutputs() {
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> rList = new ArrayList<>();
// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
// if (isValidMetaTileEntity(tHatch)) {
// rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
@@ -808,7 +808,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public ArrayList<FluidStack> getStoredFluids() {
- ArrayList<FluidStack> rList = new ArrayList<FluidStack>();
+ ArrayList<FluidStack> rList = new ArrayList<>();
for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
@@ -819,7 +819,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public ArrayList<ItemStack> getStoredInputs() {
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> rList = new ArrayList<>();
// for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
// tHatch.mRecipeMap = getRecipeMap();
// if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) {
@@ -1003,4 +1003,47 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
+
+ protected ItemStack[] getCompactedInputs(){
+ //TODO: repalce method with a cleaner one
+ ArrayList<ItemStack> tInputList = getStoredInputs();
+ int tInputList_sS = tInputList.size();
+ for (int i = 0; i < tInputList_sS - 1; i++) {
+ for (int j = i + 1; j < tInputList_sS; j++) {
+ if (!GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j)))
+ continue;
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ tInputList_sS = tInputList.size();
+ } else {
+ tInputList.remove(i--);
+ tInputList_sS = tInputList.size();
+ break;
+ }
+ }
+ }
+ return tInputList.toArray(new ItemStack[0]);
+ }
+
+ protected FluidStack[] getCompactedFluids(){
+ //TODO: repalce method with a cleaner one
+ ArrayList<FluidStack> tFluidList = getStoredFluids();
+ int tFluidList_sS = tFluidList.size();
+ for (int i = 0; i < tFluidList_sS - 1; i++) {
+ for (int j = i + 1; j < tFluidList_sS; j++) {
+ if (!GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j)))
+ continue;
+
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ tFluidList_sS = tFluidList.size();
+ } else {
+ tFluidList.remove(i--);
+ tFluidList_sS = tFluidList.size();
+ break;
+ }
+ }
+ }
+ return tFluidList.toArray(new FluidStack[0]);
+ }
}
diff --git a/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java
new file mode 100644
index 0000000000..cb9e7d4d83
--- /dev/null
+++ b/src/main/java/gregtech/api/objects/ReverseShapedRecipe.java
@@ -0,0 +1,43 @@
+package gregtech.api.objects;
+
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Disassembler;
+import net.minecraft.item.ItemStack;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.Optional;
+import java.util.Queue;
+
+import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes;
+
+public class ReverseShapedRecipe {
+ private static Queue<ReverseShapedRecipe> reverseRecipes = new LinkedList<>();
+ private ItemStack aResult;
+ private Object[] aRecipe;
+
+ public static Queue<ReverseShapedRecipe> getReverseRecipes() {
+ return reverseRecipes;
+ }
+
+ public ReverseShapedRecipe(ItemStack output, Object[] aRecipe) {
+ this.aResult = output;
+ this.aRecipe = aRecipe;
+ reverseRecipes.add(this);
+ }
+
+ public static void runReverseRecipes() {
+ for (ReverseShapedRecipe x : reverseRecipes) {
+ Optional<GT_Recipe> recipeOptional = GT_Utility.reverseShapedRecipe(x.aResult, x.aRecipe);
+ if (!recipeOptional.isPresent())
+ continue;
+ GT_Recipe recipe = recipeOptional.get();
+ ItemStack[] replacement = new ItemStack[recipe.mOutputs.length];
+ GT_MetaTileEntity_Disassembler.handleRecipeTransformation(recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs));
+
+ recipe.mOutputs = replacement;
+ sDisassemblerRecipes.add(recipe);
+ }
+ }
+}
diff --git a/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java
new file mode 100644
index 0000000000..1c5e27d246
--- /dev/null
+++ b/src/main/java/gregtech/api/objects/ReverseShapelessRecipe.java
@@ -0,0 +1,43 @@
+package gregtech.api.objects;
+
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Disassembler;
+import net.minecraft.item.ItemStack;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.Optional;
+import java.util.Queue;
+
+import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes;
+
+public class ReverseShapelessRecipe {
+ private static Queue<ReverseShapelessRecipe> reverseRecipes = new LinkedList<>();
+ private ItemStack aResult;
+ private Object[] aRecipe;
+
+ public static Queue<ReverseShapelessRecipe> getReverseRecipes() {
+ return reverseRecipes;
+ }
+
+ public ReverseShapelessRecipe(ItemStack output, Object[] aRecipe) {
+ this.aResult = output;
+ this.aRecipe = aRecipe;
+ reverseRecipes.add(this);
+ }
+
+ public static void runReverseRecipes() {
+ for (ReverseShapelessRecipe x : reverseRecipes) {
+ Optional<GT_Recipe> recipeOptional = GT_Utility.reverseShapelessRecipe(x.aResult, x.aRecipe);
+ if (!recipeOptional.isPresent())
+ continue;
+ GT_Recipe recipe = recipeOptional.get();
+ ItemStack[] replacement = new ItemStack[recipe.mOutputs.length];
+ GT_MetaTileEntity_Disassembler.handleRecipeTransformation(recipe.mOutputs, replacement, Collections.singleton(recipe.mOutputs));
+
+ recipe.mOutputs = replacement;
+ sDisassemblerRecipes.add(recipe);
+ }
+ }
+}
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 537d92b365..9756a8199a 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -561,7 +561,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
public static final GT_Recipe_Map sRecyclerRecipes = new GT_Recipe_Map_Recycler(new HashSet<>(0), "ic.recipe.recycler", "Recycler", "ic2.recycler", RES_PATH_GUI + "basicmachines/Recycler", 1, 1, 1, 0, 1, E, 1, E, true, false);
public static final GT_Recipe_Map sFurnaceRecipes = new GT_Recipe_Map_Furnace(new HashSet<>(0), "mc.recipe.furnace", "Furnace", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 0, 1, E, 1, E, true, false);
public static final GT_Recipe_Map sMicrowaveRecipes = new GT_Recipe_Map_Microwave(new HashSet<>(0), "gt.recipe.microwave", "Microwave", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 0, 1, E, 1, E, true, false);
-
+ public static final GT_Recipe_Map sDisassemblerRecipes = new GT_Recipe_Map(new HashSet<>(250), "gt.recipe.disassembler", "Disassembler", null, RES_PATH_GUI + "basicmachines/Disassembler", 1, 9, 1, 0, 1, E, 1, E, true, false);
public static final GT_Recipe_Map sScannerFakeRecipes = new GT_Recipe_Map(new HashSet<>(300), "gt.recipe.scanner", "Scanner", null, RES_PATH_GUI + "basicmachines/Scanner", 1, 1, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map(new HashSet<>(200), "gt.recipe.rockbreaker", "Rock Breaker", null, RES_PATH_GUI + "basicmachines/RockBreaker", 1, 1, 0, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map(new HashSet<>(1000), "gt.recipe.byproductlist", "Ore Byproduct List", null, RES_PATH_GUI + "basicmachines/Default", 1, 6, 1, 0, 1, E, 1, E, true, true);
diff --git a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
index e51c490519..f00fc7758e 100644
--- a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
@@ -1,7 +1,7 @@
package gregtech.api.util;
import gregtech.api.interfaces.internal.IGT_CraftingRecipe;
-import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.ReverseShapedRecipe;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.inventory.InventoryCrafting;
@@ -11,7 +11,7 @@ import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRecipe {
- public final boolean mDismantleable, mRemovableByGT, mKeepingNBT;
+ public final boolean mRemovableByGT, mKeepingNBT;
private final Enchantment[] mEnchantmentsAdded;
private final int[] mEnchantmentLevelsAdded;
@@ -21,7 +21,9 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec
mEnchantmentLevelsAdded = aEnchantmentLevelsAdded;
mRemovableByGT = aRemovableByGT;
mKeepingNBT = aKeepingNBT;
- mDismantleable = aDismantleAble;
+ if (aDismantleAble) {
+ new ReverseShapedRecipe(aResult, aRecipe);
+ }
}
@Override
@@ -65,23 +67,6 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec
if (tCharge > 0) GT_ModHandler.chargeElectricItem(rStack, tCharge, Integer.MAX_VALUE, true, false);
}
- // Saving Ingredients inside the Item.
- if (mDismantleable) {
- NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound();
- if (rNBT == null) rNBT = new NBTTagCompound();
- for (int i = 0; i < 9; i++) {
- ItemStack tStack = aGrid.getStackInSlot(i);
- if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) {
- tStack = GT_Utility.copyAmount(1, tStack);
- if(GT_Utility.isStackValid(tStack)){
- GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true);
- tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound()));}
- }
- }
- rNBT.setTag("GT.CraftingComponents", tNBT);
- rStack.setTagCompound(rNBT);
- }
-
// Add Enchantments
for (int i = 0; i < mEnchantmentsAdded.length; i++)
GT_Utility.ItemNBT.addEnchantment(rStack, mEnchantmentsAdded[i], EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) + mEnchantmentLevelsAdded[i]);
diff --git a/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java b/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java
index 937ba0a837..fce135dfe6 100644
--- a/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Shapeless_Recipe.java
@@ -1,7 +1,7 @@
package gregtech.api.util;
import gregtech.api.interfaces.internal.IGT_CraftingRecipe;
-import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.ReverseShapelessRecipe;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.inventory.InventoryCrafting;
@@ -11,7 +11,7 @@ import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_CraftingRecipe {
- public final boolean mDismantleable, mRemovableByGT, mKeepingNBT;
+ public final boolean /*mDismantleable,*/ mRemovableByGT, mKeepingNBT;
private final Enchantment[] mEnchantmentsAdded;
private final int[] mEnchantmentLevelsAdded;
@@ -21,7 +21,9 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft
mEnchantmentLevelsAdded = aEnchantmentLevelsAdded;
mRemovableByGT = aRemovableByGT;
mKeepingNBT = aKeepingNBT;
- mDismantleable = aDismantleAble;
+ if (aDismantleAble){
+ new ReverseShapelessRecipe(aResult, aRecipe);
+ }
}
@Override
@@ -66,20 +68,20 @@ public class GT_Shapeless_Recipe extends ShapelessOreRecipe implements IGT_Craft
}
// Saving Ingredients inside the Item.
- if (mDismantleable) {
- NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound();
- if (rNBT == null) rNBT = new NBTTagCompound();
- for (int i = 0; i < 9; i++) {
- ItemStack tStack = aGrid.getStackInSlot(i);
- if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) {
- tStack = GT_Utility.copyAmount(1, tStack);
- GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true);
- tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound()));
- }
- }
- rNBT.setTag("GT.CraftingComponents", tNBT);
- rStack.setTagCompound(rNBT);
- }
+// if (mDismantleable) {
+// NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound();
+// if (rNBT == null) rNBT = new NBTTagCompound();
+// for (int i = 0; i < 9; i++) {
+// ItemStack tStack = aGrid.getStackInSlot(i);
+// if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) {
+// tStack = GT_Utility.copyAmount(1, tStack);
+// GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true);
+// tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound()));
+// }
+// }
+// rNBT.setTag("GT.CraftingComponents", tNBT);
+// rStack.setTagCompound(rNBT);
+// }
// Add Enchantments
for (int i = 0; i < mEnchantmentsAdded.length; i++)
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 3530fa17c2..adc0f95881 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -14,6 +14,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.*;
import gregtech.api.items.GT_EnergyArmor_Item;
import gregtech.api.items.GT_Generic_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.net.GT_Packet_Sound;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_ItemStack;
@@ -1022,7 +1023,7 @@ public class GT_Utility {
return copyMetaData(Items.feather.getDamage(aStack) + 1, aStack);
return null;
}
-
+
public static synchronized boolean removeIC2BottleRecipe(ItemStack aContainer, ItemStack aInput, Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, ItemStack aOutput){
if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false;
boolean rReturn = false;
@@ -1742,7 +1743,7 @@ public class GT_Utility {
if(aDimensionID<=1 && aDimensionID>=-1 && !GregTech_API.sDimensionalList.contains(aDimensionID)) return true;
return !GregTech_API.sDimensionalList.contains(aDimensionID) && DimensionManager.isDimensionRegistered(aDimensionID);
}
-
+
//public static boolean isRealDimension(int aDimensionID) {
// try {
// if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("com.xcompwiz.mystcraft"))
@@ -1756,7 +1757,7 @@ public class GT_Utility {
// } catch (Throwable e) {/*Do nothing*/}
// return GregTech_API.sDimensionalList.contains(aDimensionID);
//}
-
+
public static boolean moveEntityToDimensionAtCoords(Entity entity, int aDimension, double aX, double aY, double aZ) {
//Credit goes to BrandonCore Author :!:
@@ -2040,7 +2041,7 @@ public class GT_Utility {
if (D1) e.printStackTrace(GT_Log.err);
}
}
-
+
if (aPlayer.capabilities.isCreativeMode) {
FluidStack tFluid = undergroundOilReadInformation(aWorld.getChunkFromBlockCoords(aX,aZ));//-# to only read
if (tFluid!=null)
@@ -2355,7 +2356,7 @@ public class GT_Utility {
setBookTitle(aStack, "Raw Prospection Data");
NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack);
-
+
tNBT.setByte("prospection_tier", aTier);
tNBT.setString("prospection_pos", "Dim: " + aDim + "\nX: " + aX + " Y: " + aY + " Z: " + aZ);
@@ -2369,27 +2370,27 @@ public class GT_Utility {
String[] aStats = aStr.split(",");
tOilsTransformed.add(aStats[0] + ": " + aStats[1] + "L " + aStats[2]);
}
-
+
tNBT.setString("prospection_oils", joinListToString(tOilsTransformed));
String tOilsPosStr = "X: " + Math.floorDiv(aX, 16*8)*16*8 + " Z: " + Math.floorDiv(aZ, 16*8)*16*8 + "\n";
int xOff = aX - Math.floorDiv(aX, 16*8)*16*8;
xOff = xOff/16;
int xOffRemain = 7 - xOff;
-
+
int zOff = aZ - Math.floorDiv(aZ, 16*8)*16*8;
zOff = zOff/16;
int zOffRemain = 7 - zOff;
-
+
for( ; zOff > 0; zOff-- ) {
tOilsPosStr = tOilsPosStr.concat("--------\n");
}
for( ; xOff > 0; xOff-- ) {
tOilsPosStr = tOilsPosStr.concat("-");
}
-
+
tOilsPosStr = tOilsPosStr.concat("P");
-
+
for( ; xOffRemain > 0; xOffRemain-- ) {
tOilsPosStr = tOilsPosStr.concat("-");
}
@@ -2444,11 +2445,11 @@ public class GT_Utility {
+ "Location is center of orevein\n\n"
+ "Check NEI to confirm orevein type";
tNBTList.appendTag(new NBTTagString(tPageText));
-
+
if (tOres != null)
fillBookWithList(tNBTList, "Ores Found %s\n\n", "\n", 7, tOres);
-
+
if (tOils != null)
fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils);
@@ -2466,7 +2467,7 @@ public class GT_Utility {
tOilsPosStr + "\n" +
"P - Prospector in 8x8 field";
tNBTList.appendTag(new NBTTagString(tPageText));
-
+
tNBT.setString("author", tPos.replace("\n"," "));
tNBT.setTag("pages", tNBTList);
setNBT(aStack, tNBT);
@@ -2606,11 +2607,11 @@ public class GT_Utility {
}
public static boolean isPartOfMaterials(ItemStack aStack, Materials aMaterials){
- return GT_OreDictUnificator.getAssociation(aStack) != null ? GT_OreDictUnificator.getAssociation(aStack).mMaterial.mMaterial.equals(aMaterials) : false;
+ return GT_OreDictUnificator.getAssociation(aStack) != null && GT_OreDictUnificator.getAssociation(aStack).mMaterial.mMaterial.equals(aMaterials);
}
public static boolean isPartOfOrePrefix(ItemStack aStack, OrePrefixes aPrefix){
- return GT_OreDictUnificator.getAssociation(aStack) != null ? GT_OreDictUnificator.getAssociation(aStack).mPrefix.equals(aPrefix) : false;
+ return GT_OreDictUnificator.getAssociation(aStack) != null && GT_OreDictUnificator.getAssociation(aStack).mPrefix.equals(aPrefix);
}
public static boolean isOre(ItemStack aStack) {
for (int id: OreDictionary.getOreIDs(aStack)) {
@@ -2620,4 +2621,152 @@ public class GT_Utility {
return false;
}
+ public static Optional<GT_Recipe> reverseShapelessRecipe(ItemStack output, Object... aRecipe) {
+ if (output == null) {
+ return Optional.empty();
+ }
+
+ List<ItemStack> inputs = new ArrayList<>();
+
+ for (Object o : aRecipe) {
+ if (o instanceof ItemStack) {
+ ItemStack toAdd = ((ItemStack) o).copy();
+ inputs.add(toAdd);
+ } else if (o instanceof String) {
+ ItemStack stack = GT_OreDictUnificator.get(o, 1);
+ if (stack == null) {
+ Optional<ItemStack> oStack = OreDictionary.getOres((String) o)
+ .stream()
+ .findAny();
+ if (oStack.isPresent()) {
+ ItemStack copy = oStack.get().copy();
+ inputs.add(copy);
+ }
+ } else {
+ ItemStack copy = stack.copy();
+ inputs.add(copy);
+ }
+ } else if (o instanceof Item)
+ inputs.add(new ItemStack((Item) o));
+ else if (o instanceof Block)
+ inputs.add(new ItemStack((Block) o));
+ else
+ throw new IllegalStateException("A Recipe contains an invalid input! Output: " + output);
+ }
+
+ inputs.removeIf(x -> x.getItem() instanceof GT_MetaGenerated_Tool);
+
+ return Optional.of(
+ new GT_Recipe(
+ false,
+ new ItemStack[]{output},
+ inputs.toArray(new ItemStack[0]),
+ null, null,
+ null, null,
+ 300, 30, 0
+ )
+ );
+ }
+
+
+ public static Optional<GT_Recipe> reverseShapedRecipe(ItemStack output, Object... aRecipe) {
+ if (output == null) {
+// System.out.println("Null Recipe detected!");
+ return Optional.empty();
+ }
+// System.out.println("Registering Reverse Recipe for: " + GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName(output) + "|" + output.getUnlocalizedName()));
+// for (Object o : aRecipe) {
+// String toPrint;
+// if (o instanceof String) {
+// toPrint = (String) o;
+// toPrint += " String";
+// } else if (o instanceof ItemStack) {
+// toPrint = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName((ItemStack) o));
+// toPrint += " ItemStack";
+// } else if (o instanceof List) {
+// toPrint = String.join(", ", ((List<String>) o));
+// toPrint += " List<String>";
+// } else if (o instanceof Item) {
+// toPrint = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName(new ItemStack((Item) o)));
+// toPrint += " Item";
+// } else if (o instanceof Block) {
+// toPrint = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName(new ItemStack((Block) o)));
+// toPrint += " Block";
+// } else if (o != null) {
+// toPrint = o.toString();
+// toPrint += " Other";
+// } else {
+// toPrint = "NULL";
+// }
+// System.out.println(toPrint);
+// }
+ Map<Object, Integer> recipeAsMap = new HashMap<>();
+ Map<Character, Object> ingridients = new HashMap<>();
+ Map<Character, Integer> amounts = new HashMap<>();
+ boolean startFound = false;
+ for (int i = 0, aRecipeLength = aRecipe.length; i < aRecipeLength; i++) {
+ Object o = aRecipe[i];
+ if (!startFound) {
+ if (o instanceof String) {
+ for (Character c : ((String) o).toCharArray())
+ amounts.merge(c, 1, (a, b) -> ++a);
+ } else if (o instanceof Character)
+ startFound = true;
+ } else if (!(o instanceof Character))
+ ingridients.put((Character) aRecipe[i - 1], o);
+ }
+ for (Map.Entry<Character, Object> characterObjectEntry : ingridients.entrySet()) {
+ for (Map.Entry<Character, Integer> characterIntegerEntry : amounts.entrySet()) {
+ if (characterObjectEntry.getKey() != characterIntegerEntry.getKey())
+ continue;
+ recipeAsMap.put(characterObjectEntry.getValue(), characterIntegerEntry.getValue());
+ }
+ }
+ List<ItemStack> inputs = new ArrayList<>();
+
+ for (Map.Entry<Object, Integer> o : recipeAsMap.entrySet()) {
+ if (o.getKey() instanceof ItemStack) {
+ ItemStack toAdd = ((ItemStack) o.getKey()).copy();
+ toAdd.stackSize = o.getValue();
+ inputs.add(toAdd);
+ } else if (o.getKey() instanceof String) {
+// System.out.println("Found OreDictEntry: "+o.getKey());
+ ItemStack stack = GT_OreDictUnificator.get(o.getKey(), o.getValue());
+ if (stack == null) {
+ Optional<ItemStack> oStack = OreDictionary.getOres((String) o.getKey())
+ .stream()
+ .findAny();
+ if (oStack.isPresent()) {
+ ItemStack copy = oStack.get().copy();
+ copy.stackSize = o.getValue();
+ inputs.add(copy);
+ }
+// else
+// System.out.println("OreDict Entry "+o.getKey()+" couldn't be found!");
+ } else {
+ ItemStack copy = stack.copy();
+ copy.stackSize = o.getValue();
+ inputs.add(copy);
+ }
+ } else if (o.getKey() instanceof Item)
+ inputs.add(new ItemStack((Item) o.getKey(), o.getValue()));
+ else if (o.getKey() instanceof Block)
+ inputs.add(new ItemStack((Block) o.getKey(), o.getValue()));
+ else
+ throw new IllegalStateException("A Recipe contains an invalid input! Output: " + output);
+ }
+
+ inputs.removeIf(x -> x.getItem() instanceof GT_MetaGenerated_Tool);
+
+ return Optional.of(
+ new GT_Recipe(
+ false,
+ new ItemStack[]{output},
+ inputs.toArray(new ItemStack[0]),
+ null, null,
+ null, null,
+ 300, 30, 0
+ )
+ );
+ }
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
index 995de490e8..1ccd1f7164 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
@@ -2,14 +2,21 @@ package gregtech.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class GT_Block_Casings5 extends GT_Block_Casings_Abstract {
+import java.util.function.Consumer;
+
+import static gregtech.api.enums.HeatingCoilLevel.*;
+
+public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHeatingCoil {
+
public GT_Block_Casings5() {
super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
@@ -24,6 +31,8 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Naquadah Alloy Coil Block");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Electrum Flux Coil Block");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Awakened Draconium Coil Block");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "HSS-S Coil Block");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Trinium Coil Block");
ItemList.Casing_Coil_Cupronickel.set(new ItemStack(this, 1, 0));
ItemList.Casing_Coil_Kanthal.set(new ItemStack(this, 1, 1));
@@ -34,7 +43,10 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract {
ItemList.Casing_Coil_NaquadahAlloy.set(new ItemStack(this, 1, 6));
ItemList.Casing_Coil_ElectrumFlux.set(new ItemStack(this, 1, 7));
ItemList.Casing_Coil_AwakenedDraconium.set(new ItemStack(this, 1, 8));
+ ItemList.Casing_Coil_HSSS.set(new ItemStack(this, 1, 9));
+ ItemList.Casing_Coil_Trinium.set(new ItemStack(this, 1, 10));
}
+
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int aSide, int aMeta) {
@@ -57,7 +69,62 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract {
return Textures.BlockIcons.MACHINE_COIL_ELECTRUMFLUX.getIcon();
case 8:
return Textures.BlockIcons.MACHINE_COIL_AWAKENEDDRACONIUM.getIcon();
+ case 9:
+ return Textures.BlockIcons.MACHINE_COIL_HSSS.getIcon();
+ case 10:
+ return Textures.BlockIcons.MACHINE_COIL_TRINIUM.getIcon();
}
return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon();
}
-}
+
+ /*--------------- COIL CHECK IMPL. ------------*/
+
+ public static HeatingCoilLevel getCoilHeatFromDamage(int meta) {
+ switch (meta) {
+ case 0:
+ return LV;
+ case 1:
+ return MV;
+ case 2:
+ return HV;
+ case 3:
+ return EV;
+ case 4:
+ return IV;
+ case 5:
+ return ZPM;
+ case 6:
+ return UV;
+ case 7:
+ return UEV;
+ case 8:
+ return UIV;
+ case 9:
+ return LuV;
+ case 10:
+ return UHV;
+ default:
+ return None;
+ }
+ }
+
+ @Override
+ public HeatingCoilLevel getCoilHeat(int meta) {
+ getOnCoilCheck().accept(this);
+ return getCoilHeatFromDamage(meta);
+ }
+
+ /*--------------- CALLBACK ------------*/
+
+ private Consumer<IHeatingCoil> callback = coil -> {};
+
+ @Override
+ public void setOnCoilCheck(Consumer<IHeatingCoil> callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public Consumer<IHeatingCoil> getOnCoilCheck() {
+ return this.callback;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java
index 38ad1a668c..f3e58d2acc 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings5.java
@@ -2,6 +2,8 @@ package gregtech.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.util.GT_LanguageManager;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -12,37 +14,18 @@ public class GT_Item_Casings5 extends GT_Item_Casings_Abstract {
public GT_Item_Casings5(Block par1) {
super(par1);
}
+
+ protected static final String mCoilHeatTooltip = GT_LanguageManager.addStringLocalization("gt.coilheattooltip", "Base Heating Capacity = ");
+ protected static final String mCoilUnitTooltip = GT_LanguageManager.addStringLocalization("gt.coilunittooltip", " Kelvin");
+ protected static final String mCoilTierTooltip = GT_LanguageManager.addStringLocalization("gt.coiltiertooltip", "Coil Tier = ");
+
@Override
@SideOnly(Side.CLIENT)
+ @SuppressWarnings("unchecked")
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
super.addInformation(aStack, aPlayer, aList, aF3_H);
- switch (getDamage(aStack)) {
- case 0:
- aList.add(this.mCoil01Tooltip);
- break;
- case 1:
- aList.add(this.mCoil02Tooltip);
- break;
- case 2:
- aList.add(this.mCoil03Tooltip);
- break;
- case 3:
- aList.add(this.mCoil04Tooltip);
- break;
- case 4:
- aList.add(this.mCoil05Tooltip);
- break;
- case 5:
- aList.add(this.mCoil06Tooltip);
- break;
- case 6:
- aList.add(this.mCoil07Tooltip);
- break;
- case 7:
- aList.add(this.mCoil08Tooltip);
- break;
- case 8:
- aList.add(this.mCoil09Tooltip);
- }
+ HeatingCoilLevel coilLevel = GT_Block_Casings5.getCoilHeatFromDamage(aStack.getItemDamage());
+ aList.add(mCoilHeatTooltip + coilLevel.getHeat() + mCoilUnitTooltip);
+ aList.add(mCoilTierTooltip + coilLevel.getTierName());
}
}
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 0b3cc6182a..917f31f9ce 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -64,10 +64,12 @@ public class GT_Item_Machines extends ItemBlock {
}
if (tTileEntity.getEUCapacity() > 0L) {
if (tTileEntity.getInputVoltage() > 0L) {
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY);
+ int inputTier = GT_Utility.getTier(tTileEntity.getInputVoltage());
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + EnumChatFormatting.GREEN +")" + EnumChatFormatting.GRAY);
}
if (tTileEntity.getOutputVoltage() > 0L) {
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY);
+ int outputTier = GT_Utility.getTier(tTileEntity.getOutputVoltage());
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY);
}
if (tTileEntity.getOutputAmperage() > 1L) {
aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY);
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
index 39c87669f1..f8784d570f 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java
@@ -50,14 +50,7 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehavior {
tLiquid = tLiquid.copy();
tLiquid.amount = tTank2.fill(directionTo, tLiquid, false);
if (tLiquid.amount > 0) {
- if (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10)) {
- if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) {
- aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true);
- tTank2.fill(directionTo, tTank1.drain(directionFrom, tLiquid.amount, true), true);
- }
- } else {
- tTank2.fill(directionTo, tTank1.drain(directionFrom, tLiquid.amount, true), true);
- }
+ tTank2.fill(directionTo, tTank1.drain(directionFrom, tLiquid.amount, true), true);
}
}
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
index 6605d4fc35..4e80b7b779 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
@@ -19,7 +19,7 @@ import java.util.Comparator;
public class GT_MetaTileEntity_ChestBuffer
extends GT_MetaTileEntity_Buffer {
- private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1,1,1};
+ private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1, 1, 1, 1, 1, 1};
public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) {
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
index 5fa3bc8c82..37d8585310 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
@@ -143,7 +143,6 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer
}
if (movedItems > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
mSuccess = 50;
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(movedItems), true);
}
fillStacksIntoFirstSlots();
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java
index b5a33bfb81..746e182066 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java
@@ -95,7 +95,6 @@ public class GT_MetaTileEntity_Regulator
tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[]{this.mInventory[(i + 9)]}), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3;
if (tCosts > 0) {
this.mSuccess = 50;
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCosts, true);
break;
}
}
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..92ed054b05 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,15 +1,34 @@
package gregtech.common.tileentities.machines.basic;
-import gregtech.api.enums.GT_Values;
+import com.google.common.collect.ArrayListMultimap;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
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.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.objects.ItemData;
+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.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
public class GT_MetaTileEntity_Disassembler
extends GT_MetaTileEntity_BasicMachine {
@@ -29,79 +48,380 @@ public class GT_MetaTileEntity_Disassembler
return new GT_MetaTileEntity_Disassembler(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName);
}
+ private static final ItemStack[][] alwaysReplace = new ItemStack[][]{
+ {
+ //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 = new Object[][]{
+ {
+ //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;
+
+ static {
+ outputHardOverrides = ArrayListMultimap.create();
+ outputHardOverrides.put(new GT_ItemStack(new ItemStack(Blocks.torch,6)), new ItemStack(Items.stick));
+ }
+
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)
+ return DID_NOT_FIND_RECIPE;
+ ItemStack comp = new ItemStack(GregTech_API.sBlockMachines);
+ if (is.getItem() == comp.getItem()) {
+ IMetaTileEntity iMetaTileEntity = GregTech_API.METATILEENTITIES[is.getItemDamage()];
+ if (iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock &&
+ ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+ 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 process()
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : DID_NOT_FIND_RECIPE;
+ }
+
+ private boolean process(){
+
+ GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.mEUt, null, this.getAllInputs());
+ if (gt_recipe != null) {
+ gt_recipe.isRecipeInputEqual(true, null, this.getRealInventory());
+ return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize);
+ }
+
+ Collection<DissassembleReference> recipes = this.findRecipeFromMachine();
+ if (recipes.isEmpty())
+ return false;
- return DID_NOT_FIND_RECIPE;
+ DissassembleReference recipe = ensureDowncasting(recipes);
+
+ 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]);
+
+ return setOutputsAndTime(recipe.inputs, recipe.stackSize);
}
- private void calculateOverclockedNessDisassembler(int aEUt) {
- if(mTier==0){
- mEUt=aEUt>>2;
- }else{
- //Long EUt calculation
- long xEUt=aEUt;
- //Isnt too low EUt check?
- long tempEUt = xEUt<GT_Values.V[1] ? GT_Values.V[1] : xEUt;
+ 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);
+
+ return true;
+ }
+
+ private static DissassembleReference ensureDowncasting(Collection<DissassembleReference> recipes) {
+ ItemStack[] inputs = recipes.stream()
+ .findFirst()
+ .orElseThrow(NullPointerException::new)
+ .inputs;
+
+ ItemStack[] output = new ItemStack[inputs.length];
+ List<GT_Recipe> recipesColl = null;
+ if (recipes.size() > 1)
+ recipesColl = recipes.stream()
+ .skip(1)
+ .map(x -> x.recipe)
+ .collect(Collectors.toList());
+
+ handleRecipeTransformation(inputs, output, recipesColl);
- while (tempEUt <= GT_Values.V[mTier -1] * (long)mAmperage) {
- tempEUt<<=2;//this actually controls overclocking
- xEUt<<=2;//this is effect of overclocking
+ return new DissassembleReference(recipes.stream().mapToInt(x -> x.stackSize).min().orElseThrow(NumberFormatException::new), output, null);
+ }
+
+ private static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, List<GT_Recipe> recipesColl) {
+ for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) {
+ Set<ItemStack[]> inputsStacks = null;
+ if (recipesColl != null)
+ inputsStacks = recipesColl.stream()
+ .map(x -> x.mInputs)
+ .collect(Collectors.toSet());
+ ItemStack input = inputs[i];
+ ItemData data = GT_OreDictUnificator.getItemData(input);
+ if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) {
+ output[i] = input;
+ continue;
}
- if(xEUt>Integer.MAX_VALUE-1){
- mEUt = Integer.MAX_VALUE-1;
- }else{
- mEUt = (int)xEUt;
+ handleReplacement(inputsStacks, data, output, input, i);
+ }
+ addOthersAndHandleAlwaysReplace(inputs, output);
+ }
+
+ /**
+ * Public Interface for ReverseRecipes, do not call inside of this class.
+ * @param inputs
+ * @param output
+ * @param inputsStacks
+ */
+ public static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks) {
+ for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) {
+ ItemStack input = inputs[i];
+ ItemData data = GT_OreDictUnificator.getItemData(input);
+ if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) {
+ output[i] = input;
+ continue;
}
+ handleReplacement(inputsStacks, data, output, input, i);
}
+ addOthersAndHandleAlwaysReplace(inputs, output);
+ }
+
+ private static void addOthersAndHandleAlwaysReplace(ItemStack[] inputs, ItemStack[] output){
+ for (int i = 0; i < inputs.length; i++) {
+ //Adds rest of Items
+ if (output[i] == null)
+ output[i] = inputs[i];
+
+ //Math.min the recipe output if Items are the same
+ if (GT_Utility.areStacksEqual(output[i], inputs[i]))
+ output[i].stackSize = Math.min(output[i].stackSize, inputs[i].stackSize);
+
+ //Handles replacement Overrides
+ ItemStack[] itemStacks = GT_MetaTileEntity_Disassembler.alwaysReplace[0];
+ for (int j = 0; j < itemStacks.length; j++) {
+ ItemStack x = itemStacks[j];
+ if (GT_Utility.areStacksEqual(x, output[i], true)) {
+ output[i] = GT_MetaTileEntity_Disassembler.alwaysReplace[1][j];
+ break;
+ }
+ }
+
+ //Unification
+ output[i] = handleUnification(output[i]);
+ }
+ }
+
+ private static ItemStack handleUnification(ItemStack stack) {
+ for (int oreID : OreDictionary.getOreIDs(stack)) {
+ for (int i = 0; i < OreDictionaryOverride[0].length; i++)
+ if (OreDictionary.getOreName(oreID).equals(OreDictionaryOverride[0][i])){
+ ItemStack ret = ((ItemStack) OreDictionaryOverride[1][i]).copy();
+ ret.stackSize = stack.stackSize;
+ return ret;
+ }
+ }
+ return GT_OreDictUnificator.get(stack);
+ }
+
+ private static void handleReplacement(Set<ItemStack[]> inputsStacks, ItemData data, ItemStack[] output, ItemStack input, int i){
+ AtomicReference<Materials> toRpl = new AtomicReference<>();
+ Materials first = data.mMaterial.mMaterial;
+ if (inputsStacks != null) {
+ handleInputStacks(inputsStacks, toRpl, data, first, i);
+ }
+ if (toRpl.get() == null) {
+ //Remove Magnetic and Annealed Modifiers
+ handleBetterMaterialsVersions(data, toRpl);
+ }
+ if (toRpl.get() != null) {
+ output[i] = GT_OreDictUnificator.get(data.mPrefix, toRpl.get(), input.stackSize);
+ return;
+ }
+ if (data.mPrefix == OrePrefixes.circuit) {
+ handleCircuits(first, output, input, i);
+ }
+ }
+
+ private static void handleInputStacks(Set<ItemStack[]> inputsStacks, AtomicReference<Materials> toRpl, ItemData data, Materials first, int i){
+ final int finalIndex = i;
+ inputsStacks.forEach(stackArray -> {
+ ItemData dataAgainst = GT_OreDictUnificator.getItemData(stackArray[finalIndex]);
+ if (
+ dataAgainst == null ||
+ dataAgainst.mMaterial == null ||
+ dataAgainst.mMaterial.mMaterial == null ||
+ dataAgainst.mPrefix == null ||
+ dataAgainst.mPrefix != data.mPrefix
+ ) {
+ return;
+ }
+ handleDifferentMaterialsOnRecipes(first, dataAgainst.mMaterial.mMaterial, toRpl);
+ handleAnyMaterials(first,toRpl);
+ });
+ }
+
+ private static void handleAnyMaterials(Materials first, AtomicReference<Materials> toRpl){
+ if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyIron)))
+ toRpl.set(Materials.Iron);
+ else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyCopper)))
+ toRpl.set(Materials.Copper);
+ else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyRubber)))
+ toRpl.set(Materials.Rubber);
+ else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyBronze)))
+ toRpl.set(Materials.Bronze);
+ else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnySyntheticRubber)))
+ toRpl.set(Materials.Rubber);
+ }
+
+ private static void handleDifferentMaterialsOnRecipes(Materials first, Materials second, AtomicReference<Materials> toRpl){
+ if (!first.equals(second))
+ if (first.equals(Materials.Aluminium) && second.equals(Materials.Iron))
+ toRpl.set(second);
+ else if (first.equals(Materials.Steel) && second.equals(Materials.Iron))
+ toRpl.set(second);
+ else if (first.equals(Materials.WroughtIron) && second.equals(Materials.Iron))
+ toRpl.set(second);
+ else if (first.equals(Materials.Aluminium) && second.equals(Materials.WroughtIron))
+ toRpl.set(Materials.Iron);
+ else if (first.equals(Materials.Aluminium) && second.equals(Materials.Steel))
+ toRpl.set(second);
+ else if (first.equals(Materials.Polytetrafluoroethylene) && second.equals(Materials.Plastic))
+ toRpl.set(second);
+ else if (first.equals(Materials.Polybenzimidazole) && second.equals(Materials.Plastic))
+ toRpl.set(second);
+ else if (first.equals(Materials.Polystyrene) && second.equals(Materials.Plastic))
+ toRpl.set(second);
+ else if (first.equals(Materials.Silicone) && second.equals(Materials.Plastic))
+ toRpl.set(second);
+ else if (first.equals(Materials.NetherQuartz) || first.equals(Materials.CertusQuartz) && second.equals(Materials.Quartzite))
+ toRpl.set(second);
+ else if (first.equals(Materials.Plastic) && second.equals(Materials.Wood))
+ toRpl.set(second);
+ else if (first.equals(Materials.Diamond) && second.equals(Materials.Glass))
+ toRpl.set(second);
+ }
+
+ private static void handleBetterMaterialsVersions(ItemData data, AtomicReference<Materials> toRpl){
+ if (Materials.SteelMagnetic.equals(data.mMaterial.mMaterial)) {
+ toRpl.set(Materials.Steel);
+ } else if (Materials.IronMagnetic.equals(data.mMaterial.mMaterial)) {
+ toRpl.set(Materials.Iron);
+ } else if (Materials.NeodymiumMagnetic.equals(data.mMaterial.mMaterial)) {
+ toRpl.set(Materials.Neodymium);
+ } else if (Materials.SamariumMagnetic.equals(data.mMaterial.mMaterial)) {
+ toRpl.set(Materials.Samarium);
+ } else if (Materials.AnnealedCopper.equals(data.mMaterial.mMaterial)) {
+ toRpl.set(Materials.Copper);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private static void handleCircuits(Materials first, ItemStack[] output, ItemStack input, int i){
+ if (first.equals(Materials.Primitive))
+ output[i] = ItemList.NandChip.get(input.stackSize);
+ else if (first.equals(Materials.Basic))
+ output[i] = ItemList.Circuit_Microprocessor.get(input.stackSize);
+ else if (first.equals(Materials.Good))
+ output[i] = ItemList.Circuit_Good.get(input.stackSize);
+ else if (first.equals(Materials.Advanced))
+ output[i] = ItemList.Circuit_Advanced.get(input.stackSize);
+ else if (first.equals(Materials.Data))
+ output[i] = ItemList.Circuit_Data.get(input.stackSize);
+ else if (first.equals(Materials.Master))
+ output[i] = ItemList.Circuit_Master.get(input.stackSize);
+ else if (first.equals(Materials.Ultimate))
+ output[i] = ItemList.Circuit_Quantummainframe.get(input.stackSize);
+ else if (first.equals(Materials.Superconductor))
+ output[i] = ItemList.Circuit_Crystalmainframe.get(input.stackSize);
+ else if (first.equals(Materials.Infinite))
+ output[i] = ItemList.Circuit_Wetwaremainframe.get(input.stackSize);
+ else if (first.equals(Materials.Bio))
+ output[i] = ItemList.Circuit_Biomainframe.get(input.stackSize);
+ }
+
+ static class DissassembleReference {
+ final int stackSize;
+ ItemStack[] inputs;
+ final GT_Recipe recipe;
+
+ public DissassembleReference(int stackSize, ItemStack[] inputs, GT_Recipe recipe) {
+ this.stackSize = stackSize;
+ this.inputs = inputs;
+ this.recipe = recipe;
+ }
+ }
+
+ private Collection<DissassembleReference> findRecipeFromMachine() {
+ ItemStack is = getInputAt(0);
+ if (GT_Utility.isStackInvalid(is))
+ return Collections.emptySet();
+
+ AtomicInteger stacksize = new AtomicInteger();
+ //Check Recipe Maps for creation of Item
+ List<DissassembleReference> possibleRecipes = GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList.stream()
+ .filter(x -> Arrays.stream(x.mOutputs)
+ .anyMatch(y ->
+ {
+ ItemStack out = is.copy();
+ out.stackSize = y.stackSize;
+ boolean isDone = GT_Utility.areStacksEqual(y, out, true) && y.stackSize <= is.stackSize;
+ if (isDone)
+ stacksize.set(y.stackSize);
+ return isDone;
+ })
+ )
+ .map(x -> new DissassembleReference(stacksize.get(), x.mInputs, x))
+ .collect(Collectors.toList());
+
+ //Is there only one way to create it?
+ if (possibleRecipes.size() == 1)
+ return possibleRecipes;
+
+ //There are Multiple Ways -> Get recipe with cheapest inputs
+ //More Inputs should mean cheaper Materials
+ return possibleRecipes
+ .stream()
+ .sorted(Comparator.comparingDouble(x ->
+ {
+ double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs).flatMapToInt(f -> IntStream.of(f.amount)).sum();
+ fluidInputValueRaw = fluidInputValueRaw > 0 ? fluidInputValueRaw : 144D;
+ double inputValue = Arrays.stream(x.inputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() +
+ (fluidInputValueRaw / 144D);
+ double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs).flatMapToInt(f -> IntStream.of(f.amount)).sum();
+ fluidOutputValueRaw = fluidOutputValueRaw > 0 ? fluidOutputValueRaw : 144D;
+ double outputValue = Arrays.stream(x.recipe.mOutputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() +
+ (fluidOutputValueRaw / 144D);
+ return inputValue / outputValue;
+ }
+ )).collect(Collectors.toList());
}
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return //(aIndex == 4 && GT_Utility.areStacksEqual(aStack, new ItemStack(Items.egg))) ||
(super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getTagCompound() != null) && (aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null);
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java
new file mode 100644
index 0000000000..1ac4df6d73
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java
@@ -0,0 +1,98 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
+import gregtech.api.interfaces.IHeatingCoil;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+
+public abstract class GT_MetaTileEntity_AbstractMultiFurnace extends GT_MetaTileEntity_MultiBlockBase {
+
+ private static final int CASING_INDEX = 11;
+
+ protected GT_MetaTileEntity_AbstractMultiFurnace(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ protected GT_MetaTileEntity_AbstractMultiFurnace(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ protected HeatingCoilLevel getInitialHeatLevel(IGregTechTileEntity aBaseMetaTileEntity, int xDir, int zDir) {
+ Block coil = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 1, zDir);
+ if (!(coil instanceof IHeatingCoil))
+ return null;
+ IHeatingCoil heatingCoil = (IHeatingCoil) coil;
+ byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir);
+ return heatingCoil.getCoilHeat(tUsedMeta);
+ }
+
+ protected boolean checkStructure(HeatingCoilLevel heatingCap, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity){
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ if (!checkTopLayer(i, j, xDir, zDir, aBaseMetaTileEntity))
+ return false;
+
+ if (!checkBottomLayer(i, j, xDir, zDir, aBaseMetaTileEntity))
+ return false;
+
+ if (!checkCoils(heatingCap, i, j, xDir, zDir, aBaseMetaTileEntity))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected abstract boolean checkTopLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity);
+ protected abstract boolean checkCoils(HeatingCoilLevel heatingCap, int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity);
+
+ protected boolean checkBottomLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity){
+ if ((xDir + i == 0) && (zDir + j == 0))
+ return true;
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ return true;
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ return true;
+ if (addOutputToMachineList(tTileEntity, CASING_INDEX))
+ return true;
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ return true;
+
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
+ return aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) == CASING_INDEX;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 20;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index 061db80ece..488703d2b5 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -1,42 +1,43 @@
package gregtech.common.tileentities.machines.multi;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.GT_Values.VN;
-
-import java.util.ArrayList;
-
-import org.lwjgl.input.Keyboard;
-
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.input.Keyboard;
+
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.GT_Values.VN;
public class GT_MetaTileEntity_ElectricBlastFurnace
- extends GT_MetaTileEntity_MultiBlockBase {
+ extends GT_MetaTileEntity_AbstractMultiFurnace {
private int mHeatingCapacity = 0;
private int controllerY;
private FluidStack[] pollutionFluidStacks = new FluidStack[]{Materials.CarbonDioxide.getGas(1000),
Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)};
+ private static final int CASING_INDEX = 11;
+
public GT_MetaTileEntity_ElectricBlastFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -45,173 +46,168 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
super(aName);
}
+ @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_ElectricBlastFurnace(this.mName);
}
+ @Override
public String[] getDescription() {
- final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
- tt.addMachineType("Blast Furnace")
- .addInfo("Controller block for the Electric Blast Furnace")
- .addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus")
- .addInfo("Each 900K over the min. Heat required multiplies EU/t by 0.95")
- .addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal")
- .addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%")
- .addInfo("Additionally gives +100K for every tier past MV")
- .addPollutionAmount(20 * getPollutionPerTick(null))
- .addSeparator()
- .beginStructureBlock(3, 4, 3, true)
- .addController("Front bottom")
- .addCasingInfo("Heat Proof Machine Casing", 0)
- .addOtherStructurePart("Heating Coils (any tier)", "Two middle Layers")
- .addEnergyHatch("Any bottom layer casing")
- .addMaintenanceHatch("Any bottom layer casing")
- .addMufflerHatch("Top middle")
- .addInputBus("Any bottom layer casing")
- .addInputHatch("Any bottom layer casing")
- .addOutputBus("Any bottom layer casing")
- .addOutputHatch("Gasses, Any top layer casing")
- .addStructureInfo("Recovery amount scales with Muffler Hatch tier")
- .addOutputHatch("Platline fluids, Any bottom layer casing")
- .toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Blast Furnace")
+ .addInfo("Controller block for the Electric Blast Furnace")
+ .addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus")
+ .addInfo("Each 900K over the min. Heat required multiplies EU/t by 0.95")
+ .addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal")
+ .addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%")
+ .addInfo("Additionally gives +100K for every tier past MV")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, true)
+ .addController("Front bottom")
+ .addCasingInfo("Heat Proof Machine Casing", 0)
+ .addOtherStructurePart("Heating Coils", "Two middle Layers")
+ .addEnergyHatch("Any bottom layer casing")
+ .addMaintenanceHatch("Any bottom layer casing")
+ .addMufflerHatch("Top middle")
+ .addInputBus("Any bottom layer casing")
+ .addInputHatch("Any bottom layer casing")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("Gasses, Any top layer casing")
+ .addStructureInfo("Recovery amount scales with Muffler Hatch tier")
+ .addOutputHatch("Platline fluids, Any bottom layer casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)};
}
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11]};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]};
}
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ElectricBlastFurnace.png");
}
+ @Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
return GT_Recipe.GT_Recipe_Map.sBlastRecipes;
}
+ @Override
public boolean isCorrectMachinePart(ItemStack aStack) {
return true;
}
+ @Override
public boolean isFacingValid(byte aFacing) {
return aFacing > 1;
}
+ @Override
public boolean checkRecipe(ItemStack aStack) {
- ArrayList<ItemStack> tInputList = getStoredInputs();
- int tInputList_sS = tInputList.size();
- for (int i = 0; i < tInputList_sS - 1; i++) {
- for (int j = i + 1; j < tInputList_sS; j++) {
- if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
- if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
- tInputList.remove(j--);
- tInputList_sS = tInputList.size();
- } else {
- tInputList.remove(i--);
- tInputList_sS = tInputList.size();
- break;
- }
- }
- }
- }
- ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
-
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- int tFluidList_sS = tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; i++) {
- for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
- if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
- tFluidList.remove(j--);
- tFluidList_sS = tFluidList.size();
- } else {
- tFluidList.remove(i--);
- tFluidList_sS = tFluidList.size();
- break;
- }
- }
- }
+ ItemStack[] tInputs = getCompactedInputs();
+ FluidStack[] tFluids = getCompactedFluids();
+
+ if (tInputs.length <= 0)
+ return false;
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(
+ getBaseMetaTileEntity(),
+ false,
+ gregtech.api.enums.GT_Values.V[tTier],
+ tFluids,
+ tInputs
+ );
+
+ if (tRecipe == null)
+ return false;
+ if (this.mHeatingCapacity < tRecipe.mSpecialValue)
+ return false;
+ if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
+ return false;
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900;
+ byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
}
- FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
- if (tInputList.size() > 0) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue)/900;
- byte overclockCount=calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage);
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- if(tHeatCapacityDivTiers>0){
- this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
- this.mMaxProgresstime >>=Math.min(tHeatCapacityDivTiers/2,overclockCount);//extra free overclocking if possible
- if(this.mMaxProgresstime<1) this.mMaxProgresstime=1;//no eu efficiency correction
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)};
- this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
- updateSlots();
- return true;
- }
+ if (tHeatCapacityDivTiers > 0) {
+ this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2, overclockCount);//extra free overclocking if possible
+ if (this.mMaxProgresstime < 1)
+ this.mMaxProgresstime = 1;//no eu efficiency correction
}
- return false;
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ this.mOutputItems = new ItemStack[]{
+ tRecipe.getOutput(0),
+ tRecipe.getOutput(1)
+ };
+ this.mOutputFluids = new FluidStack[]{
+ tRecipe.getFluidOutput(0)
+ };
+ updateSlots();
+ return true;
}
/**
* Calcualtes overclocked ness using long integers
- * @param aEUt - recipe EUt
- * @param aDuration - recipe Duration
+ *
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
*/
protected byte calculateOverclockednessEBF(int aEUt, int aDuration, long maxInputVoltage) {
- byte mTier=(byte)Math.max(0,GT_Utility.getTier(maxInputVoltage)), timesOverclocked=0;
- if(mTier==0){
+ byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage)), timesOverclocked = 0;
+ if (mTier == 0) {
//Long time calculation
- long xMaxProgresstime = ((long)aDuration)<<1;
- if(xMaxProgresstime>Integer.MAX_VALUE-1){
+ long xMaxProgresstime = ((long) aDuration) << 1;
+ if (xMaxProgresstime > Integer.MAX_VALUE - 1) {
//make impossible if too long
- mEUt=Integer.MAX_VALUE-1;
- mMaxProgresstime=Integer.MAX_VALUE-1;
- }else{
- mEUt=aEUt>>2;
- mMaxProgresstime=(int)xMaxProgresstime;
+ mEUt = Integer.MAX_VALUE - 1;
+ mMaxProgresstime = Integer.MAX_VALUE - 1;
+ } else {
+ mEUt = aEUt >> 2;
+ mMaxProgresstime = (int) xMaxProgresstime;
}
//return 0;
- }else{
+ } else {
//Long EUt calculation
- long xEUt=aEUt;
+ long xEUt = aEUt;
//Isnt too low EUt check?
- long tempEUt = xEUt<V[1] ? V[1] : xEUt;
+ long tempEUt = Math.max(xEUt, V[1]);
mMaxProgresstime = aDuration;
- while (tempEUt <= V[mTier -1]) {
- tempEUt<<=2;//this actually controls overclocking
+ while (tempEUt <= V[mTier - 1]) {
+ tempEUt <<= 2;//this actually controls overclocking
//xEUt *= 4;//this is effect of everclocking
- mMaxProgresstime>>=1;//this is effect of overclocking
- xEUt = mMaxProgresstime==0 ? xEUt>>1 : xEUt<<2;//U know, if the time is less than 1 tick make the machine use less power
+ mMaxProgresstime >>= 1;//this is effect of overclocking
+ xEUt = mMaxProgresstime == 0 ? xEUt >> 1 : xEUt << 2;//U know, if the time is less than 1 tick make the machine use less power
timesOverclocked++;
}
- if(xEUt>Integer.MAX_VALUE-1){
- mEUt = Integer.MAX_VALUE-1;
- mMaxProgresstime = Integer.MAX_VALUE-1;
- }else{
- mEUt = (int)xEUt;
- if(mEUt==0)
+ if (xEUt > Integer.MAX_VALUE - 1) {
+ mEUt = Integer.MAX_VALUE - 1;
+ mMaxProgresstime = Integer.MAX_VALUE - 1;
+ } else {
+ mEUt = (int) xEUt;
+ if (mEUt == 0)
mEUt = 1;
- if(mMaxProgresstime==0)
+ if (mMaxProgresstime == 0)
mMaxProgresstime = 1;//set time to 1 tick
}
}
@@ -224,171 +220,136 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
this.mHeatingCapacity = 0;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
- return false;
- }
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) {
+
+ replaceDeprecatedCoils(aBaseMetaTileEntity);
+ HeatingCoilLevel heatingCap = getInitialHeatLevel(aBaseMetaTileEntity, xDir, zDir);
+ if (heatingCap == null)
return false;
- }
- if (!addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 11)) {
+
+ if (!checkStructure(heatingCap, xDir, zDir, aBaseMetaTileEntity))
return false;
- }
- replaceDeprecatedCoils(aBaseMetaTileEntity);
- byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir);
- switch (tUsedMeta) {
- case 0:
- this.mHeatingCapacity = 1801;
- break;
- case 1:
- this.mHeatingCapacity = 2701;
- break;
- case 2:
- this.mHeatingCapacity = 3601;
- break;
- case 3:
- this.mHeatingCapacity = 4501;
- break;
- case 4:
- this.mHeatingCapacity = 5401;
- break;
- case 5:
- this.mHeatingCapacity = 7201;
- break;
- case 6:
- this.mHeatingCapacity = 9001;
- break;
- case 7:
- this.mHeatingCapacity = 9901;
- break;
- case 8:
- this.mHeatingCapacity = 10801;
- break;
- default:
- return false;
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((i != 0) || (j != 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != tUsedMeta) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) {
- return false;
- }
- if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 11)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 11) {
- return false;
- }
- }
- }
- }
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((xDir + i != 0) || (zDir + j != 0)) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11)) && (!addEnergyInputToMachineList(tTileEntity, 11))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 11) {
- return false;
- }
- }
- }
- }
- }
+
+ this.mHeatingCapacity = (int) heatingCap.getHeat();
this.mHeatingCapacity += 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2);
return true;
}
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
- boolean result= this.checkMachineFunction(aBaseMetaTileEntity,aStack);
- if (!result) this.mHeatingCapacity=0;
- return result;
- }
+ @Override
+ protected boolean checkTopLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
+ if ((i == 0) && (j == 0)) {
+ return addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), CASING_INDEX);
+ }
+ if (addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), CASING_INDEX))
+ return true;
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
- public int getPollutionPerTick(ItemStack aStack) {
- return 20;
+ return aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) == CASING_INDEX;
}
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
+ @Override
+ protected boolean checkCoils(HeatingCoilLevel heatingCap, int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
+ if ((i == 0) && (j == 0)) {
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir))
+ return false;
+
+ return aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir);
+ }
+
+ Block blockLow = aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j);
+ if (!(blockLow instanceof IHeatingCoil))
+ return false;
+
+ Block blockHi = aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j);
+ if (!(blockHi instanceof IHeatingCoil))
+ return false;
+
+ byte metaLow = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j);
+ HeatingCoilLevel coilHeatLow = ((IHeatingCoil) blockLow).getCoilHeat(metaLow);
+ byte metaHi = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j);
+ HeatingCoilLevel coilHeatHi = ((IHeatingCoil) blockHi).getCoilHeat(metaHi);
+
+ return heatingCap == coilHeatLow && heatingCap == coilHeatHi;
}
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ return this.checkMachineFunction(aBaseMetaTileEntity, aStack);
}
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
int tUsedMeta;
for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
- if ((xPos == tX) && (zPos == tZ)) {
+ if ((xPos == tX) && (zPos == tZ))
continue;
- }
for (int yPos = tY + 1; yPos <= tY + 2; yPos++) {
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos);
- if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1) {
- aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
- }
+ if (tUsedMeta < 12)
+ continue;
+ if (tUsedMeta > 14)
+ continue;
+ if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1)
+ continue;
+
+ aBaseMetaTileEntity.getWorld().setBlock(
+ xPos,
+ yPos,
+ zPos,
+ GregTech_API.sBlockCasings5,
+ tUsedMeta - 12,
+ 3
+ );
}
}
}
}
+
@Override
- public boolean addOutput(FluidStack aLiquid) {
- if (aLiquid == null) return false;
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null)
+ return false;
int targetHeight;
FluidStack tLiquid = aLiquid.copy();
boolean isOutputPollution = false;
for (FluidStack pollutionFluidStack : pollutionFluidStacks) {
- if (tLiquid.isFluidEqual(pollutionFluidStack)) {
- isOutputPollution = true;
- break;
- }
+ if (!tLiquid.isFluidEqual(pollutionFluidStack))
+ continue;
+
+ isOutputPollution = true;
+ break;
}
if (isOutputPollution) {
targetHeight = this.controllerY + 3;
int pollutionReduction = 0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- pollutionReduction = 100 - tHatch.calculatePollutionReduction(100);
- break;
- }
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ pollutionReduction = 100 - tHatch.calculatePollutionReduction(100);
+ break;
}
tLiquid.amount = tLiquid.amount * (pollutionReduction + 5) / 100;
} else {
targetHeight = this.controllerY;
}
for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
- if (tHatch.getBaseMetaTileEntity().getYCoord() == targetHeight) {
- int tAmount = tHatch.fill(tLiquid, false);
- if (tAmount >= tLiquid.amount) {
- return tHatch.fill(tLiquid, true) >= tLiquid.amount;
- } else if (tAmount > 0) {
- tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
- }
- }
+ if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? !tHatch.outputsSteam() : !tHatch.outputsLiquids())
+ continue;
+
+ if (tHatch.getBaseMetaTileEntity().getYCoord() != targetHeight)
+ continue;
+
+ int tAmount = tHatch.fill(tLiquid, false);
+ if (tAmount >= tLiquid.amount) {
+ return tHatch.fill(tLiquid, true) >= tLiquid.amount;
+ } else if (tAmount > 0) {
+ tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
}
}
return false;
@@ -396,37 +357,37 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
@Override
public String[] getInfoData() {
- int mPollutionReduction=0;
+ int mPollutionReduction = 0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
- }
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
}
- long storedEnergy=0;
- long maxEnergy=0;
- for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
+ long storedEnergy = 0;
+ long maxEnergy = 0;
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (!isValidMetaTileEntity(tHatch))
+ continue;
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
}
return new String[]{
- StatCollector.translateToLocal("GT5U.multiblock.Progress")+": " +EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+
- EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s",
- StatCollector.translateToLocal("GT5U.multiblock.energy")+": " +EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
- EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
- StatCollector.translateToLocal("GT5U.multiblock.usage")+": "+EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t",
- StatCollector.translateToLocal("GT5U.multiblock.mei")+": "+EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+" EU/t(*2A) "+StatCollector.translateToLocal("GT5U.machines.tier")+": "+
- EnumChatFormatting.YELLOW+VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET,
- StatCollector.translateToLocal("GT5U.multiblock.problems")+": "+
- EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+
- " "+StatCollector.translateToLocal("GT5U.multiblock.efficiency")+": "+
- EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %",
- StatCollector.translateToLocal("GT5U.EBF.heat")+": "+
- EnumChatFormatting.GREEN+mHeatingCapacity+EnumChatFormatting.RESET+" K",
- StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
+ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " +
+ EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s",
+ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " +
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU",
+ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t",
+ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + Long.toString(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " +
+ EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " +
+ EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET +
+ " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " +
+ EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %",
+ StatCollector.translateToLocal("GT5U.EBF.heat") + ": " +
+ EnumChatFormatting.GREEN + mHeatingCapacity + EnumChatFormatting.RESET + " K",
+ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %"
};
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index 5eca30def1..8b27932511 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
@@ -1,36 +1,39 @@
package gregtech.common.tileentities.machines.multi;
-import static gregtech.api.enums.GT_Values.VN;
-
-import java.util.ArrayList;
-
-import org.lwjgl.input.Keyboard;
-
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
+import org.lwjgl.input.Keyboard;
+
+import java.util.ArrayList;
+
+import static gregtech.api.enums.GT_Values.VN;
public class GT_MetaTileEntity_MultiFurnace
- extends GT_MetaTileEntity_MultiBlockBase {
+ extends GT_MetaTileEntity_AbstractMultiFurnace {
private int mLevel = 0;
private int mCostDiscount = 1;
+ private static final int CASING_INDEX = 11;
+
public GT_MetaTileEntity_MultiFurnace(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -39,10 +42,12 @@ public class GT_MetaTileEntity_MultiFurnace
super(aName);
}
+ @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_MultiFurnace(this.mName);
}
+ @Override
public String[] getDescription() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Furnace")
@@ -54,70 +59,56 @@ public class GT_MetaTileEntity_MultiFurnace
.beginStructureBlock(3, 3, 3, true)
.addController("Front bottom")
.addCasingInfo("Heat Proof Machine Casing", 8)
- .addOtherStructurePart("Heating Coils (any tier)", "Middle layer")
+ .addOtherStructurePart("Heating Coils", "Middle layer")
.addEnergyHatch("Any bottom casing")
.addMaintenanceHatch("Any bottom casing")
.addMufflerHatch("Top Middle")
.addInputBus("Any bottom casing")
.addOutputBus("Any bottom casing")
.toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
+ return tt.getInformation();
+ return tt.getStructureInformation();
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
- }
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11]};
+ if (aSide == aFacing)
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]};
}
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png");
}
+ @Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
return GT_Recipe.GT_Recipe_Map.sFurnaceRecipes;
}
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
+ @Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs();
- if (!tInputList.isEmpty()) {
- int mVolatage=GT_Utility.safeInt(getMaxInputVoltage());
- int tMaxParrallel = 8 * this.mLevel;
- int tCurrenParrallel = 0;
- ItemStack tSmeltStack = tInputList.get(0);
- ItemStack tOutputStack = GT_ModHandler.getSmeltingOutput(tSmeltStack,false,null);
- if (tOutputStack == null)
- return false;
- for (int i = 0;i<tInputList.size();i++)
- {
- ItemStack item = tInputList.get(i);
- if (tSmeltStack.isItemEqual(item))
- {
- if (item.stackSize<(tMaxParrallel-tCurrenParrallel))
- {
- tCurrenParrallel += item.stackSize;
- item.stackSize = 0;
- }
- else
- {
- item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel;
- tCurrenParrallel = tMaxParrallel;
- break;
- }
- }
+ if (tInputList.isEmpty())
+ return false;
+
+ int mVolatage = GT_Utility.safeInt(getMaxInputVoltage());
+ int tMaxParrallel = 8 * this.mLevel;
+ int tCurrenParrallel = 0;
+ ItemStack tSmeltStack = tInputList.get(0);
+ ItemStack tOutputStack = GT_ModHandler.getSmeltingOutput(tSmeltStack,false,null);
+ if (tOutputStack == null)
+ return false;
+ for (ItemStack item : tInputList)
+ if (tSmeltStack.isItemEqual(item)) if (item.stackSize < (tMaxParrallel - tCurrenParrallel)) {
+ tCurrenParrallel += item.stackSize;
+ item.stackSize = 0;
+ } else {
+ item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel;
+ tCurrenParrallel = tMaxParrallel;
+ break;
}
// this.mOutputItems = new ItemStack[8 * this.mLevel];
// for (int i = 0; (i < 256) && (j < this.mOutputItems.length); i++) {
@@ -125,37 +116,33 @@ public class GT_MetaTileEntity_MultiFurnace
// j++;
// }
// }
- tCurrenParrallel *= tOutputStack.stackSize;
- this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1];
- for (int i = 0; i<this.mOutputItems.length;i++)
- {
- ItemStack tNewStack = tOutputStack.copy();
- int size = tCurrenParrallel>64 ? 64 : tCurrenParrallel;
- tNewStack.stackSize = size;
- tCurrenParrallel -= size;
- this.mOutputItems[i] = tNewStack;
- }
+ tCurrenParrallel *= tOutputStack.stackSize;
+ this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1];
+ for (int i = 0; i < this.mOutputItems.length; i++) {
+ ItemStack tNewStack = tOutputStack.copy();
+ int size = Math.min(tCurrenParrallel, 64);
+ tNewStack.stackSize = size;
+ tCurrenParrallel -= size;
+ this.mOutputItems[i] = tNewStack;
+ }
+ if (this.mOutputItems.length > 0) {
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ calculateOverclockedNessMulti(4, 512, 1, mVolatage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
- if (this.mOutputItems != null && this.mOutputItems.length > 0) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- calculateOverclockedNessMulti(4, 512, 1, mVolatage);
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
-
- this.mEUt = GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount,1);
- if (mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- }
- updateSlots();
- return true;
+ this.mEUt = GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount,1);
+ if (mEUt == Integer.MAX_VALUE - 1)
+ return false;
+
+ if (this.mEUt > 0)
+ this.mEUt = (-this.mEUt);
}
- return false;
+ updateSlots();
+ return true;
}
private boolean checkMachineFunction(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
@@ -164,147 +151,82 @@ public class GT_MetaTileEntity_MultiFurnace
this.mLevel = 0;
this.mCostDiscount = 1;
- if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
- return false;
- }
- addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 11);
+
replaceDeprecatedCoils(aBaseMetaTileEntity);
- byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir);
- switch (tUsedMeta) {
- case 0:
- this.mLevel = 1;
- this.mCostDiscount = 1;
- break;
- case 1:
- this.mLevel = 2;
- this.mCostDiscount = 1;
- break;
- case 2:
- this.mLevel = 4;
- this.mCostDiscount = 1;
- break;
- case 3:
- this.mLevel = 8;
- this.mCostDiscount = 1;
- break;
- case 4:
- this.mLevel = 16;
- this.mCostDiscount = 2;
- break;
- case 5:
- this.mLevel = 16;
- this.mCostDiscount = 4;
- break;
- case 6:
- this.mLevel = 16;
- this.mCostDiscount = 8;
- break;
- case 7:
- this.mLevel = 16;
- this.mCostDiscount = 16;
- break;
- case 8:
- this.mLevel = 16;
- this.mCostDiscount = 24;
- break;
- default:
- return false;
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((i != 0) || (j != 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 11) {
- return false;
- }
- }
- }
- }
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((xDir + i != 0) || (zDir + j != 0)) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11)) && (!addEnergyInputToMachineList(tTileEntity, 11))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 11) {
- return false;
- }
- }
- }
- }
- }
+ HeatingCoilLevel heatingCap = getInitialHeatLevel(aBaseMetaTileEntity, xDir, zDir);
+ if (heatingCap == null)
+ return false;
+
+ if (!checkStructure(heatingCap, xDir, zDir, aBaseMetaTileEntity))
+ return false;
+
+ this.mLevel = heatingCap.getLevel();
+ this.mCostDiscount = heatingCap.getCostDiscount();
return true;
}
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
- boolean result= this.checkMachineFunction(aBaseMetaTileEntity,aStack);
- if (!result) this.mLevel=0;
- return result;
- }
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
+ @Override
+ protected boolean checkCoils(HeatingCoilLevel heatingCap, int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
+ if ((i == 0) && (j == 0))
+ return aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir);
+
+ Block coilM = aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j);
+ if (!(coilM instanceof IHeatingCoil))
+ return false;
+ byte usedMetaM = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j);
+
+ IHeatingCoil heatingCoilM = (IHeatingCoil) coilM;
+ HeatingCoilLevel heatingLevelM = heatingCoilM.getCoilHeat(usedMetaM);
- public int getPollutionPerTick(ItemStack aStack) {
- return 20;
+ return heatingLevelM == heatingCap;
}
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
+ @Override
+ protected boolean checkTopLayer(int i, int j, int xDir, int zDir, IGregTechTileEntity aBaseMetaTileEntity) {
+ if ((i == 0) && (j == 0)) {
+ return addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), CASING_INDEX);
+ }
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1)
+ return false;
+ return aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) == CASING_INDEX;
}
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){
+ return this.checkMachineFunction(aBaseMetaTileEntity,aStack);
}
private void replaceDeprecatedCoils(IGregTechTileEntity aBaseMetaTileEntity) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
int tUsedMeta;
- for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
+ for (int xPos = tX - 1; xPos <= tX + 1; xPos++)
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
- if ((xPos == tX) && (zPos == tZ)) {
- continue;
- }
+ if ((xPos == tX) && (zPos == tZ)) continue;
tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, tY + 1, zPos);
- if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1) {
+ if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1)
aBaseMetaTileEntity.getWorld().setBlock(xPos, tY + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3);
- }
}
- }
}
@Override
public String[] getInfoData() {
int mPollutionReduction=0;
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
- }
- }
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches)
+ if (isValidMetaTileEntity(tHatch))
+ mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
long storedEnergy=0;
long maxEnergy=0;
- for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
if (isValidMetaTileEntity(tHatch)) {
- storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
+ storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity();
}
- }
return new String[]{
StatCollector.translateToLocal("GT5U.multiblock.Progress")+": "+
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
index e4ad65e4a4..d0c3f1f8a0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
@@ -1,9 +1,11 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -14,19 +16,24 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
+import org.apache.commons.lang3.mutable.MutableInt;
+import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
-
-import org.lwjgl.input.Keyboard;
+import java.util.BitSet;
public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBase {
private ForgeDirection orientation;
private int controllerX, controllerZ;
+ private static final byte CASING_INDEX = 49;
+ private HeatingCoilLevel heatLevel;
+
public GT_MetaTileEntity_OilCracker(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -35,6 +42,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
super(aName);
}
+ @Override
public String[] getDescription() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Cracker")
@@ -46,7 +54,8 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
.beginStructureBlock(5, 3, 3, true)
.addController("Front center")
.addCasingInfo("Clean Stainless Steel Machine Casing", 18)
- .addOtherStructurePart("2 Rings of 8 Cupronickel Coils", "Each side of the controller")
+ .addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller")
+ .addInfo("Gets 5% energy cost reduction per coil tier")
.addEnergyHatch("Any casing")
.addMaintenanceHatch("Any casing")
.addInputHatch("Steam/Hydrogen, Any middle ring casing")
@@ -54,21 +63,18 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
.addOutputHatch("Any left/right side casing")
.addStructureInfo("Input/Output Hatches must be on opposite sides!")
.toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return tt.getInformation();
+ return tt.getStructureInformation();
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49],
- new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER)};
- }
- return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]};
+ if (aSide == aFacing) return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX],
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]};
}
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OilCrackingUnit.png");
}
@@ -76,13 +82,22 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tInputList = getStoredFluids();
- FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[tInputList.size()]);
+ FluidStack[] tFluidInputs = tInputList.toArray(new FluidStack[0]);
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCrakingRecipes.findRecipe(
- getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidInputs ,new ItemStack[]{mInventory[1]});
- if (tRecipe != null && tRecipe.isRecipeInputEqual(true, tFluidInputs, new ItemStack[]{mInventory[1]})) {
+ getBaseMetaTileEntity(),
+ false,
+ gregtech.api.enums.GT_Values.V[tTier],
+ tFluidInputs ,
+ mInventory[1]
+ );
+
+ if (tRecipe == null)
+ return false;
+
+ if (tRecipe.isRecipeInputEqual(true, tFluidInputs, mInventory[1])) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
this.mEUt = tRecipe.mEUt;
@@ -91,147 +106,153 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
- if (this.mEUt > 0) {
+
+ this.mEUt *= Math.pow(0.95D, this.heatLevel.getTier());
+
+ if (this.mEUt > 0)
this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
return true;
}
return false;
}
+ private boolean coilsNotPresent(IGregTechTileEntity aBaseMetaTileEntity, int x , int y, int z) {
+
+ Block coil = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+
+ if (!(coil instanceof IHeatingCoil))
+ return true;
+
+ IHeatingCoil heatingCoil = (IHeatingCoil) coil;
+ byte meta = aBaseMetaTileEntity.getMetaIDOffset(x, y, z);
+ HeatingCoilLevel heatLevel = heatingCoil.getCoilHeat(meta);
+ if (heatLevel == HeatingCoilLevel.None)
+ return true;
+
+ if (this.heatLevel == HeatingCoilLevel.None)
+ this.heatLevel = heatLevel;
+
+ return this.heatLevel != heatLevel;
+ }
+
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ this.heatLevel = HeatingCoilLevel.None;
this.orientation = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing());
this.controllerX = aBaseMetaTileEntity.getXCoord();
this.controllerZ = aBaseMetaTileEntity.getZCoord();
int xDir = this.orientation.offsetX;
int zDir = this.orientation.offsetZ;
- int amount = 0;
+ MutableInt amount = new MutableInt(0);
replaceDeprecatedCoils(aBaseMetaTileEntity);
- boolean negSideInput = false, negSideOutput = false, posSideInput = false, posSideOutput = false;
- if (xDir != 0) {
- for (int i = -1; i < 2; i++) {// xDirection
- for (int j = -1; j < 2; j++) {// height
- for (int h = -2; h < 3; h++) {
- if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
- if (h == 1 || h == -1) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 0) {
- return false;
- }
- }
- if (h == 2 || h == -2) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
- if (addInputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideInput = true;
- } else {
- posSideInput = true;
- }
- } else if (addOutputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideOutput = true;
- } else {
- posSideOutput = true;
- }
- } else if (!addEnergyInputToMachineList(tTileEntity, 49) && !addMaintenanceToMachineList(tTileEntity, 49)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 1) {
- return false;
- }
- amount++;
- }
- }
- if (h == 0) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, j, h + zDir);
- if ((!addMaintenanceToMachineList(tTileEntity, 49)) && (!addInputToMachineList(tTileEntity, 49))
- && (!addEnergyInputToMachineList(tTileEntity, 49))) {
- if (!((xDir + i) == 0 && j == 0 && (h + zDir) == 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, j, h + zDir) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, j, h + zDir) != 1) {
- return false;
- }
- amount++;
- }
- }
- }
-
- }
- }
- }
- }
- } else {
- for (int i = -1; i < 2; i++) {// zDirection
- for (int j = -1; j < 2; j++) {// height
- for (int h = -2; h < 3; h++) {
- if (!(j == 0 && i == 0 && (h == -1 || h == 0 || h == 1))) {
- if (h == 1 || h == -1) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings5) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 0) {
- return false;
- }
- }
- if (h == 2 || h == -2) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir);
- if (addInputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideInput = true;
- } else {
- posSideInput = true;
- }
- } else if (addOutputToMachineList(tTileEntity, 49)) {
- if (h == -2) {
- negSideOutput = true;
- } else {
- posSideOutput = true;
- }
- } else if (!addEnergyInputToMachineList(tTileEntity, 49) && !addMaintenanceToMachineList(tTileEntity, 49)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 1) {
- return false;
- }
- amount++;
- }
- }
- if (h == 0) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + h, j, i + zDir);
- if ((!addMaintenanceToMachineList(tTileEntity, 49)) && (!addInputToMachineList(tTileEntity, 49))
- && (!addEnergyInputToMachineList(tTileEntity, 49))) {
- if (!((xDir + h) == 0 && j == 0 && (i + zDir) == 0)) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + h, j, i + zDir) != GregTech_API.sBlockCasings4) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + h, j, i + zDir) != 1) {
- return false;
- }
- amount++;
- }
- }
- }
-
- }
+ BitSet flags = new BitSet(4);
+
+ for (int depth = -1; depth < 2; depth++)
+ for (int height = -1; height < 2; height++)
+ for (int slice = -2; slice < 3; slice++)
+ if (xDir != 0) {
+ if (isStructureBroken(xDir, zDir, depth, height, slice, aBaseMetaTileEntity, amount, flags))
+ return false;
+ } else {
+ if (isStructureBroken(xDir, zDir, slice, height, depth, aBaseMetaTileEntity, amount, flags))
+ return false;
}
- }
- }
+
+ if(checkInputOutputBroken(flags))
+ return false;
+
+ return amount.intValue() >= 18;
+ }
+
+ private boolean checkInputOutputBroken(BitSet flags){
+ if (flags.get(0) && flags.get(2)) //input and output on side 1
+ return true;
+ if (flags.get(1) && flags.get(3)) //input and output on side 2
+ return true;
+ if (flags.get(1) && flags.get(2)) //input on both sides
+ return true;
+ return flags.get(2) && flags.get(3); //output on both sides
+ }
+
+ private boolean isStructureBroken(
+ int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ MutableInt amount,
+ BitSet flags) {
+ if (b == 0 && c == 0 && (a == -1 || a == 0 || a == 1))
+ return false;
+ if (a == 1 || a == -1) {
+ return coilsNotPresent(aBaseMetaTileEntity, xDir + a, b, c + zDir);
}
- if ((negSideInput && negSideOutput) || (posSideInput && posSideOutput)
- || (negSideInput && posSideInput) || (negSideOutput && posSideOutput)) {
- return false;
+ else if (a == 2 || a == -2) {
+ return checkEndsBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, amount, flags);
}
- if (amount < 18) return false;
- return true;
+ else if (a == 0)
+ return checkMiddleBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, amount);
+
+ return false;
+ }
+
+ private boolean checkEndsBroken(
+ int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ MutableInt amount,
+ BitSet flags
+ ){
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + c, b, a + zDir);
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ if (a == -2)
+ flags.set(0); //input on side 1
+ else
+ flags.set(1); //input on side 2
+ else if (addOutputToMachineList(tTileEntity, CASING_INDEX))
+ if (a == -2)
+ flags.set(2); //output on side 1
+ else
+ flags.set(3); //output on side 2
+ else if (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ if (!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + c, b, a + zDir) != GregTech_API.sBlockCasings4)
+ return true;
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + c, b, a + zDir) != 1)
+ return true;
+ amount.increment();
+ }
+ return false;
+ }
+
+ private boolean checkMiddleBroken( int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ MutableInt amount){
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + c, b, a + zDir);
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX))
+ return false;
+ if (addInputToMachineList(tTileEntity, CASING_INDEX))
+ return false;
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX))
+ return false;
+ if ((xDir + c) == 0 && b == 0 && (a + zDir) == 0)
+ return false;
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + c, b, a + zDir) != GregTech_API.sBlockCasings4)
+ return true;
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + c, b, a + zDir) != 1)
+ return true;
+ amount.increment();
+ return false;
}
@Override
@@ -259,6 +280,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
return false;
}
+ @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_OilCracker(this.mName);
}
@@ -267,50 +289,52 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir;
- for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2)) {
- for (int yPos = tY - 1; yPos <= tY + 1; yPos++) {
+ for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2))
+ for (int yPos = tY - 1; yPos <= tY + 1; yPos++)
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos += (xDir != 0 ? 2 : 1)) {
- if ((yPos == tY) && (xPos == tX || zPos == tZ)) {
+ if ((yPos == tY) && (xPos == tX || zPos == tZ))
continue;
- }
- if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) == GregTech_API.sBlockCasings1 &&
- aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos) == 12)
- {
- aBaseMetaTileEntity.getWorld().setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, 0, 3);
- }
+ byte tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos);
+ if (tUsedMeta < 12)
+ continue;
+ if (tUsedMeta > 14)
+ continue;
+ if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1)
+ continue;
+
+ aBaseMetaTileEntity.getWorld().setBlock(
+ xPos,
+ yPos,
+ zPos,
+ GregTech_API.sBlockCasings5,
+ tUsedMeta - 12,
+ 3
+ );
}
- }
- }
}
@Override
public ArrayList<FluidStack> getStoredFluids() {
- ArrayList<FluidStack> rList = new ArrayList<FluidStack>();
+ ArrayList<FluidStack> rList = new ArrayList<>();
for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
FluidStack tStack = tHatch.getFillableStack();
if (tStack.isFluidEqual(GT_ModHandler.getSteam(1000)) || tStack.isFluidEqual(Materials.Hydrogen.getGas(1000))) {
- if (isHatchInMiddleRing(tHatch)) {
- rList.add(tStack);
- }
- } else {
- if (!isHatchInMiddleRing(tHatch)) {
+ if (isHatchInMiddleRing(tHatch))
rList.add(tStack);
- }
- }
+ } else if (!isHatchInMiddleRing(tHatch))
+ rList.add(tStack);
}
}
return rList;
}
private boolean isHatchInMiddleRing(GT_MetaTileEntity_Hatch_Input inputHatch){
- if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH) {
+ if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
return inputHatch.getBaseMetaTileEntity().getXCoord() == this.controllerX;
- } else {
- return inputHatch.getBaseMetaTileEntity().getZCoord() == this.controllerZ;
- }
+ return inputHatch.getBaseMetaTileEntity().getZCoord() == this.controllerZ;
}
} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index c2e13a815f..edf652923b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -3,8 +3,10 @@ package gregtech.common.tileentities.machines.multi;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -20,17 +22,14 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
+import org.apache.commons.lang3.mutable.MutableBoolean;
import org.lwjgl.input.Keyboard;
public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
-
- private int coilMetaID;
- //public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa);
- private final int CASING_INDEX = 1090;
+
+ private HeatingCoilLevel coilHeat;
+ //public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa);
+ private static final int CASING_INDEX = 1090;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -40,35 +39,37 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
super(aName);
}
+ @Override
public String[] getDescription() {
- final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
- tt.addMachineType("Coke Oven")
- .addInfo("Controller block for the Pyrolyse Oven")
- .addInfo("Industrial Charcoal producer")
- .addInfo("Processing speed scales linearly with Coil tier:")
- .addInfo("CuNi: 50%, FeAlCr: 100%, Ni4Cr: 150%, Fe50CW: 200%, etc.")
- .addInfo("EU/t is not affected by Coil tier")
- .addPollutionAmount(20 * getPollutionPerTick(null))
- .addSeparator()
- .beginStructureBlock(5, 4, 5, true)
- .addController("Front center")
- .addCasingInfo("Pyrolyse Oven Casing", 60)
- .addOtherStructurePart("Heating Coils (any tier)", "Center 3x1x3 of the bottom layer")
- .addEnergyHatch("Any bottom layer casing")
- .addMaintenanceHatch("Any bottom layer casing")
- .addMufflerHatch("Center 3x1x3 area in top layer")
- .addInputBus("Center 3x1x3 area in top layer")
- .addInputHatch("Center 3x1x3 area in top layer")
- .addOutputBus("Any bottom layer casing")
- .addOutputHatch("Any bottom layer casing")
- .toolTipFinisher("Gregtech");
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return tt.getInformation();
- } else {
- return tt.getStructureInformation();
- }
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Coke Oven")
+ .addInfo("Controller block for the Pyrolyse Oven")
+ .addInfo("Industrial Charcoal producer")
+ .addInfo("Processing speed scales linearly with Coil tier:")
+ .addInfo("CuNi: 50%, FeAlCr: 100%, Ni4Cr: 150%, Fe50CW: 200%, etc.")
+ .addInfo("EU/t is not affected by Coil tier")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(5, 4, 5, true)
+ .addController("Front center")
+ .addCasingInfo("Pyrolyse Oven Casing", 60)
+ .addOtherStructurePart("Heating Coils", "Center 3x1x3 of the bottom layer")
+ .addEnergyHatch("Any bottom layer casing")
+ .addMaintenanceHatch("Any bottom layer casing")
+ .addMufflerHatch("Center 3x1x3 area in top layer")
+ .addInputBus("Center 3x1x3 area in top layer")
+ .addInputHatch("Center 3x1x3 area in top layer")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("Any bottom layer casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
@@ -76,145 +77,103 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]};
}
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "PyrolyseOven.png");
}
@Override
public boolean checkRecipe(ItemStack aStack) {
- ArrayList<ItemStack> tInputList = getStoredInputs();
- int tInputList_sS=tInputList.size();
- for (int i = 0; i < tInputList_sS - 1; i++) {
- for (int j = i + 1; j < tInputList_sS; j++) {
- if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
- if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
- tInputList.remove(j--); tInputList_sS=tInputList.size();
- } else {
- tInputList.remove(i--); tInputList_sS=tInputList.size();
- break;
- }
- }
- }
- }
- ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
-
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- int tFluidList_sS=tFluidList.size();
- for (int i = 0; i < tFluidList_sS - 1; i++) {
- for (int j = i + 1; j < tFluidList_sS; j++) {
- if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
- if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
- tFluidList.remove(j--); tFluidList_sS=tFluidList.size();
- } else {
- tFluidList.remove(i--); tFluidList_sS=tFluidList.size();
- break;
- }
- }
- }
- }
- FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
- if (tInputList.size() > 0) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
-
- //Dynamic recipe adding for newly found logWoods - wont be visible in nei most probably
- if(tRecipe==null){
- for(ItemStack is:tInputs) {
- for (int id : OreDictionary.getOreIDs(is)) {
- if (OreDictionary.getOreName(id).equals("logWood"))
- ProcessingLog.addPyrolyeOvenRecipes(is);
- }
- }
- tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
- }
+ ItemStack[] tInputs = getCompactedInputs();
+ FluidStack[] tFluids = getCompactedFluids();
+
+ if (tInputs.length <= 0)
+ return false;
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+
+ //Dynamic recipe adding for newly found logWoods - wont be visible in nei most probably
+ if (tRecipe == null)
+ tRecipe = addRecipesDynamically(tInputs, tFluids, tTier);
- if (tRecipe != null && tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
+ if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
+ return false;
- calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
+ if (this.mEUt > 0)
+ this.mEUt = (-this.mEUt);
+ this.mMaxProgresstime = Math.max(mMaxProgresstime * 2 / (1 + coilHeat.getTier()), 1);
+ if (tRecipe.mOutputs.length > 0)
+ this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
+ if (tRecipe.mFluidOutputs.length > 0)
+ this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
+ updateSlots();
+ return true;
+ }
+
+ private GT_Recipe addRecipesDynamically(ItemStack[] tInputs, FluidStack[] tFluids, int tTier) {
+ if (tInputs.length > 1 || (tInputs[0] != null && tInputs[0].getItem() != GT_Utility.getIntegratedCircuit(0).getItem())) {
+ int oreId = OreDictionary.getOreID("logWood");
+ for (ItemStack is : tInputs) {
+ for (int id : OreDictionary.getOreIDs(is)) {
+ if (oreId == id) {
+ ProcessingLog.addPyrolyeOvenRecipes(is);
+ return GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
+ }
}
- this.mMaxProgresstime = Math.max(mMaxProgresstime * 2 / (1 + coilMetaID), 1);
- if (tRecipe.mOutputs.length > 0) this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
- if (tRecipe.mFluidOutputs.length > 0)
- this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
- updateSlots();
- return true;
}
}
- return false;
+ return null;
}
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
+ Block casingBlock;
+ int casingMeta;
- Block CasingBlock= Loader.isModLoaded("dreamcraft")? GameRegistry.findBlock("dreamcraft","gt.blockcasingsNH"): GregTech_API.sBlockCasings1;
- int CasingMeta= Loader.isModLoaded("dreamcraft")?2:0;
+ if (Loader.isModLoaded("dreamcraft")) {
+ casingBlock = GameRegistry.findBlock("dreamcraft", "gt.blockcasingsNH");
+ casingMeta = 2;
+ } else {
+ casingBlock = GregTech_API.sBlockCasings1;
+ casingMeta = 0;
+ }
replaceDeprecatedCoils(aBaseMetaTileEntity);
- boolean firstCoil = true;
+ MutableBoolean firstCoil = new MutableBoolean(true);
for (int i = -2; i < 3; i++) {
for (int j = -2; j < 3; j++) {
for (int h = 0; h < 4; h++) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// inner 3x3 without height
- if (h == 0) {// inner floor (Cupronickel or Kanthal coils)
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings5) {
- return false;
- }
- int metaID = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (metaID > 8) {
- return false;
- } else {
- if (firstCoil) {
- this.coilMetaID = metaID;
- firstCoil = false;
- } else if (metaID != this.coilMetaID) {
- return false;
- }
- }
- } else if (h == 3) {// inner ceiling (ulv casings + input + muffler)
- if ((!addInputToMachineList(tTileEntity, CASING_INDEX)) && (!addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
- return false;
- }
- }
- } else {// inside air
- if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) {
- return false;
- }
- }
+ if (checkInnerBroken(
+ xDir, zDir,
+ i, h, j,
+ aBaseMetaTileEntity, tTileEntity,
+ casingBlock, casingMeta,
+ firstCoil
+ )
+ )
+ return false;
} else {// outer 5x5 without height
- if (h == 0) {// outer floor (controller, output, energy, maintainance, rest ulv casings)
- if ((!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) && (!addOutputToMachineList(tTileEntity, CASING_INDEX)) && (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))) {
- if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
- return false;
- }
- }
- }
- } else {// outer above floor (ulv casings)
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != CasingMeta) {
- return false;
- }
- }
+ if (checkOuterBroken(
+ xDir, zDir,
+ i, h, j,
+ aBaseMetaTileEntity, tTileEntity,
+ casingBlock, casingMeta
+ )
+ )
+ return false;
}
}
}
@@ -222,6 +181,112 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return true;
}
+ private boolean checkInnerBroken(int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ IGregTechTileEntity tTileEntity,
+ Block casingBlock,
+ int casingMeta,
+ MutableBoolean firstCoil
+ ) {
+ if (b == 0) {// inner floor (Coils)
+ return areCoilsBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, firstCoil);
+ } else if (b == 3) {// inner ceiling (ulv casings + input + muffler)
+ return checkInnerCeilingBroken(xDir, zDir, a, b, c, aBaseMetaTileEntity, tTileEntity, casingBlock, casingMeta);
+ } else {// inside air
+ return !aBaseMetaTileEntity.getAirOffset(xDir + a, b, zDir + c);
+ }
+ }
+
+ private boolean checkOuterBroken(int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ IGregTechTileEntity tTileEntity,
+ Block casingBlock,
+ int casingMeta) {
+ if (b == 0) {// outer floor (controller, output, energy, maintainance, rest ulv casings)
+ if (checkOuterFloorLoopControl(xDir, zDir, a, c, tTileEntity))
+ return false;
+ }
+ // outer above floor (ulv casings)
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + a, b, zDir + c) != casingBlock) {
+ return true;
+ }
+ return aBaseMetaTileEntity.getMetaIDOffset(xDir + a, b, zDir + c) != casingMeta;
+ }
+
+ private boolean checkOuterFloorLoopControl(int xDir,
+ int zDir,
+ int a,
+ int c,
+ IGregTechTileEntity tTileEntity
+ ) {
+ if (addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) {
+ return true;
+ }
+ if (addOutputToMachineList(tTileEntity, CASING_INDEX)) {
+ return true;
+ }
+
+ if (addEnergyInputToMachineList(tTileEntity, CASING_INDEX)) {
+ return true;
+ }
+
+ return (xDir + a == 0) && (zDir + c == 0);
+ }
+
+ private boolean checkInnerCeilingBroken(int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ IGregTechTileEntity tTileEntity,
+ Block casingBlock,
+ int casingMeta) {
+ if ((addInputToMachineList(tTileEntity, CASING_INDEX)) || (addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
+ return false;
+ }
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + a, b, zDir + c) != casingBlock) {
+ return true;
+ }
+ return aBaseMetaTileEntity.getMetaIDOffset(xDir + a, b, zDir + c) != casingMeta;
+ }
+
+ private boolean areCoilsBroken(int xDir,
+ int zDir,
+ int a,
+ int b,
+ int c,
+ IGregTechTileEntity aBaseMetaTileEntity,
+ MutableBoolean firstCoil
+ ) {
+ Block coil = aBaseMetaTileEntity.getBlockOffset(xDir + a, b, zDir + c);
+
+ if (!(coil instanceof IHeatingCoil))
+ return true;
+
+ int metaID = aBaseMetaTileEntity.getMetaIDOffset(xDir + a, b, zDir + c);
+
+ HeatingCoilLevel coilHeat = ((IHeatingCoil) coil).getCoilHeat(metaID);
+
+ if (coilHeat == HeatingCoilLevel.None) {
+ return true;
+ } else {
+ if (firstCoil.isTrue()) {
+ this.coilHeat = coilHeat;
+ firstCoil.setFalse();
+ } else return coilHeat != this.coilHeat;
+ }
+ return false;
+ }
+
@Override
public boolean isCorrectMachinePart(ItemStack aStack) {
return true;
@@ -247,6 +312,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return false;
}
+ @Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_PyrolyseOven(this.mName);
}
@@ -255,13 +321,12 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tX = aBaseMetaTileEntity.getXCoord() + xDir * 2;
- int tY = (int) aBaseMetaTileEntity.getYCoord();
+ int tY = aBaseMetaTileEntity.getYCoord();
int tZ = aBaseMetaTileEntity.getZCoord() + zDir * 2;
for (int xPos = tX - 1; xPos <= tX + 1; xPos++) {
for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) {
if (aBaseMetaTileEntity.getBlock(xPos, tY, zPos) == GregTech_API.sBlockCasings1 &&
- aBaseMetaTileEntity.getMetaID(xPos, tY, zPos) == 13)
- {
+ aBaseMetaTileEntity.getMetaID(xPos, tY, zPos) == 13) {
aBaseMetaTileEntity.getWorld().setBlock(xPos, tY, zPos, GregTech_API.sBlockCasings5, 1, 3);
}
}
diff --git a/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java
index 217fc718a0..9c6e1099cc 100644
--- a/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java
+++ b/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java
@@ -689,10 +689,10 @@ public class GT_CraftingRecipeLoader implements Runnable {
GT_ModHandler.addCraftingRecipe(GT_ModHandler.getIC2Item("MOXFuel", 1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"UUU", "NNN", "UUU", 'U', OrePrefixes.ingot.get(Materials.Uranium), 'N', OrePrefixes.ingot.get(Materials.Plutonium)});
if (!GregTech_API.mIC2Classic) {
- GT_ModHandler.addCraftingRecipe(ItemList.Uraniumcell_2.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", " ", " ", 'R', ItemList.Uraniumcell_1, 'P', OrePrefixes.plate.get(Materials.Iron)});
- GT_ModHandler.addCraftingRecipe(ItemList.Uraniumcell_4.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", "CPC", "RPR", 'R', ItemList.Uraniumcell_1, 'P', OrePrefixes.plate.get(Materials.Iron), 'C', OrePrefixes.plate.get(Materials.Copper)});
- GT_ModHandler.addCraftingRecipe(ItemList.Moxcell_2.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", " ", " ", 'R', ItemList.Moxcell_1, 'P', OrePrefixes.plate.get(Materials.Iron)});
- GT_ModHandler.addCraftingRecipe(ItemList.Moxcell_4.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", "CPC", "RPR", 'R', ItemList.Moxcell_1, 'P', OrePrefixes.plate.get(Materials.Iron), 'C', OrePrefixes.plate.get(Materials.Copper)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.Uraniumcell_2.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", " ", " ", 'R', ItemList.Uraniumcell_1, 'P', OrePrefixes.plate.get(Materials.Iron)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.Uraniumcell_4.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", "CPC", "RPR", 'R', ItemList.Uraniumcell_1, 'P', OrePrefixes.plate.get(Materials.Iron), 'C', OrePrefixes.plate.get(Materials.Copper)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.Moxcell_2.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", " ", " ", 'R', ItemList.Moxcell_1, 'P', OrePrefixes.plate.get(Materials.Iron)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.Moxcell_4.get(1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", "CPC", "RPR", 'R', ItemList.Moxcell_1, 'P', OrePrefixes.plate.get(Materials.Iron), 'C', OrePrefixes.plate.get(Materials.Copper)});
GT_ModHandler.removeRecipeByOutput(Ic2Items.miningLaser.copy());//TODO --- CHECK LASER RECIPES
GT_ModHandler.addCraftingRecipe(Ic2Items.miningLaser.copy(), new Object[]{"PPP", "GEC", "SBd", 'P', OrePrefixes.plate.get(Materials.Titanium), 'G', OrePrefixes.gemExquisite.get(Materials.Diamond), 'E', ItemList.Emitter_HV, 'C', OrePrefixes.circuit.get(Materials.Elite), 'S', OrePrefixes.screw.get(Materials.Titanium), 'B', new ItemStack(Ic2Items.chargingEnergyCrystal.copy().getItem(), 1, GT_Values.W)});
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
index a2fe30ff05..fd4b622639 100644
--- a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
+++ b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
@@ -129,8 +129,8 @@ public class GT_Loader_Item_Block_And_Fluid
ItemList.ThoriumCell_2.set(new GT_RadioactiveCellIC_Item("Double_Thoriumcell", "Dual Fuel Rod (Thorium)", 2, 50000, 0.4F, 0, 0.25F, ItemList.Depleted_Thorium_2.get(1, new Object[0]), false));
ItemList.ThoriumCell_4.set(new GT_RadioactiveCellIC_Item("Quad_Thoriumcell", "Quad Fuel Rod (Thorium)", 4, 50000, 0.4F, 0, 0.25F, ItemList.Depleted_Thorium_4.get(1, new Object[0]), false));
- GT_ModHandler.addCraftingRecipe(ItemList.ThoriumCell_2.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", " ", " ", 'R', ItemList.ThoriumCell_1, 'P', OrePrefixes.plate.get(Materials.Iron)});
- GT_ModHandler.addCraftingRecipe(ItemList.ThoriumCell_4.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", "CPC", "RPR", 'R', ItemList.ThoriumCell_1, 'P', OrePrefixes.plate.get(Materials.Iron), 'C', OrePrefixes.plate.get(Materials.Copper)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.ThoriumCell_2.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", " ", " ", 'R', ItemList.ThoriumCell_1, 'P', OrePrefixes.plate.get(Materials.Iron)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.ThoriumCell_4.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"RPR", "CPC", "RPR", 'R', ItemList.ThoriumCell_1, 'P', OrePrefixes.plate.get(Materials.Iron), 'C', OrePrefixes.plate.get(Materials.Copper)});
GT_ModHandler.addThermalCentrifugeRecipe(ItemList.Depleted_Thorium_1.get(1, new Object[0]), 5000, new Object[]{GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Lutetium, 2L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Thorium, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Iron, 1L)});
GT_ModHandler.addThermalCentrifugeRecipe(ItemList.Depleted_Thorium_2.get(1, new Object[0]), 5000, new Object[]{GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lutetium, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Thorium, 2L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Iron, 3L)});