aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorPrometheus0000 <prometheus0000000@gmail.com>2021-01-04 09:38:25 -0500
committerGitHub <noreply@github.com>2021-01-04 09:38:25 -0500
commitaf189671431ddb4d126e6800ec810c2c7e846b24 (patch)
tree6d3ce9cb5165e52c055f12741f6791ef5fce7c22 /src/main/java/gregtech/common
parent03a3c907ea8858ccc77581268cd5107a22243829 (diff)
parent4f0e72c4c76a9454809f07f10ee0ad242f911b87 (diff)
downloadGT5-Unofficial-af189671431ddb4d126e6800ec810c2c7e846b24.tar.gz
GT5-Unofficial-af189671431ddb4d126e6800ec810c2c7e846b24.tar.bz2
GT5-Unofficial-af189671431ddb4d126e6800ec810c2c7e846b24.zip
Merge pull request #19 from GTNewHorizons/experimental
update
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GT_Client.java22
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings1.java5
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings2.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings3.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings4.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings5.java73
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings6.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings8.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Concretes.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Granites.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Machines.java4
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings1.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings2.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings3.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings4.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings5.java42
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings6.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings8.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java4
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Concretes.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Granites.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java36
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java9
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Ores.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Material_Casings.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Material_Machines.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java3
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Packet_Ores.java3
-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_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/GT_MetaTileEntity_BasicHull_Steel.java3
-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/basic/GT_MetaTileEntity_Pump.java180
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java255
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java110
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java183
-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/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java3
45 files changed, 2054 insertions, 1014 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index e528323da4..83591b322a 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -16,7 +16,6 @@ import gregtech.api.enums.Materials;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.ITurnable;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
-import gregtech.api.metatileentity.BaseTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_PlayedSound;
@@ -24,7 +23,14 @@ import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.entities.GT_Entity_Arrow;
import gregtech.common.entities.GT_Entity_Arrow_Potion;
-import gregtech.common.render.*;
+import gregtech.common.render.GT_CapeRenderer;
+import gregtech.common.render.GT_FlaskRenderer;
+import gregtech.common.render.GT_FluidDisplayStackRenderer;
+import gregtech.common.render.GT_MetaGenerated_Item_Renderer;
+import gregtech.common.render.GT_MetaGenerated_Tool_Renderer;
+import gregtech.common.render.GT_PollutionRenderer;
+import gregtech.common.render.GT_Renderer_Block;
+import gregtech.common.render.GT_Renderer_Entity_Arrow;
import ic2.api.tile.IWrenchable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -40,7 +46,13 @@ import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
// Referenced classes of package gregtech.common:
// GT_Proxy
@@ -315,8 +327,10 @@ public class GT_Client extends GT_Proxy
do {
if (i >= GregTech_API.METATILEENTITIES.length)
continue label0;
- if (GregTech_API.METATILEENTITIES[i] != null)
+ if (GregTech_API.METATILEENTITIES[i] != null) {
GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true);
+ GT_Log.out.println("META " + i + " " + GregTech_API.METATILEENTITIES[i].getMetaName());
+ }
i++;
} while (true);
} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java
index eb7c399eb0..1fa508f25f 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java
@@ -8,8 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
-public class GT_Block_Casings1
- extends GT_Block_Casings_Abstract {
+public class GT_Block_Casings1 extends GT_Block_Casings_Abstract {
/**
* Texture Index Information
@@ -28,7 +27,7 @@ public class GT_Block_Casings1
public GT_Block_Casings1() {
super(GT_Item_Casings1.class, "gt.blockcasings", GT_Material_Casings.INSTANCE);
- for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ for (int i = 0; i < 16; i = i+1) {
Textures.BlockIcons.casingTexturePages[0][i] = new GT_CopiedBlockTexture(this, 6, i);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java
index 6da2195921..56a838ecf7 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java
@@ -12,8 +12,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
-public class GT_Block_Casings2
- extends GT_Block_Casings_Abstract {
+public class GT_Block_Casings2 extends GT_Block_Casings_Abstract {
public GT_Block_Casings2() {
super(GT_Item_Casings2.class, "gt.blockcasings2", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java
index fde793522a..918d131d58 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java
@@ -7,8 +7,7 @@ import gregtech.api.util.GT_LanguageManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class GT_Block_Casings3
- extends GT_Block_Casings_Abstract {
+public class GT_Block_Casings3 extends GT_Block_Casings_Abstract {
public GT_Block_Casings3() {
super(GT_Item_Casings3.class, "gt.blockcasings3", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java
index 0dbf5e9f54..66ca1341d4 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java
@@ -14,8 +14,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
-public class GT_Block_Casings4
- extends GT_Block_Casings_Abstract {
+public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
public static boolean mConnectedMachineTextures = true;
public GT_Block_Casings4() {
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 55492c961c..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,16 +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 gregtech.api.util.GT_Utility;
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)) {
@@ -26,6 +31,8 @@ public class GT_Block_Casings5
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));
@@ -36,7 +43,10 @@ public class GT_Block_Casings5
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) {
@@ -59,7 +69,62 @@ public class GT_Block_Casings5
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_Block_Casings6.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java
index d7e8ad23f0..47c9952227 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java
@@ -10,8 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
-public class GT_Block_Casings6
- extends GT_Block_Casings_Abstract {
+public class GT_Block_Casings6 extends GT_Block_Casings_Abstract {
public GT_Block_Casings6() {
super(GT_Item_Casings6.class, "gt.blockcasings6", GT_Material_Casings.INSTANCE);
for (int i = 0; i < 16; i = (i + 1)) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
index 0f3aac4518..376bc62db9 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
@@ -9,8 +9,7 @@ import gregtech.api.util.GT_LanguageManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class GT_Block_Casings8
- extends GT_Block_Casings_Abstract {
+public class GT_Block_Casings8 extends GT_Block_Casings_Abstract {
//WATCH OUT FOR TEXTURE ID's
public GT_Block_Casings8() {
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java
index 830a407777..1fe744525c 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java
@@ -22,8 +22,7 @@ import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
-public abstract class GT_Block_Casings_Abstract
- extends GT_Generic_Block {
+public abstract class GT_Block_Casings_Abstract extends GT_Generic_Block {
public GT_Block_Casings_Abstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) {
super(aItemClass, aName, aMaterial);
setStepSound(soundTypeMetal);
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java
index 7bd4398ed7..0c24227ad3 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Concretes.java
@@ -11,8 +11,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
-public class GT_Block_Concretes
- extends GT_Block_Stones_Abstract implements IBlockOnWalkOver{
+public class GT_Block_Concretes extends GT_Block_Stones_Abstract implements IBlockOnWalkOver{
public GT_Block_Concretes() {
super(GT_Item_Concretes.class, "gt.blockconcretes");
setResistance(20.0F);
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Granites.java b/src/main/java/gregtech/common/blocks/GT_Block_Granites.java
index 39d68ce933..8f4184ad13 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Granites.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Granites.java
@@ -12,8 +12,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class GT_Block_Granites
- extends GT_Block_Stones_Abstract {
+public class GT_Block_Granites extends GT_Block_Stones_Abstract {
public GT_Block_Granites() {
super(GT_Item_Granites.class, "gt.blockgranites");
setResistance(60.0F);
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
index 0b0d065789..993f9baf38 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
@@ -44,9 +44,7 @@ import java.util.List;
import static gregtech.GT_Mod.GT_FML_LOGGER;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
-public class GT_Block_Machines
- extends GT_Generic_Block
- implements IDebugableBlock, ITileEntityProvider {
+public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider {
public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal();
public GT_Block_Machines() {
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java
index 680942d9fd..bcb50b2176 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings1.java
@@ -9,8 +9,7 @@ import net.minecraft.util.EnumChatFormatting;
import java.util.List;
-public class GT_Item_Casings1
- extends GT_Item_Casings_Abstract {
+public class GT_Item_Casings1 extends GT_Item_Casings_Abstract {
public GT_Item_Casings1(Block par1) {
super(par1);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java
index 1d069d94f7..103b8a9ed5 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings2.java
@@ -6,8 +6,7 @@ import net.minecraft.item.ItemStack;
import java.util.List;
-public class GT_Item_Casings2
- extends GT_Item_Casings_Abstract {
+public class GT_Item_Casings2 extends GT_Item_Casings_Abstract {
public GT_Item_Casings2(Block par1) {
super(par1);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings3.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings3.java
index 5ecf0a9da6..b9eac8252a 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings3.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings3.java
@@ -2,8 +2,7 @@ package gregtech.common.blocks;
import net.minecraft.block.Block;
-public class GT_Item_Casings3
- extends GT_Item_Casings_Abstract {
+public class GT_Item_Casings3 extends GT_Item_Casings_Abstract {
public GT_Item_Casings3(Block par1) {
super(par1);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings4.java
index 05da650a51..10b39e3ea8 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings4.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings4.java
@@ -2,8 +2,7 @@ package gregtech.common.blocks;
import net.minecraft.block.Block;
-public class GT_Item_Casings4
- extends GT_Item_Casings_Abstract {
+public class GT_Item_Casings4 extends GT_Item_Casings_Abstract {
public GT_Item_Casings4(Block par1) {
super(par1);
}
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 759fcafb5e..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,48 +2,30 @@ 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;
import java.util.List;
-public class GT_Item_Casings5
- extends GT_Item_Casings_Abstract {
+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_Casings6.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings6.java
index f29e907827..6defb752bb 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings6.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings6.java
@@ -2,8 +2,7 @@ package gregtech.common.blocks;
import net.minecraft.block.Block;
-public class GT_Item_Casings6
- extends GT_Item_Casings_Abstract {
+public class GT_Item_Casings6 extends GT_Item_Casings_Abstract {
public GT_Item_Casings6(Block par1) {
super(par1);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java
index f1609ef684..19ca06d5ac 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java
@@ -2,8 +2,7 @@ package gregtech.common.blocks;
import net.minecraft.block.Block;
-public class GT_Item_Casings8
- extends GT_Item_Casings_Abstract {
+public class GT_Item_Casings8 extends GT_Item_Casings_Abstract {
public GT_Item_Casings8(Block par1) {
super(par1);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java
index 1ca55d499f..ebf4afa751 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings_Abstract.java
@@ -9,8 +9,7 @@ import net.minecraft.item.ItemStack;
import java.util.List;
-public abstract class GT_Item_Casings_Abstract
- extends ItemBlock {
+public abstract class GT_Item_Casings_Abstract extends ItemBlock {
protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block");
protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!");
protected final String mCoil01Tooltip = GT_LanguageManager.addStringLocalization("gt.coil01tooltip", "Base Heating Capacity = 1800 Kelvin");
@@ -25,6 +24,7 @@ public abstract class GT_Item_Casings_Abstract
protected final String mCoilOverheated1Tooltip = GT_LanguageManager.addStringLocalization("gt.coil.overheated1.tooltip", "These coils are deprecated");
protected final String mCoilOverheated2Tooltip = GT_LanguageManager.addStringLocalization("gt.coil.overheated2.tooltip", "Place in crafting grid to get regular coils");
protected final String mBlastProofTooltip = GT_LanguageManager.addStringLocalization("gt.blastprooftooltip", "This Block is Blast Proof");
+
public GT_Item_Casings_Abstract(Block par1) {
super(par1);
setMaxDamage(0);
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java b/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java
index 22a732a507..8c26438d71 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Concretes.java
@@ -7,8 +7,7 @@ import net.minecraft.item.ItemStack;
import java.util.List;
-public class GT_Item_Concretes
- extends GT_Item_Stones_Abstract {
+public class GT_Item_Concretes extends GT_Item_Stones_Abstract {
private final String mRunFasterToolTip = GT_LanguageManager.addStringLocalization("gt.runfastertooltip", "You can walk faster on this Block");
public GT_Item_Concretes(Block par1) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Granites.java b/src/main/java/gregtech/common/blocks/GT_Item_Granites.java
index 71faf3b759..d14474c17f 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Granites.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Granites.java
@@ -2,8 +2,7 @@ package gregtech.common.blocks;
import net.minecraft.block.Block;
-public class GT_Item_Granites
- extends GT_Item_Stones_Abstract {
+public class GT_Item_Granites extends GT_Item_Stones_Abstract {
public GT_Item_Granites(Block par1) {
super(par1);
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java b/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java
new file mode 100644
index 0000000000..2b177eee9e
--- /dev/null
+++ b/src/main/java/gregtech/common/blocks/GT_Item_LongDistancePipe.java
@@ -0,0 +1,36 @@
+package gregtech.common.blocks;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+public class GT_Item_LongDistancePipe extends ItemBlock {
+ protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block");
+ protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!");
+
+ public GT_Item_LongDistancePipe(Block par1) {
+ super(par1);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
+ }
+
+ public int getMetadata(int aMeta) {
+ return aMeta;
+ }
+
+ public String getUnlocalizedName(ItemStack aStack) {
+ return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
+ }
+
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ aList.add(this.mNoMobsToolTip);
+ aList.add(this.mNoTileEntityToolTip);
+ }
+}
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 bf6b12b5cd..917f31f9ce 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -23,8 +23,7 @@ import net.minecraft.world.World;
import java.util.List;
-public class GT_Item_Machines
- extends ItemBlock {
+public class GT_Item_Machines extends ItemBlock {
private static final String[] directionNames = {"Bottom", "Top", "North", "South", "West", "East"};
@@ -65,10 +64,12 @@ public class GT_Item_Machines
}
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/blocks/GT_Item_Ores.java b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java
index 8d53cfe513..085334fcb5 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java
@@ -8,8 +8,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class GT_Item_Ores
- extends ItemBlock {
+public class GT_Item_Ores extends ItemBlock {
public GT_Item_Ores(Block par1) {
super(par1);
setMaxDamage(0);
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java
index 6e42569e6f..e0c0454be7 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Stones_Abstract.java
@@ -9,8 +9,7 @@ import net.minecraft.item.ItemStack;
import java.util.List;
-public class GT_Item_Stones_Abstract
- extends ItemBlock {
+public class GT_Item_Stones_Abstract extends ItemBlock {
private final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block");
public GT_Item_Stones_Abstract(Block par1) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Material_Casings.java b/src/main/java/gregtech/common/blocks/GT_Material_Casings.java
index c81f382f5d..6290f19ee1 100644
--- a/src/main/java/gregtech/common/blocks/GT_Material_Casings.java
+++ b/src/main/java/gregtech/common/blocks/GT_Material_Casings.java
@@ -3,8 +3,7 @@ package gregtech.common.blocks;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
-public class GT_Material_Casings
- extends Material {
+public class GT_Material_Casings extends Material {
public static final Material INSTANCE = new GT_Material_Casings();
private GT_Material_Casings() {
diff --git a/src/main/java/gregtech/common/blocks/GT_Material_Machines.java b/src/main/java/gregtech/common/blocks/GT_Material_Machines.java
index e55720f9fa..8de7421dc4 100644
--- a/src/main/java/gregtech/common/blocks/GT_Material_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Material_Machines.java
@@ -3,8 +3,7 @@ package gregtech.common.blocks;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
-public class GT_Material_Machines
- extends Material {
+public class GT_Material_Machines extends Material {
public GT_Material_Machines() {
super(MapColor.ironColor);
setRequiresTool();
diff --git a/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java
index 4aa9ba6931..d423dfda62 100644
--- a/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java
+++ b/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java
@@ -3,8 +3,7 @@ package gregtech.common.blocks;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
-public class GT_Material_Reinforced
- extends Material {
+public class GT_Material_Reinforced extends Material {
public GT_Material_Reinforced() {
super(MapColor.stoneColor);
setRequiresTool();
diff --git a/src/main/java/gregtech/common/blocks/GT_Packet_Ores.java b/src/main/java/gregtech/common/blocks/GT_Packet_Ores.java
index b026e60dac..4889c87dad 100644
--- a/src/main/java/gregtech/common/blocks/GT_Packet_Ores.java
+++ b/src/main/java/gregtech/common/blocks/GT_Packet_Ores.java
@@ -8,8 +8,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class GT_Packet_Ores
- extends GT_Packet {
+public class GT_Packet_Ores extends GT_Packet {
private int mX;
private int mZ;
private short mY;
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_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/GT_MetaTileEntity_BasicHull_Steel.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java
index f697b75f0f..d7671e860c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java
@@ -8,8 +8,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric;
import gregtech.api.objects.GT_RenderedTexture;
-public class GT_MetaTileEntity_BasicHull_Steel
- extends GT_MetaTileEntity_BasicHull_NonElectric {
+public class GT_MetaTileEntity_BasicHull_Steel extends GT_MetaTileEntity_BasicHull_NonElectric {
public GT_MetaTileEntity_BasicHull_Steel(int aID, String aName, String aNameRegional, int aTier, String aDescription) {
super(aID, aName, aNameRegional, aTier, aDescription);
}
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/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index 0e8fe9e5b2..0eb4092e26 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -29,7 +29,6 @@ import net.minecraftforge.fluids.IFluidHandler;
import java.util.*;
-import static gregtech.api.enums.GT_Values.D1;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.enums.GT_Values.debugBlockPump;
@@ -54,13 +53,16 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
public Block mSecondaryPumpedBlock = null;
private int radiusConfig; //Pump configured radius
+ private boolean mRetractDone = false;
public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 3,
new String[]{"The best way to empty Oceans! Outputs on top",
getEuUsagePerTier(aTier) + " EU/operation, " + GT_Utility.safeInt(160 / 20 / (long)Math.pow(2, aTier) ) + " sec per bucket, no stuttering",
"Maximum pumping area: " + (getMaxDistanceForTier( aTier) * 2 + 1) + "x" + (getMaxDistanceForTier( aTier) * 2 + 1),
- "Use Screwdriver to regulate pumping area"});
+ "Use Screwdriver to regulate pumping area",
+ "Disable itself upon hitting rocks",
+ "Disable the bottom pump to retract the pipe!"});
radiusConfig = getMaxDistanceForTier(mTier);
}
@@ -205,86 +207,124 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
if (this.mPumpCountBelow <= 0) {
// Only the bottom most pump does anything
- if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().isUniversalEnergyStored(this.getEuUsagePerAction()))
- && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) {
- boolean tMovedOneDown = false;
- if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) {
- if (!this.wasPumping){
- tMovedOneDown = moveOneDown();
- if (debugBlockPump) {
- GT_Log.out.println("PUMP: Moved down");
+ if (getBaseMetaTileEntity().isAllowedToWork()) {
+ mRetractDone = false;
+ if ((getBaseMetaTileEntity().isUniversalEnergyStored(this.getEuUsagePerAction())) && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) {
+ boolean tMovedOneDown = false;
+ if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) {
+ if (!this.wasPumping) {
+ tMovedOneDown = moveOneDown();
+ if (!tMovedOneDown) {
+ getBaseMetaTileEntity().disableWorking();
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks");
+ }
+ } else if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Moved down");
+ }
+ } else if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Was pumping, didn't move down");
}
- } else if (debugBlockPump) {
- GT_Log.out.println("PUMP: Was pumping, didn't move down");
}
- }
- int x = getBaseMetaTileEntity().getXCoord(), z = getBaseMetaTileEntity().getZCoord();
+ int x = getBaseMetaTileEntity().getXCoord(), z = getBaseMetaTileEntity().getZCoord();
- if (!this.hasValidFluid()) {
- // We don't have a valid block, let's try to find one
- int y = getYOfPumpHead();
-
- if (debugBlockPump && this.mPrimaryPumpedBlock != null) {
- GT_Log.out.println("PUMP: Had an invalid pump block. Trying to find a fluid at Y: " + y +
- " Previous blocks 1: " + this.mPrimaryPumpedBlock + " 2: " + this.mSecondaryPumpedBlock);
- }
- // First look down
- checkForFluidToPump(x, y - 1, z );
-
- // Then look all around
- checkForFluidToPump(x, y, z + 1);
- checkForFluidToPump(x, y, z - 1);
- checkForFluidToPump(x + 1, y, z );
- checkForFluidToPump(x - 1, y, z );
- this.clearQueue(false);
-
- if(this.hasValidFluid()) {
- // Don't move down and rebuild the queue if we now have a valid fluid
- this.wasPumping = true;
- }
+ if (!this.hasValidFluid()) {
+ // We don't have a valid block, let's try to find one
+ int y = getYOfPumpHead();
- } else if (getYOfPumpHead() < getBaseMetaTileEntity().getYCoord()) {
- // We didn't just look for a block, and the pump head is below the pump
- if ((tMovedOneDown) || this.wasPumping ||
- ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) ||
- (getBaseMetaTileEntity().getTimer() % 72000L == 100L))
- {
- // Rebuild the list to pump if any of the following conditions are true:
- // 1) We just moved down
- // 2) We were previously pumping (and possibly just reloaded)
- // 3) We have an empty queue and enough time has passed
- // 4) A long while has has passed
- if (debugBlockPump) {
- GT_Log.out.println("PUMP: Rebuilding pump list - Size " +
- this.mPumpList.size() + " WasPumping: " + this.wasPumping + " Timer " + getBaseMetaTileEntity().getTimer());
+ if (debugBlockPump && this.mPrimaryPumpedBlock != null) {
+ GT_Log.out.println("PUMP: Had an invalid pump block. Trying to find a fluid at Y: " + y +
+ " Previous blocks 1: " + this.mPrimaryPumpedBlock + " 2: " + this.mSecondaryPumpedBlock);
+ }
+ // First look down
+ checkForFluidToPump(x, y - 1, z);
+
+ // Then look all around
+ checkForFluidToPump(x, y, z + 1);
+ checkForFluidToPump(x, y, z - 1);
+ checkForFluidToPump(x + 1, y, z);
+ checkForFluidToPump(x - 1, y, z);
+ this.clearQueue(false);
+
+ if (this.hasValidFluid()) {
+ // Don't move down and rebuild the queue if we now have a valid fluid
+ this.wasPumping = true;
}
- int yPump = getBaseMetaTileEntity().getYCoord() - 1, yHead = getYOfPumpHead();
- this.rebuildPumpQueue(x, yPump, z, yHead);
+ } else if (getYOfPumpHead() < getBaseMetaTileEntity().getYCoord()) {
+ // We didn't just look for a block, and the pump head is below the pump
+ if ((tMovedOneDown) || this.wasPumping ||
+ ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) ||
+ (getBaseMetaTileEntity().getTimer() % 72000L == 100L))
+ {
+ // Rebuild the list to pump if any of the following conditions are true:
+ // 1) We just moved down
+ // 2) We were previously pumping (and possibly just reloaded)
+ // 3) We have an empty queue and enough time has passed
+ // 4) A long while has has passed
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Rebuilding pump list - Size " +
+ this.mPumpList.size() + " WasPumping: " + this.wasPumping + " Timer " + getBaseMetaTileEntity().getTimer());
+ }
+ int yPump = getBaseMetaTileEntity().getYCoord() - 1, yHead = getYOfPumpHead();
- if (debugBlockPump) {
- GT_Log.out.println("PUMP: Rebuilt pump list - Size " + this.mPumpList.size());
- }
+ this.rebuildPumpQueue(x, yPump, z, yHead);
- }
- if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) {
- while ((!this.mPumpList.isEmpty())) {
- ChunkPosition pos = this.mPumpList.pollLast();
- if (consumeFluid(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ)) {
- // Keep trying until we consume something, or the list is empty
- break;
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Rebuilt pump list - Size " + this.mPumpList.size());
}
+
+ }
+ if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) {
+ while ((!this.mPumpList.isEmpty())) {
+ ChunkPosition pos = this.mPumpList.pollLast();
+ if (consumeFluid(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ)) {
+ // Keep trying until we consume something, or the list is empty
+ break;
+ }
+ }
+ this.mPumpTimer = GT_Utility.safeInt(160 / (long) Math.pow(2, this.mTier));
+ this.mPumpTimer = mPumpTimer == 0 ? 1 : mPumpTimer;
+ }
+ } else {
+ // We somehow have a valid fluid, but the head of the pump isn't below the pump. Perhaps someone broke some pipes
+ // -- Clear the queue and we should try to move down until we can find a valid fluid
+ this.clearQueue(false);
+ }
+ } else if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Not enough energy? Free space?");
+ }
+ } else {
+ if (!mRetractDone && ((aTick % 5) == 0) && ((this.mInventory[0] == null) || this.mInventory[0].stackSize == 0 || (GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE) && (this.mInventory[0].stackSize < this.mInventory[0].getMaxStackSize())))) {
+ // try retract if all of these conditions are met
+ // 1. not retracted yet
+ // 2. once per 5 tick
+ // 3. can hold retracted pipe in inventory
+ int tHeadY = getYOfPumpHead();
+ if (tHeadY < this.getBaseMetaTileEntity().getYCoord()) {
+ final int tXCoord = this.getBaseMetaTileEntity().getXCoord();
+ final int tZCoord = this.getBaseMetaTileEntity().getZCoord();
+ this.getBaseMetaTileEntity().getWorld().setBlockToAir(tXCoord, tHeadY, tZCoord);
+ if (tHeadY < this.getBaseMetaTileEntity().getYCoord() - 1) {
+ getBaseMetaTileEntity().getWorld().setBlock(tXCoord, tHeadY + 1, tZCoord, MINING_PIPE_TIP_BLOCK);
+ }
+ if (this.mInventory[0] == null) {
+ final ItemStack copy = MINING_PIPE.copy();
+ copy.stackSize = 1;
+ this.setInventorySlotContents(0, copy);
+ } else {
+ this.mInventory[0].stackSize++;
+ }
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Retracted one pipe");
+ }
+ } else {
+ mRetractDone = true;
+ if (debugBlockPump) {
+ GT_Log.out.println("PUMP: Retract done");
}
- this.mPumpTimer = GT_Utility.safeInt(160 / (long)Math.pow(2, this.mTier) );
- this.mPumpTimer = mPumpTimer==0 ? 1 : mPumpTimer;
}
- } else {
- // We somehow have a valid fluid, but the head of the pump isn't below the pump. Perhaps someone broke some pipes
- // -- Clear the queue and we should try to move down until we can find a valid fluid
- this.clearQueue(false);
}
- } else if (debugBlockPump) {
- GT_Log.out.println("PUMP: Disable? Not enough energy? Free space?");
}
getBaseMetaTileEntity().setActive(!this.mPumpList.isEmpty());
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java
new file mode 100644
index 0000000000..faf27ca0f1
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java
@@ -0,0 +1,255 @@
+/**
+ *
+ * Inspired/ported from GregTech 6 under the LGPL license
+ *
+ * Copyright (c) 2020 GregTech-6 Team
+ *
+ * This file is part of GregTech.
+ *
+ * GregTech is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GregTech is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GregTech. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package gregtech.common.tileentities.machines.long_distance;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_Block_LongDistancePipe;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Queue;
+
+public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_MetaTileEntity_BasicHull_NonElectric {
+ protected GT_MetaTileEntity_LongDistancePipelineBase mTarget = null, mSender = null;
+ protected ChunkCoordinates mTargetPos = null;
+
+ public GT_MetaTileEntity_LongDistancePipelineBase(int aID, String aName, String aNameRegional, int aTier, String aDescription) {
+ super(aID, aName, aNameRegional, aTier, aDescription);
+ }
+
+ public GT_MetaTileEntity_LongDistancePipelineBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ if (mTargetPos != null && mTarget != this) {
+ aNBT.setBoolean("target", true);
+ aNBT.setInteger("target.x", mTargetPos.posX);
+ aNBT.setInteger("target.y", mTargetPos.posY);
+ aNBT.setInteger("target.z", mTargetPos.posZ);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ if (aNBT.hasKey("target")) {
+ mTargetPos = new ChunkCoordinates(
+ aNBT.getInteger("target.x"),
+ aNBT.getInteger("target.y"),
+ aNBT.getInteger("target.z")
+ );
+ }
+ }
+
+ public boolean isSameClass(GT_MetaTileEntity_LongDistancePipelineBase other) {
+ return false;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (tCurrentItem != null) {
+ if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) {
+ scanPipes();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isDead() {
+ return getBaseMetaTileEntity() == null || getBaseMetaTileEntity().isDead();
+ }
+
+ public boolean checkTarget() {
+ final IGregTechTileEntity gt_tile = getBaseMetaTileEntity();
+ if (gt_tile == null || !gt_tile.isAllowedToWork() || gt_tile.isClientSide()) return false;
+ World world = gt_tile.getWorld();
+
+ if (mTargetPos == null) {
+ // We don't have a target position, scan the pipes
+ scanPipes();
+ } else if (mTarget == null || mTarget.isDead()) {
+ // We don't have a target, or it's dead. Try checking the target position
+ mTarget = null;
+ if (world.blockExists(mTargetPos.posX, mTargetPos.posY, mTargetPos.posZ)) {
+ // Only check if the target position is loaded
+ TileEntity te = world.getTileEntity(mTargetPos.posX, mTargetPos.posY, mTargetPos.posZ);
+ final IMetaTileEntity tMeta;
+ if (te instanceof BaseMetaTileEntity &&
+ ((tMeta = ((BaseMetaTileEntity)te).getMetaTileEntity()) instanceof GT_MetaTileEntity_LongDistancePipelineBase) &&
+ isSameClass((GT_MetaTileEntity_LongDistancePipelineBase)tMeta))
+ {
+ // It's the right type!
+ mTarget = (GT_MetaTileEntity_LongDistancePipelineBase)tMeta;
+ }
+ else if (te != null) {
+ // It isn't the right type, kill the target position
+ mTargetPos = null;
+ }
+ }
+ }
+ if (mTarget == null || mTarget == this) return false;
+ if (mTarget.mSender == null || mTarget.mSender.isDead() || mTarget.mSender.mTarget == null || mTarget.mSender.mTarget.isDead()) mTarget.mSender = this;
+
+ return mTarget.mSender == this;
+ }
+
+ @Override
+ public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
+ if (mSender != null && !mSender.isDead() && mSender.mTarget == this) {
+ final ChunkCoordinates coords = mSender.getCoords();
+ aList.addAll(Arrays.asList("Is the Target", "Sender is at: X: " + coords.posX + " Y: " + coords.posY + " Z: " + coords.posZ));
+ } else {
+ aList.addAll(
+ Arrays.asList(checkTarget() ? "Has Target" : "Has no loaded Target",
+ "Target should be around: X: " + mTargetPos.posX + " Y: " + mTargetPos.posY + " Z: " + mTargetPos.posZ
+ ));
+ }
+
+ return aList;
+
+ }
+
+ // What meta should the pipes for this pipeline have
+ public abstract int getPipeMeta();
+
+ protected void scanPipes() {
+ if (mSender != null && !mSender.isDead() && mSender.mTarget == this) return;
+ GT_Mod.GT_FML_LOGGER.info("ScanPipes()");
+
+ // Check if we need to scan anything
+ final IGregTechTileEntity gtTile = getBaseMetaTileEntity();
+ if (gtTile == null) return;
+
+ final World world = gtTile.getWorld();
+ if (world == null) return;
+
+ mTargetPos = getCoords();
+ mTarget = this;
+ mSender = null;
+
+ // Start scanning from the output side
+ Block aBlock = gtTile.getBlockAtSide(gtTile.getBackFacing());
+
+ if(aBlock instanceof GT_Block_LongDistancePipe) {
+ byte aMetaData = gtTile.getMetaIDAtSide(gtTile.getBackFacing());
+ if (aMetaData != getPipeMeta()) return;
+
+ HashSet<ChunkCoordinates>
+ tVisited = new HashSet<>(Collections.singletonList(getCoords())),
+ tWires = new HashSet<>();
+ Queue<ChunkCoordinates>
+ tQueue = new LinkedList<>(Collections.singletonList(getFacingOffset(gtTile, gtTile.getBackFacing())));
+
+ while (!tQueue.isEmpty()) {
+ final ChunkCoordinates aCoords = tQueue.poll();
+
+ if(world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ) == aBlock && world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ) == aMetaData) {
+ // We've got another pipe/wire block
+ // TODO: Make sure it's the right type of pipe/wire via meta
+ ChunkCoordinates tCoords;
+ tWires.add(aCoords);
+
+ // For each direction, if we haven't already visisted that coordinate, add it to the end of the queue
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ))) tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ))) tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1))) tQueue.add(tCoords);
+ if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1))) tQueue.add(tCoords);
+ } else {
+ // It's not a block - let's see if it's a tile entity
+ TileEntity tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ);
+ if (
+ tTileEntity != gtTile && tTileEntity instanceof BaseMetaTileEntity &&
+ ((BaseMetaTileEntity)tTileEntity).getMetaTileEntity() instanceof GT_MetaTileEntity_LongDistancePipelineBase)
+ {
+ final GT_MetaTileEntity_LongDistancePipelineBase tGtTile = (GT_MetaTileEntity_LongDistancePipelineBase)((BaseMetaTileEntity) tTileEntity).getMetaTileEntity();
+ if (isSameClass(tGtTile) && tWires.contains(
+ tGtTile.getFacingOffset((BaseMetaTileEntity)tTileEntity, ((BaseMetaTileEntity) tTileEntity).getFrontFacing())
+ )) {
+ // If it's the same class, and we've scanned a wire in front of it (the input side), we've found our target
+ mTarget = tGtTile;
+ mTargetPos = tGtTile.getCoords();
+ return;
+ }
+
+ // Remove this block from the visited because we might end up back here from another wire that IS connected to the
+ // input side
+ tVisited.remove(aCoords);
+ }
+ }
+ }
+ }
+
+ }
+
+ public ChunkCoordinates getFacingOffset(IGregTechTileEntity gt_tile, byte aSide) {
+ return new ChunkCoordinates(
+ gt_tile.getOffsetX(aSide, 1), gt_tile.getOffsetY(aSide, 1), gt_tile.getOffsetZ(aSide, 1)
+ );
+
+ }
+
+ public ChunkCoordinates getCoords() {
+ final IGregTechTileEntity gt_tile = getBaseMetaTileEntity();
+ return new ChunkCoordinates(gt_tile.getXCoord(), gt_tile.getYCoord(), gt_tile.getZCoord());
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ GT_Mod.GT_FML_LOGGER.info("You're dead to me");
+ mTargetPos = null; mSender = null;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public boolean shouldTriggerBlockUpdate() { return true; }
+
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java
new file mode 100644
index 0000000000..061ca5c4dd
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java
@@ -0,0 +1,110 @@
+/**
+ *
+ * Inspired/ported from GregTech 6 under the LGPL license
+ *
+ * Copyright (c) 2020 GregTech-6 Team
+ *
+ * This file is part of GregTech.
+ *
+ * GregTech is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GregTech is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GregTech. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package gregtech.common.tileentities.machines.long_distance;
+
+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.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEntity_LongDistancePipelineBase {
+ final static FluidTankInfo[] emptyTank = {new FluidTankInfo(null, Integer.MAX_VALUE)};
+
+ public GT_MetaTileEntity_LongDistancePipelineFluid(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Sends fluids over long distances");
+ }
+
+ public GT_MetaTileEntity_LongDistancePipelineFluid(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isSameClass(GT_MetaTileEntity_LongDistancePipelineBase other) {
+ return other instanceof GT_MetaTileEntity_LongDistancePipelineFluid;
+ }
+
+ public int getPipeMeta() {
+ return 0;
+ }
+
+ public IFluidHandler getTank() {
+ final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
+ TileEntity tankTile = tTile.getTileEntityAtSide(tTile.getBackFacing());
+ if (tankTile instanceof IFluidHandler) return (IFluidHandler)tankTile;
+ else return null;
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
+ if (checkTarget()) {
+ final IFluidHandler tankTile = getTank();
+ if (tankTile != null) return tankTile.getTankInfo(aSide);
+
+ }
+
+ return emptyTank;
+ }
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean aDoFill) {
+ if (checkTarget()) {
+ final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
+ final IFluidHandler tankTile = getTank();
+ if (tankTile != null) return tankTile.fill(ForgeDirection.getOrientation(tTile.getFrontFacing()), aFluid, aDoFill);
+ }
+ return 0;
+ }
+ @Override
+ public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean aDoDrain) {
+ return null;
+ }
+ @Override
+ public FluidStack drain(ForgeDirection aSide, int aMaxDrain, boolean aDoDrain) {
+ return null;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_LongDistancePipelineFluid(mName, mTier, mDescription, mTextures);
+ }
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing)
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT)};
+ else if (aSide == GT_Utility.getOppositeSide(aFacing))
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK)};
+ else
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE)};
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java
new file mode 100644
index 0000000000..da833321e4
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java
@@ -0,0 +1,183 @@
+/**
+ *
+ * Inspired/ported from GregTech 6 under the LGPL license
+ *
+ * Copyright (c) 2020 GregTech-6 Team
+ *
+ * This file is part of GregTech.
+ *
+ * GregTech is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GregTech is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GregTech. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package gregtech.common.tileentities.machines.long_distance;
+
+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.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntity_LongDistancePipelineBase {
+ final static int[] emptyIntArray = new int[0];
+
+ public GT_MetaTileEntity_LongDistancePipelineItem(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Sends Items over long distances");
+ }
+
+ public GT_MetaTileEntity_LongDistancePipelineItem(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isSameClass(GT_MetaTileEntity_LongDistancePipelineBase other) {
+ return other instanceof GT_MetaTileEntity_LongDistancePipelineItem;
+ }
+
+ public int getPipeMeta() {
+ return 1;
+ }
+
+ public IInventory getInventory() {
+ final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
+ TileEntity invTile = tTile.getTileEntityAtSide(tTile.getBackFacing());
+ if (invTile instanceof IInventory) return (IInventory)invTile;
+ else return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int aSlot, int aDecrement) {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.decrStackSize(aSlot, aDecrement);
+ }
+ return null;
+ }
+ @Override
+ public ItemStack getStackInSlotOnClosing(int aSlot) {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.getStackInSlotOnClosing(aSlot);
+ }
+ return null;
+ }
+ @Override
+ public ItemStack getStackInSlot(int aSlot) {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.getStackInSlot(aSlot);
+ }
+ return null;
+ }
+ @Override
+ public String getInventoryName() {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.getInventoryName();
+ }
+ return super.getInventoryName();
+ }
+ @Override
+ public int getSizeInventory() {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.getSizeInventory();
+ }
+ return 0;
+ }
+ @Override
+ public int getInventoryStackLimit() {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.getInventoryStackLimit();
+ }
+ return 0;
+ }
+ @Override
+ public void setInventorySlotContents(int aSlot, ItemStack aStack) {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) iInventory.setInventorySlotContents(aSlot, aStack);
+ }
+ }
+ @Override
+ public boolean hasCustomInventoryName() {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.hasCustomInventoryName();
+ }
+ return false;
+ }
+ @Override
+ public boolean isItemValidForSlot(int aSlot, ItemStack aStack) {
+ if (checkTarget()) {
+ IInventory iInventory = getInventory();
+ if (iInventory != null) return iInventory.isItemValidForSlot(aSlot, aStack);
+ }
+ return false;
+ }
+
+// // Relay Sided Inventories
+//
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ if (checkTarget()) {
+ final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
+ IInventory iInventory = getInventory();
+ if (iInventory instanceof ISidedInventory) return ((ISidedInventory)iInventory).getAccessibleSlotsFromSide(tTile.getBackFacing());
+ if (iInventory != null) {
+ int[] tReturn = new int[iInventory.getSizeInventory()];
+ for (int i = 0; i < tReturn.length; i++) tReturn[i] = i;
+ return tReturn;
+ }
+ }
+
+ return emptyIntArray;
+ }
+
+ @Override
+ public boolean canInsertItem(int aSlot, ItemStack aStack, int aSide) {
+ if (checkTarget()) {
+ final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity();
+ IInventory iInventory = getInventory();
+ if (iInventory instanceof ISidedInventory) return ((ISidedInventory)iInventory).canInsertItem(aSlot, aStack, tTile.getBackFacing());
+ return iInventory != null;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int aSlot, ItemStack aStack, int aSide) {
+ return false;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_LongDistancePipelineItem(mName, mTier, mDescription, mTextures);
+ }
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing)
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT)};
+ else if (aSide == GT_Utility.getOppositeSide(aFacing))
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK)};
+ else
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE)};
+ }
+}
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/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
index a6e4d11599..c8b4bf20d8 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java
@@ -10,8 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
-public class GT_MetaTileEntity_SuperTank
- extends GT_MetaTileEntity_BasicTank {
+public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank {
public GT_MetaTileEntity_SuperTank(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 3, "Stores " + CommonSizeCompute(aTier) + "L of fluid");
}