aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech')
-rw-r--r--src/main/java/gregtech/api/enums/GT_Values.java1
-rw-r--r--src/main/java/gregtech/api/enums/OrePrefixes.java2
-rw-r--r--src/main/java/gregtech/api/enums/Textures.java6
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container.java2
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java12
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java1
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java2
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java8
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java36
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java19
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java13
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java26
-rw-r--r--src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java6
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java13
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java5
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java38
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java35
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java38
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java45
-rw-r--r--src/main/java/gregtech/api/objects/GT_ChunkManager.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehavior.java3
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java6
-rw-r--r--src/main/java/gregtech/api/util/LightingHelper.java19
-rw-r--r--src/main/java/gregtech/common/GT_Client.java5
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java69
-rw-r--r--src/main/java/gregtech/common/render/GT_Renderer_Block.java869
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java267
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java209
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java100
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java354
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java66
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java30
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java11
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java40
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java129
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java25
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java18
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java18
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java101
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java8
-rw-r--r--src/main/java/gregtech/loaders/misc/GT_Achievements.java4
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java4
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java42
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java7
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java4
61 files changed, 1691 insertions, 1107 deletions
diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java
index d2b391edcb..a0ccd107a6 100644
--- a/src/main/java/gregtech/api/enums/GT_Values.java
+++ b/src/main/java/gregtech/api/enums/GT_Values.java
@@ -300,4 +300,5 @@ public class GT_Values {
public static boolean cls_enabled;
public static boolean hideAssLineRecipes = false;
+ public static final int STEAM_PER_WATER = 160;
}
diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java
index 59c20d412b..ba91886c99 100644
--- a/src/main/java/gregtech/api/enums/OrePrefixes.java
+++ b/src/main/java/gregtech/api/enums/OrePrefixes.java
@@ -703,7 +703,7 @@ public enum OrePrefixes {
if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) plateTriple.mDisabledItems.add(aMaterial);
if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) plateQuadruple.mDisabledItems.add(aMaterial);
if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) plateQuintuple.mDisabledItems.add(aMaterial);
- if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper))
+ if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper || aMaterial == Materials.Thaumium || aMaterial == Materials.Titanium))
plateDense.mDisabledItems.add(aMaterial);
//Rotors
if (!enableUnusedRotors && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Tin || aMaterial == Materials.Osmium ||
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java
index 3a9af71aa2..b2afa4216e 100644
--- a/src/main/java/gregtech/api/enums/Textures.java
+++ b/src/main/java/gregtech/api/enums/Textures.java
@@ -5,6 +5,7 @@ import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.GT_SidedTexture;
+import gregtech.api.objects.GT_StdRenderedTexture;
import gregtech.api.util.GT_Utility;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
@@ -57,6 +58,8 @@ public class Textures {
LONG_DISTANCE_PIPE_FLUID,
LONG_DISTANCE_PIPE_ITEM,
+ HIDDEN_FACE,
+
MACHINE_CASING_TANK_1,
MACHINE_CASING_TANK_2,
MACHINE_CASING_TANK_3,
@@ -1352,6 +1355,9 @@ public class Textures {
BLOCK_CHARCOAL,
BLOCK_BLAZE
};
+ public static ITexture[] HIDDEN_TEXTURE = new ITexture[]{
+ new GT_StdRenderedTexture(BlockIcons.HIDDEN_FACE)
+ };
public static ITexture[]
ERROR_RENDERING = new ITexture[]{
new GT_RenderedTexture(RENDERING_ERROR)
diff --git a/src/main/java/gregtech/api/gui/GT_Container.java b/src/main/java/gregtech/api/gui/GT_Container.java
index 4ce583cff5..671d68b917 100644
--- a/src/main/java/gregtech/api/gui/GT_Container.java
+++ b/src/main/java/gregtech/api/gui/GT_Container.java
@@ -26,6 +26,7 @@ public class GT_Container extends Container {
mTileEntity = aTileEntityInventory;
mPlayerInventory = aPlayerInventory;
+ mTileEntity.openInventory();
}
/**
@@ -468,6 +469,7 @@ public class GT_Container extends Container {
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
try {
super.onContainerClosed(par1EntityPlayer);
+ mTileEntity.closeInventory();
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java
index bc822250fd..cffcb4c4ab 100644
--- a/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IConnectable.java
@@ -4,6 +4,18 @@ package gregtech.api.interfaces.metatileentity;
* For pipes, wires, and other MetaTiles which need to be decided whether they should connect to the block at each side.
*/
public interface IConnectable {
+ int NO_CONNECTION = 0b00000000;
+ int CONNECTED_DOWN = 0b00000001;
+ int CONNECTED_UP = 0b00000010;
+ int CONNECTED_NORTH = 0b00000100;
+ int CONNECTED_SOUTH = 0b00001000;
+ int CONNECTED_WEST = 0b00010000;
+ int CONNECTED_EAST = 0b00100000;
+ int CONNECTED_ALL = 0b00111111;
+ int HAS_FRESHFOAM = 0b01000000;
+ int HAS_HARDENEDFOAM = 0b10000000;
+ int HAS_FOAM = 0b11000000;
+
/**
* Try to connect to the Block at the specified side
* returns the connection state. Non-positive values for failed, others for succeeded.
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
index f0ca426616..2bf61f6679 100644
--- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
@@ -422,4 +422,5 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
default boolean isMachineBlockUpdateRecursive(){
return true;
}
+
}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
index 9ab1ac0f67..8a815556e7 100644
--- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
@@ -155,4 +155,6 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil
getMetaTileEntity().getBaseMetaTileEntity() == this &&
getMetaTileEntity().isMachineBlockUpdateRecursive();
}
+
+ default void setShutdownStatus(boolean newStatus) {return;}
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java
index 588158d16c..bae361421c 100644
--- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineProgress.java
@@ -66,4 +66,12 @@ public interface IMachineProgress extends IHasWorldObjectAndCoords {
* sets the visible Active Status of the Machine
*/
void setActive(boolean aActive);
+
+ /**
+ * Indicates if the object in question was forced to shut down (i.e. loss of power)
+ * */
+ default boolean wasShutdown() {
+ return false;
+ }
+
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java
index 8392616f34..de3cf3ec99 100644
--- a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java
@@ -1,7 +1,6 @@
package gregtech.api.interfaces.tileentity;
import gregtech.api.interfaces.ITexture;
-import net.minecraft.block.Block;
public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity {
float getThickNess();
@@ -12,5 +11,5 @@ public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity
default ITexture[] getTextureCovered(byte aSide) {
return getTextureUncovered(aSide);
- };
+ }
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 26fee68f2b..0fd8779244 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -8,9 +8,12 @@ import java.util.Arrays;
import java.util.List;
import java.util.UUID;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IConnectable;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity;
@@ -21,6 +24,7 @@ import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Client;
import gregtech.common.covers.GT_Cover_Fluidfilter;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
@@ -48,7 +52,7 @@ import net.minecraftforge.fluids.IFluidHandler;
*/
public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileEntity, IPipeRenderedTileEntity {
private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior};
- public byte mConnections = 0;
+ public byte mConnections = IConnectable.NO_CONNECTION;
protected MetaPipeEntity mMetaTileEntity;
private byte[] mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0};
private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
@@ -258,9 +262,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
if (!hasValidMetaTileEntity()) return;
}
}
- mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
- if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
- mConnections = (byte) ((mConnections & ~64) | -128);
+ // Mask-out Connection direction bits to keep only Foam related connections
+ mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~IConnectable.CONNECTED_ALL));
+ // If foam not hardened, tries roll chance to harden
+ if ((mConnections & IConnectable.HAS_FOAM) == IConnectable.HAS_FRESHFOAM && getRandomNumber(1000) == 0) {
+ mConnections = (byte) ((mConnections & ~IConnectable.HAS_FRESHFOAM) | IConnectable.HAS_HARDENEDFOAM);
}
}
case 8:
@@ -484,6 +490,10 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
}
public ITexture getCoverTexture(byte aSide) {
+ if (getCoverIDAtSide(aSide) == 0) return null;
+ if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) {
+ return BlockIcons.HIDDEN_TEXTURE[0]; // See through
+ }
return GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide)));
}
@@ -799,15 +809,17 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
@Override
public ITexture[] getTextureUncovered(byte aSide) {
- if ((mConnections & 64) != 0) return Textures.BlockIcons.FRESHFOAM;
- if ((mConnections & -128) != 0) return Textures.BlockIcons.HARDENEDFOAMS[mColor];
- if ((mConnections & -64) != 0) return Textures.BlockIcons.ERROR_RENDERING;
+ if ((mConnections & IConnectable.HAS_FRESHFOAM) != 0) return Textures.BlockIcons.FRESHFOAM;
+ if ((mConnections & IConnectable.HAS_HARDENEDFOAM) != 0) return Textures.BlockIcons.HARDENEDFOAMS[mColor];
+ if ((mConnections & IConnectable.HAS_FOAM) != 0) return Textures.BlockIcons.ERROR_RENDERING;
byte tConnections = mConnections;
- if (tConnections == 1 || tConnections == 2) tConnections = 3;
- else if (tConnections == 4 || tConnections == 8) tConnections = 12;
- else if (tConnections == 16 || tConnections == 32) tConnections = 48;
+ if (tConnections == IConnectable.CONNECTED_WEST || tConnections == IConnectable.CONNECTED_EAST) tConnections = (byte) (IConnectable.CONNECTED_WEST | IConnectable.CONNECTED_EAST);
+ else if (tConnections == IConnectable.CONNECTED_DOWN || tConnections == IConnectable.CONNECTED_UP) tConnections = (byte) (IConnectable.CONNECTED_DOWN | IConnectable.CONNECTED_UP);
+ else if (tConnections == IConnectable.CONNECTED_NORTH || tConnections == IConnectable.CONNECTED_SOUTH) tConnections = (byte) (IConnectable.CONNECTED_NORTH | IConnectable.CONNECTED_SOUTH);
if (hasValidMetaTileEntity())
- return mMetaTileEntity.getTexture(this, aSide, tConnections, (byte) (mColor - 1), tConnections == 0 || (tConnections & (1 << aSide)) != 0, getOutputRedstoneSignal(aSide) > 0);
+ return mMetaTileEntity.getTexture(this, aSide, tConnections, (byte) (mColor - 1),
+ tConnections == 0 || (tConnections & (1 << aSide)) != 0,
+ getOutputRedstoneSignal(aSide) > 0);
return Textures.BlockIcons.ERROR_RENDERING;
}
@@ -1401,7 +1413,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
@Override
public float getBlastResistance(byte aSide) {
- return (mConnections & 192) != 0 ? 50.0F : 5.0F;
+ return (mConnections & IConnectable.HAS_FOAM) != 0 ? 50.0F : 5.0F;
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 0781c57086..262eac674c 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -13,6 +13,7 @@ import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IEnergyConnected;
@@ -21,11 +22,13 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.net.GT_Packet_TileEntity;
import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_StdRenderedTexture;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Client;
import gregtech.common.GT_Pollution;
import ic2.api.Direction;
import net.minecraft.block.Block;
@@ -89,6 +92,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
private UUID mOwnerUuid = GT_Utility.defaultUuid;
private NBTTagCompound mRecipeStuff = new NBTTagCompound();
+ public boolean mWasShutdown = false;
+
private static final Field ENTITY_ITEM_HEALTH_FIELD;
static
{
@@ -829,6 +834,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
public ITexture getCoverTexture(byte aSide) {
+ if (getCoverIDAtSide(aSide) == 0) return null;
+ if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) {
+ return BlockIcons.HIDDEN_TEXTURE[0]; // See through
+ }
return GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide)));
}
@@ -997,6 +1006,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
public void enableWorking() {
if (!mWorks) mWorkUpdate = true;
mWorks = true;
+ mWasShutdown = false;
}
@Override
@@ -2311,4 +2321,13 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (gp != null)
gp.invalidate();
}
+
+ @Override
+ public boolean wasShutdown() {
+ return mWasShutdown;
+ }
+
+ public void setShutdownStatus(boolean newStatus) {
+ mWasShutdown = newStatus;
+ }
}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
index 0716d84bd6..8fe4c93639 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
@@ -9,11 +9,12 @@ import gregtech.api.interfaces.tileentity.IColoredTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.WorldSpawnedEventBuilder;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Utility;
+import gregtech.api.util.WorldSpawnedEventBuilder;
+import gregtech.common.GT_Client;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -244,7 +245,15 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
@Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) {
+ /* Client tick counter that is set to 5 on hiding pipes and covers.
+ * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
+ * spreading client change detection related work and network traffic on different ticks, until it reaches 0.
+ */
+ aBaseMetaTileEntity.issueTextureUpdate();
+ }
+ }
@Override
public void inValidate() {/*Do nothing*/}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
index 79447a96cb..730ec264f3 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
@@ -2,7 +2,6 @@ package gregtech.api.metatileentity;
import appeng.api.util.AECableType;
import appeng.me.helpers.AENetworkProxy;
-import appeng.me.helpers.IGridProxyable;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -11,7 +10,12 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.*;
+import gregtech.api.util.GT_Config;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Client;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -47,6 +51,7 @@ import static gregtech.api.enums.GT_Values.V;
* Call the Constructor like the following example inside the Load Phase, to register it.
* "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
*/
+@SuppressWarnings("unused")
public abstract class MetaTileEntity implements IMetaTileEntity {
/**
* Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
@@ -57,6 +62,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
*/
public final ItemStack[] mInventory;
public boolean doTickProfilingInThisTick = true;
+
/**
* accessibility to this Field is no longer given, see below
*/
@@ -84,7 +90,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
} else {
throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!");
}
- mName = aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH);
+ mName = aBasicName.replace(" ", "_").toLowerCase(Locale.ENGLISH);
setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity());
getBaseMetaTileEntity().setMetaTileID((short) aID);
GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName);
@@ -174,7 +180,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
if(!aPlayer.isSneaking()) return false;
byte tSide = GT_Utility.getOppositeSide(aWrenchingSide);
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide);
- if (tTileEntity != null && (tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) {
+ if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) {
// The tile entity we're facing is a cable, let's try to connect to it
return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity().onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ);
}
@@ -186,7 +192,7 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
if(!aPlayer.isSneaking()) return false;
byte tSide = GT_Utility.getOppositeSide(aWrenchingSide);
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide);
- if (tTileEntity != null && (tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) {
+ if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) {
// The tile entity we're facing is a cable, let's try to connect to it
return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity().onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ);
}
@@ -205,7 +211,15 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
@Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) {
+ /* Client tick counter that is set to 5 on hiding pipes and covers.
+ * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
+ * spreading client change detection related work and network traffic on different ticks, until it reaches 0.
+ */
+ aBaseMetaTileEntity.issueTextureUpdate();
+ }
+ }
@Override
public void inValidate() {/*Do nothing*/}
diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
index d0f3074af1..01f11142ac 100644
--- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
+++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
@@ -43,8 +43,8 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine
}
@Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (mDisableFilter || GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null);
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null;
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
index 02d6752bdd..19b6d26237 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
@@ -294,6 +294,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide()) {
{ //amp handler
@@ -358,7 +359,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
mTransferredAmperageLast20 = 0;
if (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections) checkConnections();
}
- } else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
+ }
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
index e6c24ec4b1..708bbf2ca8 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
@@ -232,6 +232,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide() && aTick % 5 == 0) {
mLastReceivedFrom &= 63;
if (mLastReceivedFrom == 63) {
@@ -256,7 +257,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
oLastReceivedFrom = mLastReceivedFrom;
- } else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
+ }
}
private boolean checkEnvironment(int index, IGregTechTileEntity aBaseMetaTileEntity) {
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
index 7074d63422..455d327209 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java
@@ -6,6 +6,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_ModHandler.RecipeBits;
import gregtech.api.util.GT_OreDictUnificator;
@@ -15,6 +16,9 @@ import net.minecraft.nbt.NBTTagCompound;
import static gregtech.api.enums.GT_Values.RA;
public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
+ private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization(
+ "gt.blockmachines.gt_frame.desc.format",
+ "Just something you can put covers on.");
public final Materials mMaterial;
public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) {
@@ -48,7 +52,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity {
@Override
public String[] getDescription() {
- return new String[]{"Just something you can put a Cover or CFoam on."};
+ return localizedDescFormat.split("\\R");
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
index 6ed5a9edd0..1bbae2821b 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
@@ -156,6 +156,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide() && aTick % 10 == 0) {
if (aTick % mTickTime == 0) mTransferredItems = 0;
@@ -181,7 +182,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
if (isInventoryEmpty()) mLastReceivedFrom = 6;
oLastReceivedFrom = mLastReceivedFrom;
- }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
+ }
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index 4775158319..d940ff6602 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -576,7 +576,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mHasBeenUpdated = true;
getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing());
}
+ }
+ @Override
+ protected void updateFluidDisplayItem() {
+ super.updateFluidDisplayItem();
if (displaysInputFluid()) {
int tDisplayStackSlot = OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
if (getFillableStack() == null) {
@@ -824,14 +828,17 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing()))
return false;
- if (mDisableFilter) return true;
for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex;
- return true;
+ return mDisableFilter || allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack);
}
+ /**
+ * Test if given stack can be inserted into specified slot.
+ * Before execution of this method it is ensured there is no such kind of item inside any input slots already.
+ */
protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return true;
+ return mInventory[aIndex] == null;
}
/**
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
index 84b9fd9d5f..00ce4051ec 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
@@ -738,9 +738,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
}
@Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false;
- if (this.mInventory[aIndex] != null || mDisableFilter) return true;
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false;
switch (this.mInputSlotCount) {
case 0:
return false;
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java
index 9222029854..219df59723 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java
@@ -21,6 +21,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_TieredMachineBlock {
public FluidStack mFluid;
+ protected int mOpenerCount;
/**
* @param aInvSlotCount should be 3
@@ -133,19 +134,27 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
}
@Override
+ public void onOpenGUI() {
+ super.onOpenGUI();
+ mOpenerCount++;
+ if (mOpenerCount == 1)
+ updateFluidDisplayItem();
+ }
+
+ @Override
+ public void onCloseGUI() {
+ super.onCloseGUI();
+ mOpenerCount--;
+ }
+
+ @Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0)
setFillableStack(null);
- if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) {
- if (getDisplayedFluid() == null) {
- if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true))
- mInventory[getStackDisplaySlot()] = null;
- } else {
- mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize());
- }
- }
+ if (mOpenerCount > 0)
+ updateFluidDisplayItem();
if (doesEmptyContainers()) {
FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true);
@@ -159,7 +168,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
}
}
} else {
- if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) {
+ if (tFluid.isFluidEqual(getFillableStack()) && ((long)tFluid.amount + getFillableStack().amount) <= (long)getCapacity()) {
if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
getFillableStack().amount += tFluid.amount;
aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
@@ -181,6 +190,17 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier
}
}
+ protected void updateFluidDisplayItem() {
+ if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) {
+ if (getDisplayedFluid() == null) {
+ if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true))
+ mInventory[getStackDisplaySlot()] = null;
+ } else {
+ mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize());
+ }
+ }
+ }
+
@Override
public FluidStack getFluid() {
return getDrainableStack();
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
index 7c57076ae9..d462e8adb9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
@@ -20,7 +20,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
private static final int ARROW_UP_INDEX = 4;
private static final int FRONT_INDEX = 5;
- public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false;
+ public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false, bSortStacks = false;
public int mSuccess = 0, mTargetStackSize = 0;
public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
@@ -213,6 +213,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
aNBT.setBoolean("bRedstoneIfFull", bRedstoneIfFull);
aNBT.setBoolean("bStockingMode", bStockingMode);
aNBT.setInteger("mTargetStackSize", mTargetStackSize);
+ aNBT.setBoolean("bSortStacks", bSortStacks);
}
@Override
@@ -220,9 +221,13 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
bInvert = aNBT.getBoolean("bInvert");
bOutput = aNBT.getBoolean("bOutput");
bRedstoneIfFull = aNBT.getBoolean("bRedstoneIfFull");
+ bSortStacks = aNBT.getBoolean("bSortStacks");
if (aNBT.hasKey("bStockingMode")) { // Adding new key to existing NBT, need to protect if it is not there.
bStockingMode = aNBT.getBoolean("bStockingMode");
}
+ if (aNBT.hasKey("bSortStacks")) {
+ bSortStacks = aNBT.getBoolean("bSortStacks");
+ }
mTargetStackSize = aNBT.getInteger("mTargetStackSize");
}
@@ -250,6 +255,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {
mSuccess--;
+ updateSlots();
moveItems(aBaseMetaTileEntity, aTimer);
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,bInvert ? (byte)15 : (byte)0);
@@ -300,4 +306,31 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
public boolean allowGeneralRedstoneOutput(){
return true;
}
+
+ public void updateSlots() {
+ for (int i = 0; i < mInventory.length; i++)
+ if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
+ fillStacksIntoFirstSlots();
+ }
+
+ protected void fillStacksIntoFirstSlots() {
+ if (bSortStacks) {
+ for (int i = 0; i < mInventory.length; i++)
+ for (int j = i + 1; j < mInventory.length; j++)
+ if (mInventory[j] != null && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j])))
+ GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ }
+
+ @Override
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aPlayer.isSneaking()) {
+ // I was so proud of all this but I literally just copied code from OutputBus
+ bSortStacks = !bSortStacks;
+ GT_Utility.sendChatToPlayer(aPlayer, trans("200", "Sort mode: " + (bSortStacks ? "Disabled" : "Enabled")));
+ return true;
+ }
+ return super.onSolderingToolRightClick(aSide,aWrenchingSide,aPlayer,aX,aY,aZ);
+ }
+
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
index 9c227b8da7..57cfc44ff6 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
@@ -12,7 +12,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
-import static gregtech.api.util.GT_Utility.*;
+import static gregtech.api.util.GT_Utility.moveMultipleItemStacks;
public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier) {
@@ -110,6 +110,42 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch {
}
}
+ /**
+ * Attempt to store as many items as possible into the internal inventory of this output bus.
+ * If you need atomicity you should use {@link gregtech.api.interfaces.tileentity.IHasInventory#addStackToSlot(int, ItemStack)}
+ * @param aStack Assume valid.
+ * Will be mutated.
+ * Take over the ownership. Caller should not retain a reference to this stack if the call returns true.
+ * @return true if stack is fully accepted. false is stack is partially accepted or nothing is accepted
+ */
+ public boolean storeAll(ItemStack aStack) {
+ for (int i = 0, mInventoryLength = mInventory.length; i < mInventoryLength; i++) {
+ ItemStack tSlot = mInventory[i];
+ if (GT_Utility.isStackInvalid(tSlot)) {
+ if (aStack.stackSize <= getInventoryStackLimit()) {
+ mInventory[i] = aStack;
+ return true;
+ }
+ mInventory[i] = aStack.splitStack(getInventoryStackLimit());
+ } else {
+ int tRealStackLimit = Math.min(getInventoryStackLimit(), tSlot.getMaxStackSize());
+ if (tSlot.stackSize < tRealStackLimit &&
+ tSlot.isItemEqual(aStack) &&
+ ItemStack.areItemStackTagsEqual(tSlot, aStack)) {
+ if (aStack.stackSize + tSlot.stackSize <= tRealStackLimit) {
+ mInventory[i].stackSize += aStack.stackSize;
+ return true;
+ } else {
+ // more to serve
+ aStack.stackSize -= tRealStackLimit - tSlot.stackSize;
+ mInventory[i].stackSize = tRealStackLimit;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return aSide == aBaseMetaTileEntity.getFrontFacing();
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 3adff2fc3f..193b9d482c 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -16,8 +16,6 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
-import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME;
-
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -310,8 +308,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64));
aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
boolean active=aBaseMetaTileEntity.isActive() && mPollution>0;
- for(GT_MetaTileEntity_Hatch_Muffler aMuffler:mMufflerHatches)
- aMuffler.getBaseMetaTileEntity().setActive(active);
+ for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) {
+ IGregTechTileEntity iGTTileEntity = aMuffler.getBaseMetaTileEntity();
+ if (iGTTileEntity != null && !iGTTileEntity.isDead()) {
+ iGTTileEntity.setActive(active);
+ }
+ }
}
}
@@ -341,7 +343,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
if (mEUt < 0) {
if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) {
- stopMachine();
+ criticalStopMachine();
return false;
}
}
@@ -393,6 +395,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
getBaseMetaTileEntity().disableWorking();
}
+ public void criticalStopMachine() {
+ stopMachine();
+ getBaseMetaTileEntity().setShutdownStatus(true);
+ }
+
public int getRepairStatus() {
return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) + (mSoftHammer ? 1 : 0) + (mHardHammer ? 1 : 0) + (mSolderingTool ? 1 : 0) + (mCrowbar ? 1 : 0);
}
@@ -735,33 +742,15 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public boolean addOutput(ItemStack aStack) {
if (GT_Utility.isStackInvalid(aStack)) return false;
aStack = GT_Utility.copy(aStack);
+ for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
+ if (isValidMetaTileEntity(tHatch) && tHatch.storeAll(aStack)) {
+ return true;
+ }
+ }
boolean outputSuccess = true;
while (outputSuccess && aStack.stackSize > 0) {
outputSuccess = false;
-
- if (GregTech_API.mAE2) {
- // this separate cycle may be refactored out, after this function will hopefully be totally refactored
- // for now it is here to avoid splitting stack when we have ME output bus
- for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
- // TODO: If ever there will be another hatch storing in some external storage, here should be an interface check
- if (tHatch instanceof GT_MetaTileEntity_Hatch_OutputBus_ME && isValidMetaTileEntity(tHatch)) {
- int rest = ((GT_MetaTileEntity_Hatch_OutputBus_ME) tHatch).store(aStack);
- if (rest != aStack.stackSize)
- outputSuccess = true;
- aStack.stackSize = rest;
- if (rest == 0)
- return true;
- }
- }
- }
ItemStack single = aStack.splitStack(1);
- for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
- if (!outputSuccess && isValidMetaTileEntity(tHatch)) {
- for (int i = tHatch.getSizeInventory() - 1; i >= 0 && !outputSuccess; i--) {
- if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, single)) outputSuccess = true;
- }
- }
- }
for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
if (!outputSuccess && isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) {
if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, single)) outputSuccess = true;
diff --git a/src/main/java/gregtech/api/objects/GT_ChunkManager.java b/src/main/java/gregtech/api/objects/GT_ChunkManager.java
index 0012bc78f4..ea2982e001 100644
--- a/src/main/java/gregtech/api/objects/GT_ChunkManager.java
+++ b/src/main/java/gregtech/api/objects/GT_ChunkManager.java
@@ -102,7 +102,7 @@ public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback
tag.setInteger("OwnerZ", owner.zCoord);
ForgeChunkManager.forceChunk(ticket, chunkXZ);
if (GT_Values.alwaysReloadChunkloaders)
- ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord << 4, owner.zCoord << 4));
+ ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord >> 4, owner.zCoord >> 4));
instance.registeredTickets.put(owner, ticket);
}
return true;
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehavior.java b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
index c0ad751add..ef332ddb01 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehavior.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehavior.java
@@ -15,6 +15,9 @@ import static gregtech.api.enums.GT_Values.E;
* For Covers with a special behavior.
*/
public abstract class GT_CoverBehavior {
+
+ public EntityPlayer lastPlayer = null;
+
/**
* Called by updateEntity inside the covered TileEntity. aCoverVariable is the Value you returned last time.
*/
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index a9ba9b9bbc..9558df4608 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -1981,6 +1981,12 @@ public class GT_Utility {
}
try {
if (tTileEntity instanceof IMachineProgress) {
+ if (((IMachineProgress) tTileEntity).isAllowedToWork()) {
+ tList.add("Disabled." + EnumChatFormatting.RED + EnumChatFormatting.RESET);
+ }
+ if (((IMachineProgress) tTileEntity).wasShutdown()) {
+ tList.add("Shut down due to power loss." + EnumChatFormatting.RED + EnumChatFormatting.RESET);
+ }
rEUAmount += 400;
int tValue = 0;
if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress()))
diff --git a/src/main/java/gregtech/api/util/LightingHelper.java b/src/main/java/gregtech/api/util/LightingHelper.java
index df70ffaeef..598253b7d7 100644
--- a/src/main/java/gregtech/api/util/LightingHelper.java
+++ b/src/main/java/gregtech/api/util/LightingHelper.java
@@ -31,6 +31,7 @@ import net.minecraft.client.renderer.Tessellator;
public class LightingHelper {
public static final int NORMAL_BRIGHTNESS = 0xff00ff;
public static final int MAX_BRIGHTNESS = 0xf000f0;
+ public static final float NO_Z_FIGHT_OFFSET = 1.0F / 1024.0F;
protected static final float[] LIGHTNESS = {0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F};
private final RenderBlocks renderBlocks;
/**
@@ -55,6 +56,10 @@ public class LightingHelper {
*/
public LightingHelper(RenderBlocks renderBlocks) {
this.renderBlocks = renderBlocks;
+ if (renderBlocks.useInventoryTint) {
+ // Block will be rendered in an inventory, so it needs its lightness maxed
+ setLightnessOverride(1.0F);
+ }
}
/**
@@ -321,7 +326,7 @@ public class LightingHelper {
if (renderBlocks.enableAO) {
- int xOffset = renderBlocks.renderMinX > 0.0F ? x : x - 1;
+ int xOffset = renderBlocks.renderMinX > 0.0F + NO_Z_FIGHT_OFFSET ? x : x - 1;
int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z);
brightness = mixedBrightness;
@@ -392,7 +397,7 @@ public class LightingHelper {
if (renderBlocks.enableAO) {
- int xOffset = renderBlocks.renderMaxX < 1.0F ? x : x + 1;
+ int xOffset = renderBlocks.renderMaxX < 1.0F - NO_Z_FIGHT_OFFSET ? x : x + 1;
int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z);
brightness = mixedBrightness;
@@ -462,7 +467,7 @@ public class LightingHelper {
if (renderBlocks.enableAO) {
- int yOffset = renderBlocks.renderMinY > 0.0F ? y : y - 1;
+ int yOffset = renderBlocks.renderMinY > 0.0F + NO_Z_FIGHT_OFFSET ? y : y - 1;
int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z);
brightness = mixedBrightness;
@@ -497,7 +502,7 @@ public class LightingHelper {
float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNN + aoLightValue + renderBlocks.aoLightValueScratchYZNN) / 4.0F;
float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F;
- aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX));
+ aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX));
aoBottomLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX));
aoBottomRight = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX));
aoTopRight = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX));
@@ -533,7 +538,7 @@ public class LightingHelper {
if (renderBlocks.enableAO) {
- int yOffset = renderBlocks.renderMaxY < 1.0F ? y : y + 1;
+ int yOffset = renderBlocks.renderMaxY < 1.0F - NO_Z_FIGHT_OFFSET ? y : y + 1;
int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z);
brightness = mixedBrightness;
@@ -602,7 +607,7 @@ public class LightingHelper {
if (renderBlocks.enableAO) {
- int zOffset = renderBlocks.renderMinZ > 0.0F ? z : z - 1;
+ int zOffset = renderBlocks.renderMinZ > 0.0F + NO_Z_FIGHT_OFFSET ? z : z - 1;
int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset);
brightness = mixedBrightness;
@@ -673,7 +678,7 @@ public class LightingHelper {
if (renderBlocks.enableAO) {
- int zOffset = renderBlocks.renderMaxZ < 1.0F ? z : z + 1;
+ int zOffset = renderBlocks.renderMaxZ < 1.0F - NO_Z_FIGHT_OFFSET ? z : z + 1;
int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset);
brightness = mixedBrightness;
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index b820c3b53a..6ce360c017 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -649,6 +649,11 @@ public class GT_Client extends GT_Proxy
}
public static int hideValue=0;
+
+ /** <p>Client tick counter that is set to 5 on hiding pipes and covers.</p>
+ * <p>It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks,
+ * spreading client change detection related work and network traffic on different ticks, until it reaches 0.</p>
+ */
public static int changeDetected=0;
private static int shouldHeldItemHideThings() {
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java
index 487d457b39..ba943e4286 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java
@@ -1,26 +1,47 @@
package gregtech.common.covers;
+import cpw.mods.fml.client.FMLClientHandler;
import gregtech.api.enums.GT_Values;
import gregtech.api.gui.GT_GUICover;
import gregtech.api.gui.widgets.GT_GuiIcon;
import gregtech.api.gui.widgets.GT_GuiIconButton;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
+import gregtech.api.metatileentity.BaseTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
+import net.minecraft.world.WorldServer;
+
+import static gregtech.GT_Mod.GT_FML_LOGGER;
public class GT_Cover_ControlsWork extends GT_CoverBehavior {
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
if (aTileEntity instanceof IMachineProgress) {
- if ((aInputRedstone > 0) == (aCoverVariable == 0) && aCoverVariable != 2)
- ((IMachineProgress) aTileEntity).enableWorking();
- else
+ if (aCoverVariable < 2) {
+ if ((aInputRedstone > 0) == (aCoverVariable == 0))
+ ((IMachineProgress) aTileEntity).enableWorking();
+ else
+ ((IMachineProgress) aTileEntity).disableWorking();
+ ((IMachineProgress) aTileEntity).setWorkDataValue(aInputRedstone);
+ }
+ else if (aCoverVariable == 2) {
((IMachineProgress) aTileEntity).disableWorking();
- ((IMachineProgress) aTileEntity).setWorkDataValue(aInputRedstone);
+ } else {
+ if (((IMachineProgress) aTileEntity).wasShutdown()) {
+ ((IMachineProgress) aTileEntity).disableWorking();
+ GT_Utility.sendChatToPlayer(lastPlayer, aTileEntity.getInventoryName() + "at " + String.format("(%d,%d,%d)", aTileEntity.getXCoord(), aTileEntity.getYCoord(), aTileEntity.getZCoord()) + " shut down.");
+ return 2;
+ } else {
+ return 3 + doCoverThings(aSide,aInputRedstone, aCoverID, aCoverVariable - 3, aTileEntity, aTimer);
+ }
+ }
}
return aCoverVariable;
}
@@ -58,17 +79,24 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior {
}
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 3;
+ aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 5;
if(aCoverVariable <0){aCoverVariable = 2;}
if (aCoverVariable == 0) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("003", "Normal"));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("003", "Enable with Signal"));
}
if (aCoverVariable == 1) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("004", "Inverted"));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("004", "Disable with Signal"));
}
if (aCoverVariable == 2) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("005", "No Work at all"));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("005", "Disabled"));
}
+ if (aCoverVariable == 3) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("505", "Enable with Signal (Safe)"));
+ }
+ if (aCoverVariable == 4) {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("506", "Disable with Signal (Safe)"));
+ }
+ // TODO: Set lastPlayer
return aCoverVariable;
}
@@ -110,6 +138,8 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior {
b = new GT_GuiIconButton(this, 0, startX + spaceX * 0, startY + spaceY * 0, GT_GuiIcon.REDSTONE_ON);
b = new GT_GuiIconButton(this, 1, startX + spaceX * 0, startY + spaceY * 1, GT_GuiIcon.REDSTONE_OFF);
b = new GT_GuiIconButton(this, 2, startX + spaceX * 0, startY + spaceY * 2, GT_GuiIcon.CROSS);
+
+ b = new GT_GuiIconCheckButton(this, 3, startX + spaceX * 0, startY + spaceY * 3, GT_GuiIcon.CHECKMARK, GT_GuiIcon.CROSS);
}
@Override
@@ -118,6 +148,7 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior {
this.fontRendererObj.drawString(trans("243", "Enable with Redstone"), 3+startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
this.fontRendererObj.drawString(trans("244", "Disable with Redstone"),3+startX + spaceX*1, 4+startY+spaceY*1, 0xFF555555);
this.fontRendererObj.drawString(trans("245", "Disable machine"), 3+startX + spaceX*1, 4+startY+spaceY*2, 0xFF555555);
+ this.fontRendererObj.drawString(trans("507", "Safe Mode"), 3+startX + spaceX*1, 4+startY+spaceY*3, 0xFF555555);
}
@Override
@@ -127,7 +158,14 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior {
public void buttonClicked(GuiButton btn) {
if (getClickable(btn.id)) {
- coverVariable = getNewCoverVariable(btn.id);
+ int bID = btn.id;
+ if (bID == 3) {
+ ((GT_GuiIconCheckButton) btn).setChecked(!((GT_GuiIconCheckButton) btn).isChecked());
+ } else {
+ coverVariable = getNewCoverVariable(bID);
+ }
+ adjustCoverVariable();
+ // TODO: Set lastPlayer;
GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
}
updateButtons();
@@ -146,7 +184,18 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior {
}
private boolean getClickable(int id) {
- return id != coverVariable;
+ return ((id != coverVariable && id != coverVariable - 3) || id == 3);
}
+
+ private void adjustCoverVariable() {
+ boolean safeMode = ((GT_GuiIconCheckButton) buttonList.get(3)).isChecked();
+ if (safeMode && coverVariable < 2) {
+ coverVariable += 3;
+ }
+ if (!safeMode && coverVariable > 2) {
+ coverVariable -= 3;
+ }
+ }
+
}
}
diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
index e95f508d80..1055991cad 100644
--- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java
+++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
@@ -20,8 +20,29 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
+import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_DOWN;
+import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_EAST;
+import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_NORTH;
+import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_SOUTH;
+import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_UP;
+import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_WEST;
+import static gregtech.api.interfaces.metatileentity.IConnectable.HAS_FRESHFOAM;
+import static gregtech.api.interfaces.metatileentity.IConnectable.HAS_HARDENEDFOAM;
+import static gregtech.api.interfaces.metatileentity.IConnectable.NO_CONNECTION;
+import static net.minecraftforge.common.util.ForgeDirection.DOWN;
+import static net.minecraftforge.common.util.ForgeDirection.EAST;
+import static net.minecraftforge.common.util.ForgeDirection.NORTH;
+import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
+import static net.minecraftforge.common.util.ForgeDirection.UP;
+import static net.minecraftforge.common.util.ForgeDirection.VALID_DIRECTIONS;
+import static net.minecraftforge.common.util.ForgeDirection.WEST;
+
public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
- private static final float NoZFightOffset = 1.0F / 16384.0F;
+ public static final float blockMin = 0.0F;
+ public static final float blockMax = 1.0F;
+ private static final float coverThickness = blockMax / 8.0F;
+ private static final float coverInnerMin = blockMin + coverThickness;
+ private static final float coverInnerMax = blockMax - coverThickness;
public static GT_Renderer_Block INSTANCE;
public final int mRenderID;
@@ -31,391 +52,510 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
RenderingRegistry.registerBlockHandler(this);
}
- private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) {
- if ((aMeta <= 0) || (aMeta >= GregTech_API.METATILEENTITIES.length)) {
- return;
+ public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof IPipeRenderedTileEntity)) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{
+ ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) DOWN.ordinal()),
+ ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) UP.ordinal()),
+ ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) NORTH.ordinal()),
+ ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) SOUTH.ordinal()),
+ ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) WEST.ordinal()),
+ ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) EAST.ordinal())});
}
- IMetaTileEntity tMetaTileEntity = GregTech_API.METATILEENTITIES[aMeta];
- if (tMetaTileEntity == null) {
- return;
+ if ((tTileEntity instanceof ITexturedTileEntity)) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{
+ ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) DOWN.ordinal()),
+ ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) UP.ordinal()),
+ ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) NORTH.ordinal()),
+ ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) SOUTH.ordinal()),
+ ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) WEST.ordinal()),
+ ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) EAST.ordinal())});
}
- aBlock.setBlockBoundsForItemRender();
+ return false;
+ }
+
+ public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer, ITexture[][] aTextures) {
+ aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax);
aRenderer.setRenderBoundsFromBlock(aBlock);
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- if ((tMetaTileEntity.getBaseMetaTileEntity() instanceof IPipeRenderedTileEntity)) {
- float tThickness = ((IPipeRenderedTileEntity) tMetaTileEntity.getBaseMetaTileEntity()).getThickNess();
- float sp = (1.0F - tThickness) / 2.0F;
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[DOWN.ordinal()], true);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[UP.ordinal()], true);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[NORTH.ordinal()], true);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SOUTH.ordinal()], true);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[WEST.ordinal()], true);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[EAST.ordinal()], true);
+ return true;
+ }
+
+ public static boolean renderPipeBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, IPipeRenderedTileEntity aTileEntity, RenderBlocks aRenderer) {
+ final byte aConnections = aTileEntity.getConnections();
+ if ((aConnections & (HAS_FRESHFOAM | HAS_HARDENEDFOAM)) != 0) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
+ }
+ final float thickness = aTileEntity.getThickNess();
+ if (thickness >= 0.99F) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
+ }
+ // Range of block occupied by pipe
+ final float pipeMin = (blockMax - thickness) / 2.0F;
+ final float pipeMax = blockMax - pipeMin;
+ final boolean[] tIsCovered = new boolean[VALID_DIRECTIONS.length];
+ for (int i = 0; i < VALID_DIRECTIONS.length; i++) {
+ tIsCovered[i] = (aTileEntity.getCoverIDAtSide((byte) i) != 0);
+ }
- aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
+ final ITexture[][] tIcons = new ITexture[VALID_DIRECTIONS.length][];
+ final ITexture[][] tCovers = new ITexture[VALID_DIRECTIONS.length][];
+ for (int i = 0; i < VALID_DIRECTIONS.length; i++) {
+ tCovers[i] = aTileEntity.getTexture(aBlock, (byte) i);
+ tIcons[i] = aTileEntity.getTextureUncovered((byte) i);
+ }
+
+ switch (aConnections) {
+ case NO_CONNECTION:
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+ break;
+ case CONNECTED_EAST | CONNECTED_WEST:
+ // EAST - WEST Pipe Sides
+ aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+
+ // EAST - WEST Pipe Ends
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+ break;
+ case CONNECTED_DOWN | CONNECTED_UP:
+ // UP - DOWN Pipe Sides
+ aBlock.setBlockBounds(pipeMin, blockMin, pipeMin, pipeMax, blockMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+
+ // UP - DOWN Pipe Ends
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ break;
+ case CONNECTED_NORTH | CONNECTED_SOUTH:
+ // NORTH - SOUTH Pipe Sides
+ aBlock.setBlockBounds(pipeMin, pipeMin, blockMin, pipeMax, pipeMax, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+
+ // NORTH - SOUTH Pipe Ends
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ break;
+ default:
+ if ((aConnections & CONNECTED_WEST) == 0) {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ } else {
+ aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, pipeMin, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ }
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+
+ if ((aConnections & CONNECTED_EAST) == 0) {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ } else {
+ aBlock.setBlockBounds(pipeMax, pipeMin, pipeMin, blockMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ }
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+
+ if ((aConnections & CONNECTED_DOWN) == 0) {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ } else {
+ aBlock.setBlockBounds(pipeMin, blockMin, pipeMin, pipeMax, pipeMin, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+ }
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+
+ if ((aConnections & CONNECTED_UP) == 0) {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ } else {
+ aBlock.setBlockBounds(pipeMin, pipeMax, pipeMin, pipeMax, blockMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+ }
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+
+ if ((aConnections & CONNECTED_NORTH) == 0) {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ } else {
+ aBlock.setBlockBounds(pipeMin, pipeMin, blockMin, pipeMax, pipeMax, pipeMin);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+ }
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false);
+
+ if ((aConnections & CONNECTED_SOUTH) == 0) {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ } else {
+ aBlock.setBlockBounds(pipeMin, pipeMin, pipeMax, pipeMax, pipeMax, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false);
+ }
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false);
+ break;
+ }
+
+ // Render covers on pipes
+ if (tIsCovered[DOWN.ordinal()]) {
+ aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, coverInnerMin, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!tIsCovered[NORTH.ordinal()]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ }
+ if (!tIsCovered[SOUTH.ordinal()]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ }
+ if (!tIsCovered[WEST.ordinal()]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ }
+ if (!tIsCovered[EAST.ordinal()]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ }
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ if ((aConnections & CONNECTED_DOWN) != 0) {
+ // Split outer face to leave hole for pipe
+ // Lower panel
+ aRenderer.setRenderBounds(blockMin, blockMin, blockMin, blockMax, blockMin, pipeMin);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ // Upper panel
+ aRenderer.setRenderBounds(blockMin, blockMin, pipeMax, blockMax, blockMin, blockMax);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ // Middle left panel
+ aRenderer.setRenderBounds(blockMin, blockMin, pipeMin, pipeMin, blockMin, pipeMax);
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ // Middle right panel
+ aRenderer.setRenderBounds(pipeMax, blockMin, pipeMin, blockMax, blockMin, pipeMax);
+ }
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[DOWN.ordinal()], false);
+ }
+
+ if (tIsCovered[UP.ordinal()]) {
+ aBlock.setBlockBounds(blockMin, coverInnerMax, blockMin, blockMax, blockMax, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!tIsCovered[NORTH.ordinal()]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ }
+ if (!tIsCovered[SOUTH.ordinal()]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ }
+ if (!tIsCovered[WEST.ordinal()]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ }
+ if (!tIsCovered[EAST.ordinal()]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ }
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ if ((aConnections & CONNECTED_UP) != 0) {
+ // Split outer face to leave hole for pipe
+ // Lower panel
+ aRenderer.setRenderBounds(blockMin, blockMax, blockMin, blockMax, blockMax, pipeMin);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ // Upper panel
+ aRenderer.setRenderBounds(blockMin, blockMax, pipeMax, blockMax, blockMax, blockMax);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ // Middle left panel
+ aRenderer.setRenderBounds(blockMin, blockMax, pipeMin, pipeMin, blockMax, pipeMax);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ // Middle right panel
+ aRenderer.setRenderBounds(pipeMax, blockMax, pipeMin, blockMax, blockMax, pipeMax);
+ }
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[UP.ordinal()], false);
+ }
+
+ if (tIsCovered[NORTH.ordinal()]) {
+ aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, coverInnerMin);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!tIsCovered[DOWN.ordinal()]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ }
+ if (!tIsCovered[UP.ordinal()]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ }
+ if (!tIsCovered[WEST.ordinal()]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ }
+ if (!tIsCovered[EAST.ordinal()]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ }
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ if ((aConnections & CONNECTED_NORTH) != 0) {
+ // Split outer face to leave hole for pipe
+ // Lower panel
+ aRenderer.setRenderBounds(blockMin, blockMin, blockMin, blockMax, pipeMin, blockMin);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ // Upper panel
+ aRenderer.setRenderBounds(blockMin, pipeMax, blockMin, blockMax, blockMax, blockMin);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ // Middle left panel
+ aRenderer.setRenderBounds(blockMin, pipeMin, blockMin, pipeMin, pipeMax, blockMin);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ // Middle right panel
+ aRenderer.setRenderBounds(pipeMax, pipeMin, blockMin, blockMax, pipeMax, blockMin);
+ }
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[NORTH.ordinal()], false);
+ }
+
+ if (tIsCovered[SOUTH.ordinal()]) {
+ aBlock.setBlockBounds(blockMin, blockMin, coverInnerMax, blockMax, blockMax, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!tIsCovered[DOWN.ordinal()]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ }
+ if (!tIsCovered[UP.ordinal()]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ }
+ if (!tIsCovered[WEST.ordinal()]) {
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ }
+ if (!tIsCovered[EAST.ordinal()]) {
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ }
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ if ((aConnections & CONNECTED_SOUTH) != 0) {
+ // Split outer face to leave hole for pipe
+ // Lower panel
+ aRenderer.setRenderBounds(blockMin, blockMin, blockMax, blockMax, pipeMin, blockMax);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ // Upper panel
+ aRenderer.setRenderBounds(blockMin, pipeMax, blockMax, blockMax, blockMax, blockMax);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ // Middle left panel
+ aRenderer.setRenderBounds(blockMin, pipeMin, blockMax, pipeMin, pipeMax, blockMax);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ // Middle right panel
+ aRenderer.setRenderBounds(pipeMax, pipeMin, blockMax, blockMax, pipeMax, blockMax);
+ }
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[SOUTH.ordinal()], false);
+ }
+
+ if (tIsCovered[WEST.ordinal()]) {
+ aBlock.setBlockBounds(blockMin, blockMin, blockMin, coverInnerMin, blockMax, blockMax);
aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!tIsCovered[DOWN.ordinal()]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ }
+ if (!tIsCovered[UP.ordinal()]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ }
+ if (!tIsCovered[NORTH.ordinal()]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ }
+ if (!tIsCovered[SOUTH.ordinal()]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ }
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ if ((aConnections & CONNECTED_WEST) != 0) {
+ // Split outer face to leave hole for pipe
+ // Lower panel
+ aRenderer.setRenderBounds(blockMin, blockMin, blockMin, blockMin, pipeMin, blockMax);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ // Upper panel
+ aRenderer.setRenderBounds(blockMin, pipeMax, blockMin, blockMin, blockMax, blockMax);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ // Middle left panel
+ aRenderer.setRenderBounds(blockMin, pipeMin, blockMin, blockMin, pipeMax, pipeMin);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ // Middle right panel
+ aRenderer.setRenderBounds(blockMin, pipeMin, pipeMax, blockMin, pipeMax, blockMax);
+ }
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[WEST.ordinal()], false);
+ }
+
+ if (tIsCovered[EAST.ordinal()]) {
+ aBlock.setBlockBounds(coverInnerMax, blockMin, blockMin, blockMax, blockMax, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ if (!tIsCovered[DOWN.ordinal()]) {
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ }
+ if (!tIsCovered[UP.ordinal()]) {
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ }
+ if (!tIsCovered[NORTH.ordinal()]) {
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ }
+ if (!tIsCovered[SOUTH.ordinal()]) {
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ }
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
- renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 0, (byte) 9, (byte) -1, false, false), true);
- Tessellator.instance.draw();
+ if ((aConnections & CONNECTED_EAST) != 0) {
+ // Split outer face to leave hole for pipe
+ // Lower panel
+ aRenderer.setRenderBounds(blockMax, blockMin, blockMin, blockMax, pipeMin, blockMax);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ // Upper panel
+ aRenderer.setRenderBounds(blockMax, pipeMax, blockMin, blockMax, blockMax, blockMax);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ // Middle left panel
+ aRenderer.setRenderBounds(blockMax, pipeMin, blockMin, blockMax, pipeMax, pipeMin);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ // Middle right panel
+ aRenderer.setRenderBounds(blockMax, pipeMin, pipeMax, blockMax, pipeMax, blockMax);
+ }
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[EAST.ordinal()], false);
+ }
+ aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
- renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 1, (byte) 9, (byte) -1, false, false), true);
- Tessellator.instance.draw();
+ return true;
+ }
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
- renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 2, (byte) 9, (byte) -1, false, false), true);
- Tessellator.instance.draw();
+ public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) {
+ aRenderer.enableAO = false;
+ aRenderer.useInventoryTint = true;
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
- renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 3, (byte) 9, (byte) -1, false, false), true);
- Tessellator.instance.draw();
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
- renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 4, (byte) 9, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+
+ if ((aBlock instanceof GT_Block_Machines)) {
+ if ((aMeta > 0)
+ && (aMeta < GregTech_API.METATILEENTITIES.length)
+ && (GregTech_API.METATILEENTITIES[aMeta] != null)
+ && (!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) {
+ renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer);
+ }
+ } else if ((aBlock instanceof GT_Block_Ores_Abstract)) {
+ GT_TileEntity_Ores tTileEntity = new GT_TileEntity_Ores();
+ tTileEntity.mMetaData = ((short) aMeta);
+
+ aBlock.setBlockBoundsForItemRender();
+ aRenderer.setRenderBoundsFromBlock(aBlock);
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
- renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 5, (byte) 9, (byte) -1, true, false), true);
- Tessellator.instance.draw();
- } else {
- Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
- renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 0, (byte) 4, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) DOWN.ordinal()), true);
- Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
- renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 1, (byte) 4, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) UP.ordinal()), true);
- Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
- renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 2, (byte) 4, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) NORTH.ordinal()), true);
- Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
- renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 3, (byte) 4, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) SOUTH.ordinal()), true);
- Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
- renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 4, (byte) 4, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) WEST.ordinal()), true);
- Tessellator.instance.startDrawingQuads();
Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
- renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(tMetaTileEntity.getBaseMetaTileEntity(), (byte) 5, (byte) 4, (byte) -1, true, false), true);
- Tessellator.instance.draw();
+ renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) EAST.ordinal()), true);
+
}
- aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ Tessellator.instance.draw();
+
+ aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax);
aRenderer.setRenderBoundsFromBlock(aBlock);
+
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ aRenderer.useInventoryTint = false;
}
- public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IPipeRenderedTileEntity)) {
- return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{
- ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) 0),
- ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) 1),
- ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) 2),
- ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) 3),
- ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) 4),
- ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) 5)});
+ private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) {
+ if ((aMeta <= 0) || (aMeta >= GregTech_API.METATILEENTITIES.length)) {
+ return;
}
- if ((tTileEntity instanceof ITexturedTileEntity)) {
- return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{
- ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0),
- ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1),
- ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2),
- ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3),
- ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4),
- ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)});
+ IMetaTileEntity tMetaTileEntity = GregTech_API.METATILEENTITIES[aMeta];
+ if (tMetaTileEntity == null) {
+ return;
}
- return false;
- }
-
- public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer, ITexture[][] aTextures) {
- aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aBlock.setBlockBoundsForItemRender();
aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true);
- return true;
- }
+ final IGregTechTileEntity iGregTechTileEntity = tMetaTileEntity.getBaseMetaTileEntity();
- public static boolean renderPipeBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, IPipeRenderedTileEntity aTileEntity, RenderBlocks aRenderer) {
- byte aConnections = aTileEntity.getConnections();
- if ((aConnections & 0xC0) != 0) {
- return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
- }
- float tThickness = aTileEntity.getThickNess();
- if (tThickness >= 0.99F) {
- return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
- }
- float sp = (1.0F - tThickness) / 2.0F;
+ if ((iGregTechTileEntity instanceof IPipeRenderedTileEntity)) {
+ final float tThickness = ((IPipeRenderedTileEntity) iGregTechTileEntity).getThickNess();
+ final float pipeMin = (blockMax - tThickness) / 2.0F;
+ final float pipeMax = blockMax - pipeMin;
- byte tConnections = 0;
- for (byte i = 0; i < 6; i = (byte) (i + 1)) {
- if ((aConnections & 1 << i) != 0) {
- tConnections = (byte) (tConnections | 1 << (i + 2) % 6);
- }
- }
- boolean[] tIsCovered = new boolean[6];
- for (byte i = 0; i < 6; i = (byte) (i + 1)) {
- tIsCovered[i] = (aTileEntity.getCoverIDAtSide(i) != 0);
- }
- if ((tIsCovered[0]) && (tIsCovered[1]) && (tIsCovered[2]) && (tIsCovered[3]) && (tIsCovered[4]) && (tIsCovered[5])) {
- return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
- }
- ITexture[][] tIcons = new ITexture[6][];
- ITexture[][] tCovers = new ITexture[6][];
- for (byte i = 0; i < 6; i = (byte) (i + 1)) {
- tCovers[i] = aTileEntity.getTexture(aBlock, i);
- tIcons[i] = aTileEntity.getTextureUncovered(i);
- }
- if (tConnections == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
+ aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax);
aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
- } else if (tConnections == 3) {
- aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
- } else if (tConnections == 12) {
- aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, 1.0F, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
+ Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
- } else if (tConnections == 48) {
- aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
+ Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
+ renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true);
+ Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
+ renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true);
} else {
- if ((tConnections & 0x1) == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- } else {
- aBlock.setBlockBounds(0.0F, sp, sp, sp, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
-
- }
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- if ((tConnections & 0x2) == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- } else {
- aBlock.setBlockBounds(sp + tThickness, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
+ Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true);
- }
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
- if ((tConnections & 0x4) == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- } else {
- aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, sp, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true);
- }
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- if ((tConnections & 0x8) == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- } else {
- aBlock.setBlockBounds(sp, sp + tThickness, sp, sp + tThickness, 1.0F, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true);
- }
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- if ((tConnections & 0x10) == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- } else {
- aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, sp);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true);
- }
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- if ((tConnections & 0x20) == 0) {
- aBlock.setBlockBounds(sp, sp, sp, sp + tThickness, sp + tThickness, sp + tThickness);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- } else {
- aBlock.setBlockBounds(sp, sp, sp + tThickness, sp + tThickness, sp + tThickness, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false);
+ Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
+ renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true);
- }
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- }
- if (tIsCovered[0]) {
- aBlock.setBlockBounds(0.0F, 0.0F + NoZFightOffset, 0.0F, 1.0F, 0.125F, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
- if (!tIsCovered[2]) {
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
- }
- if (!tIsCovered[3]) {
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
- }
- if (!tIsCovered[4]) {
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
- }
- if (!tIsCovered[5]) {
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false);
- }
- }
- if (tIsCovered[1]) {
- aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F - NoZFightOffset, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
- if (!tIsCovered[2]) {
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
- }
- if (!tIsCovered[3]) {
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
- }
- if (!tIsCovered[4]) {
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
- }
- if (!tIsCovered[5]) {
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false);
- }
- }
- if (tIsCovered[2]) {
- aBlock.setBlockBounds(0.0F, 0.0F, 0.0F + NoZFightOffset, 1.0F, 1.0F, 0.125F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- if (!tIsCovered[0]) {
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
- }
- if (!tIsCovered[1]) {
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
- }
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
- if (!tIsCovered[4]) {
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
- }
- if (!tIsCovered[5]) {
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false);
- }
- }
- if (tIsCovered[3]) {
- aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F - NoZFightOffset);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- if (!tIsCovered[0]) {
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
- }
- if (!tIsCovered[1]) {
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
- }
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
- if (!tIsCovered[4]) {
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
- }
- if (!tIsCovered[5]) {
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false);
- }
- }
- if (tIsCovered[4]) {
- aBlock.setBlockBounds(0.0F + NoZFightOffset, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- if (!tIsCovered[0]) {
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
- }
- if (!tIsCovered[1]) {
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
- }
- if (!tIsCovered[2]) {
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
- }
- if (!tIsCovered[3]) {
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
- }
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false);
- }
- if (tIsCovered[5]) {
- aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F - NoZFightOffset, 1.0F, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- if (!tIsCovered[0]) {
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
- }
- if (!tIsCovered[1]) {
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
- }
- if (!tIsCovered[2]) {
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
- }
- if (!tIsCovered[3]) {
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
- }
- renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
- renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false);
+ Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
+ renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true);
}
- aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
-
- return true;
}
public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
@@ -496,60 +636,9 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
}
}
- public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) {
- aRenderer.enableAO = false;
- if ((aBlock instanceof GT_Block_Machines)) {
- if ((aMeta > 0) && (aMeta < GregTech_API.METATILEENTITIES.length) && (GregTech_API.METATILEENTITIES[aMeta] != null) &&
- (!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) {
- renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer);
- }
- } else if ((aBlock instanceof GT_Block_Ores_Abstract)) {
- GT_TileEntity_Ores tTileEntity = new GT_TileEntity_Ores();
- tTileEntity.mMetaData = ((short) aMeta);
-
- aBlock.setBlockBoundsForItemRender();
- aRenderer.setRenderBoundsFromBlock(aBlock);
-
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
-
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
- renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 0), true);
- Tessellator.instance.draw();
-
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
- renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 1), true);
- Tessellator.instance.draw();
-
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
- renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 2), true);
- Tessellator.instance.draw();
-
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
- renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 3), true);
- Tessellator.instance.draw();
-
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
- renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 4), true);
- Tessellator.instance.draw();
-
- Tessellator.instance.startDrawingQuads();
- Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
- renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) 5), true);
- Tessellator.instance.draw();
- }
- aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- aRenderer.setRenderBoundsFromBlock(aBlock);
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
-
public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) {
aRenderer.enableAO = Minecraft.isAmbientOcclusionEnabled() && GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion;
+ aRenderer.useInventoryTint = false;
TileEntity tileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tileEntity == null) return false;
if (tileEntity instanceof IGregTechTileEntity) {
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java
index af7b2e2441..7cef8278be 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java
@@ -2,13 +2,14 @@ package gregtech.common.tileentities.boilers;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
+import gregtech.common.GT_Pollution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -25,6 +26,7 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
public int mLossTimer = 0;
public FluidStack mSteam = null;
public boolean mHadNoWater = false;
+ private int mExcessWater = 0;
public GT_MetaTileEntity_Boiler(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures);
@@ -42,6 +44,7 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
super(aName, aTier, 4, aDescription, aTextures);
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) : aSide][aColorIndex + 1];
if (aSide != aFacing && tmp.length == 2) {
@@ -50,49 +53,59 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
return tmp;
}
+ @Override
public boolean isElectric() {
return false;
}
+ @Override
public boolean isPneumatic() {
return false;
}
+ @Override
public boolean isSteampowered() {
return false;
}
+ @Override
public boolean isSimpleMachine() {
return false;
}
+ @Override
public boolean isFacingValid(byte aFacing) {
return aFacing > 1;
}
+ @Override
public boolean isAccessAllowed(EntityPlayer aPlayer) {
return true;
}
+ @Override
public boolean isValidSlot(int aIndex) {
return true;
}
+ @Override
public int getProgresstime() {
return this.mTemperature;
}
+ @Override
public int maxProgresstime() {
return 500;
}
+ @Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
if (aBaseMetaTileEntity.isClientSide()) {
return true;
}
if (aPlayer != null) {
if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) {
- fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true);
+ fill(Materials.Water.getFluid(1000L * (long) aPlayer.getCurrentEquippedItem().stackSize), true);
aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket);
} else {
aBaseMetaTileEntity.openGUI(aPlayer);
@@ -101,38 +114,47 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
return true;
}
+ @Override
public boolean doesFillContainers() {
return true;
}
+ @Override
public boolean doesEmptyContainers() {
return true;
}
+ @Override
public boolean canTankBeFilled() {
return true;
}
+ @Override
public boolean canTankBeEmptied() {
return true;
}
+ @Override
public boolean displaysItemStack() {
return false;
}
+ @Override
public boolean displaysStackSize() {
return false;
}
+ @Override
public boolean isFluidInputAllowed(FluidStack aFluid) {
return GT_ModHandler.isWater(aFluid);
}
+ @Override
public FluidStack getDrainableStack() {
return this.mSteam;
}
+ @Override
public FluidStack setDrainableStack(FluidStack aFluid) {
this.mSteam = aFluid;
return this.mSteam;
@@ -143,128 +165,169 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
return true;
}
+ @Override
public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) {
return GregTech_API.getCoverBehavior(aCover.toStack()).isSimpleCover();
}
+ @Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setInteger("mLossTimer", this.mLossTimer);
aNBT.setInteger("mTemperature", this.mTemperature);
aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy);
- if (this.mSteam != null) {
- try {
- aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound()));
- } catch (Throwable ignored) {
- }
+ aNBT.setInteger("mExcessWater", this.mExcessWater);
+ if (this.mSteam == null) {
+ return;
}
+ try {
+ aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound()));
+ } catch (Throwable ignored) {}
}
+ @Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
this.mLossTimer = aNBT.getInteger("mLossTimer");
this.mTemperature = aNBT.getInteger("mTemperature");
this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy");
+ this.mExcessWater = aNBT.getInteger("mExcessWater");
this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam"));
}
+ /**
+ * Produce some steam. Assume water is present.
+ */
+ protected void produceSteam(int aAmount) {
+ mExcessWater -= aAmount;
+ if (mExcessWater < 0) {
+ int tWaterToConsume = -mExcessWater / GT_Values.STEAM_PER_WATER;
+ mFluid.amount -= tWaterToConsume;
+ mExcessWater += GT_Values.STEAM_PER_WATER * tWaterToConsume;
+ }
+ if (GT_ModHandler.isSteam(this.mSteam)) {
+ this.mSteam.amount += aAmount;
+ } else {
+ this.mSteam = GT_ModHandler.getSteam(aAmount);
+ }
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) {
- if (this.mTemperature <= 20) {
- this.mTemperature = 20;
- this.mLossTimer = 0;
- }
- if (++this.mLossTimer > 40) {
- this.mTemperature -= 1;
- this.mLossTimer = 0;
- }
- for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte) (i + 1)) {
- if (i != aBaseMetaTileEntity.getFrontFacing()) {
- IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
- if (tTileEntity != null) {
- FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
- if (tDrained != null) {
- int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
- if (tFilledAmount > 0) {
- tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
- }
- }
- }
- }
- }
- if (aTick % 10L == 0L) {
- if (this.mTemperature > 100) {
- if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) {
- this.mHadNoWater = true;
- } else {
- if (this.mHadNoWater) {
- GT_Log.exp.println("Boiler "+this.mName+" had no Water!");
- aBaseMetaTileEntity.doExplosion(2048L);
- return;
- }
- this.mFluid.amount -= 1;
- if (this.mSteam == null) {
- this.mSteam = GT_ModHandler.getSteam(150L);
- } else if (GT_ModHandler.isSteam(this.mSteam)) {
- this.mSteam.amount += 150;
- } else {
- this.mSteam = GT_ModHandler.getSteam(150L);
- }
- }
- } else {
- this.mHadNoWater = false;
- }
- }
- if ((this.mSteam != null) &&
- (this.mSteam.amount > 32000)) {
- sendSound((byte) 1);
- this.mSteam.amount = 24000;
- }
- if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) &&
- (this.mInventory[2] != null)) {
- if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) {
- this.mProcessingEnergy += 160;
- aBaseMetaTileEntity.decrStackSize(2, 1);
- if (aBaseMetaTileEntity.getRandomNumber(3) == 0) {
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));
- }
- } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) {
- this.mProcessingEnergy += 160;
- aBaseMetaTileEntity.decrStackSize(2, 1);
- if (aBaseMetaTileEntity.getRandomNumber(3) == 0) {
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L));
- }
- } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) {
- this.mProcessingEnergy += 640;
- aBaseMetaTileEntity.decrStackSize(2, 1);
- if (aBaseMetaTileEntity.getRandomNumber(2) == 0) {
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L));
- }
- } else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) {
- this.mProcessingEnergy += 120;
- aBaseMetaTileEntity.decrStackSize(2, 1);
- if (aBaseMetaTileEntity.getRandomNumber(8) == 0) {
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));
- }
+ pollute(aTick);
+
+ if (isNotAllowedToWork(aBaseMetaTileEntity, aTick))
+ return;
+
+ calculateCooldown();
+ pushSteamToInventories(aBaseMetaTileEntity);
+
+ if (canNotCreateSteam(aBaseMetaTileEntity, aTick)) {
+ pollute(aTick);
+ return;
+ }
+
+ ventSteamIfTankIsFull();
+ updateFuelTimed(aBaseMetaTileEntity, aTick);
+ calculateHeatUp(aBaseMetaTileEntity, aTick);
+ }
+
+ private boolean isNotAllowedToWork(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ return (!aBaseMetaTileEntity.isServerSide()) || (aTick <= 20L);
+ }
+
+ private void pollute(long aTick) {
+ if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) {
+ GT_Pollution.addPollution(getBaseMetaTileEntity(), getPollution());
+ }
+ }
+
+ private void calculateHeatUp(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if ((this.mTemperature < getMaxTemperature()) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) {
+ this.mProcessingEnergy -= getEnergyConsumption();
+ this.mTemperature += getHeatUpAmount();
+ }
+ aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ }
+
+ private void updateFuelTimed(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()))
+ updateFuel(aBaseMetaTileEntity, aTick);
+ }
+
+ private void ventSteamIfTankIsFull() {
+ if ((this.mSteam != null) && (this.mSteam.amount > getCapacity())) {
+ sendSound((byte) 1);
+ this.mSteam.amount = getCapacity() * 3 / 4;
+ }
+ }
+
+ private boolean canNotCreateSteam(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aTick % 10L != 0L) {
+ return false;
+ }
+
+ if (this.mTemperature > 100) {
+ if ((!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) {
+ this.mHadNoWater = true;
+ } else {
+ if (this.mHadNoWater) {
+ GT_Log.exp.println("Boiler "+this.mName+" had no Water!");
+ aBaseMetaTileEntity.doExplosion(2048L);
+ return true;
}
+ produceSteam(getProductionPerSecond() / 2);
}
- if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) {
- this.mProcessingEnergy -= 2;
- this.mTemperature += 1;
- }
- aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ } else {
+ this.mHadNoWater = false;
}
+ return false;
}
+ protected final void pushSteamToSide(IGregTechTileEntity aBaseMetaTileEntity, int aSide) {
+ IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide((byte) aSide);
+ if (tTileEntity == null)
+ return;
+ FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aSide), Math.max(1, this.mSteam.amount / 2), false);
+ if (tDrained == null)
+ return;
+ int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tDrained, false);
+ if (tFilledAmount <= 0)
+ return;
+ tTileEntity.fill(ForgeDirection.getOrientation(aSide).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aSide), tFilledAmount, true), true);
+ }
+
+ protected void pushSteamToInventories(IGregTechTileEntity aBaseMetaTileEntity) {
+ for (int i = 1; (this.mSteam != null) && (i < 6); i++) {
+ if (i == aBaseMetaTileEntity.getFrontFacing())
+ continue;
+ pushSteamToSide(aBaseMetaTileEntity, i);
+ }
+ }
+
+ private void calculateCooldown() {
+ if (this.mTemperature <= 20) {
+ this.mTemperature = 20;
+ this.mLossTimer = 0;
+ } else if (++this.mLossTimer > getCooldownInterval()) {
+ // only loss temperature if hot
+ this.mTemperature -= 1;
+ this.mLossTimer = 0;
+ }
+ }
+
+ @Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation;
}
+ @Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation;
}
+ @Override
public void doSound(byte aIndex, double aX, double aY, double aZ) {
if (aIndex == 1) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 2, 1.0F, aX, aY, aZ);
@@ -283,11 +346,33 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
}
}
+ @Override
+ public int getTankPressure() {
+ return 100;
+ }
+
+ protected boolean isOutputToFront() {
+ return false;
+ }
+
+ protected abstract int getPollution();
+
+ @Override
public int getCapacity() {
return 16000;
}
- public int getTankPressure() {
- return 100;
+ protected abstract int getProductionPerSecond();
+
+ protected abstract int getMaxTemperature();
+
+ protected abstract int getEnergyConsumption();
+
+ protected abstract int getCooldownInterval();
+
+ protected int getHeatUpAmount() {
+ return 1;
}
+
+ protected abstract void updateFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick);
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
index 2662d18276..d218266fa1 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
@@ -9,8 +9,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
@@ -19,9 +17,6 @@ import gregtech.common.gui.GT_GUIContainer_Boiler;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntityFurnace;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler {
public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional) {
@@ -72,130 +67,98 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler {
}
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- singleBlockBoilerLogic(aBaseMetaTileEntity,aTick,1,45,25L,20);
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L) && this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) {
+ GT_Pollution.addPollution(getBaseMetaTileEntity(), getPollution());
+ }
}
- protected void singleBlockBoilerLogic(IGregTechTileEntity aBaseMetaTileEntity, long aTick, int aMultiplier, int aTimer, long aTickDivider, int aPollution){
- if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) {
- if (this.mTemperature <= 20) {
- this.mTemperature = 20;
- this.mLossTimer = 0;
- }
- if (++this.mLossTimer > aTimer) {
- this.mTemperature -= 1;
- this.mLossTimer = 0;
- }
- for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte) (i + 1)) {
- if (i != aBaseMetaTileEntity.getFrontFacing()) {
- IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
- if (tTileEntity != null) {
- FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
- if (tDrained != null) {
- int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
- if (tFilledAmount > 0) {
- tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
- }
- }
- }
- }
- }
- if (aTick % aTickDivider == 0L) {
- if (this.mTemperature > 100) {
- if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) {
- this.mHadNoWater = true;
- } else {
- if (this.mHadNoWater) {
- GT_Log.exp.println("Boiler "+this.mName+" had no Water!");
- aBaseMetaTileEntity.doExplosion(2048L);
- return;
- }
- this.mFluid.amount -= 1;
- if (this.mSteam == null) {
- this.mSteam = GT_ModHandler.getSteam(150L);
- } else if (GT_ModHandler.isSteam(this.mSteam)) {
- this.mSteam.amount += 150;
- } else {
- this.mSteam = GT_ModHandler.getSteam(150L);
- }
- }
- } else {
- this.mHadNoWater = false;
- }
- }
- if ((this.mSteam != null) &&
- (this.mSteam.amount > (16000*aMultiplier))) {
- sendSound((byte) 1);
- this.mSteam.amount = (12000*aMultiplier);
- }
- if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) &&
- (this.mInventory[2] != null)) {
- if (
- (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
- (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
- (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
- (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Diamond) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke") ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCharcoal") ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCoke") ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCharcoal") ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCoke")
- ) {
- if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) {
- this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10);
- aBaseMetaTileEntity.decrStackSize(2, 1);
- if (XSTR.XSTR_INSTANCE.nextInt(GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) ? 3 : GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) ? 8 : 2 ) == 0) {
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal)) ? Materials.DarkAsh : Materials.Ash, 1L));
- }
- }
- }
- else if (
- //If its a block of the following materials
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Coal)) ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Lignite)) ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Charcoal))||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Diamond)) ||
-
- //if its either a Railcraft Coke Block or a custom GTNH compressed Coal/charcoal/lignite/coke block
- (
- Block.getBlockFromItem(this.mInventory[2].getItem()) != null && //check if the block exists
- (
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("tile") && //check if the block is a tile -> block
- (
- //If the name of the block contains these names
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("charcoal") ||
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coal") ||
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("diamond") ||
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coke") ||
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("railcraft.cube") ||
- Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("lignite")
- )
- )
- )
- ){
- //try to add 10% of the burnvalue as Processing energy, no boost for coal coke here
- if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) {
- this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10);
- aBaseMetaTileEntity.decrStackSize(2, 1);
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dust, (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) || Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coal") || Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("lignite") ) ? Materials.DarkAsh : Materials.Ash, 1L));
- }
- //enables every other fuel with at least 2000 burntime as a fuel, i.e. peat, Magic/Solid Super Fuel, Coal Singularities, Nitor, while bucket of creosite should be blocked same goes for lava
- }else if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])) >= 2000 && !(this.mInventory[2].getUnlocalizedName().toLowerCase().contains("bucket") || this.mInventory[2].getUnlocalizedName().toLowerCase().contains("cell"))){
- this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10);
- aBaseMetaTileEntity.decrStackSize(2, 1);
- //adds tiny pile of ash for burntime under 10k, small pile for under 100k and pile for bigger values
- if (XSTR.XSTR_INSTANCE.nextInt(2) == 0)
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get( (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 10000 ? TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 100000 ? OrePrefixes.dust : OrePrefixes.dustSmall : OrePrefixes.dustTiny), Materials.Ash, 1L));
+ @Override
+ protected int getPollution() {
+ return 20;
+ }
+
+ @Override
+ protected int getProductionPerSecond() {
+ return 120;
+ }
+
+ @Override
+ protected int getMaxTemperature() {
+ return 500;
+ }
+
+ @Override
+ protected int getEnergyConsumption() {
+ return 1;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return 45;
+ }
+
+ @Override
+ protected void updateFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (this.mInventory[2] == null) return;
+ if (
+ (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
+ (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
+ (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
+ (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Diamond) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCharcoal") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCoke") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCharcoal") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCoke")
+ ) {
+ if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) {
+ this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10);
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ if (XSTR.XSTR_INSTANCE.nextInt(GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) ? 3 : GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) ? 8 : 2 ) == 0) {
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal)) ? Materials.DarkAsh : Materials.Ash, 1L));
}
}
- if ((this.mTemperature < (500*aMultiplier)) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) {
- this.mProcessingEnergy -= aMultiplier;
- this.mTemperature += 1;
- }
- if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) {
- GT_Pollution.addPollution(getBaseMetaTileEntity(), aPollution);
+ }
+ else if (
+ //If its a block of the following materials
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Coal)) ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Lignite)) ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Charcoal))||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Diamond)) ||
+
+ //if its either a Railcraft Coke Block or a custom GTNH compressed Coal/charcoal/lignite/coke block
+ (
+ Block.getBlockFromItem(this.mInventory[2].getItem()) != null && //check if the block exists
+ (
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("tile") && //check if the block is a tile -> block
+ (
+ //If the name of the block contains these names
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("charcoal") ||
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coal") ||
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("diamond") ||
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coke") ||
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("railcraft.cube") ||
+ Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("lignite")
+ )
+ )
+ )
+ ){
+ //try to add 10% of the burnvalue as Processing energy, no boost for coal coke here
+ if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) {
+ this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10);
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dust, (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) || Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coal") || Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("lignite") ) ? Materials.DarkAsh : Materials.Ash, 1L));
}
- aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ //enables every other fuel with at least 2000 burntime as a fuel, i.e. peat, Magic/Solid Super Fuel, Coal Singularities, Nitor, while bucket of creosite should be blocked same goes for lava
+ }else if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])) >= 2000 && !(this.mInventory[2].getUnlocalizedName().toLowerCase().contains("bucket") || this.mInventory[2].getUnlocalizedName().toLowerCase().contains("cell"))){
+ this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10);
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ //adds tiny pile of ash for burntime under 10k, small pile for under 100k and pile for bigger values
+ if (XSTR.XSTR_INSTANCE.nextInt(2) == 0)
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get( (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 10000 ? TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 100000 ? OrePrefixes.dust : OrePrefixes.dustSmall : OrePrefixes.dustTiny), Materials.Ash, 1L));
}
+
}
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java
index 66b93ea16a..14330f24e7 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java
@@ -8,16 +8,12 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.common.GT_Pollution;
import gregtech.common.gui.GT_Container_Boiler;
import gregtech.common.gui.GT_GUIContainer_Boiler;
import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler {
public GT_MetaTileEntity_Boiler_Lava(int aID, String aName, String aNameRegional) {
@@ -63,73 +59,37 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler {
return new GT_MetaTileEntity_Boiler_Lava(this.mName, this.mTier, this.mDescriptionArray, this.mTextures);
}
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) {
- if (this.mTemperature <= 20) {
- this.mTemperature = 20;
- this.mLossTimer = 0;
- }
- if (++this.mLossTimer > 20) {
- this.mTemperature -= 1;
- this.mLossTimer = 0;
- }
- for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte) (i + 1)) {
- if (i != aBaseMetaTileEntity.getFrontFacing()) {
- IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
- if (tTileEntity != null) {
- FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
- if (tDrained != null) {
- int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
- if (tFilledAmount > 0) {
- tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
- }
- }
- }
- }
- }
- if (aTick % 10L == 0L) {
- if (this.mTemperature > 100) {
- if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) {
- this.mHadNoWater = true;
- } else {
- if (this.mHadNoWater) {
- GT_Log.exp.println("Boiler "+this.mName+" had no Water!");
- aBaseMetaTileEntity.doExplosion(2048L);
- return;
- }
- this.mFluid.amount -= 1;
- if (this.mSteam == null) {
- this.mSteam = GT_ModHandler.getSteam(300L);
- } else if (GT_ModHandler.isSteam(this.mSteam)) {
- this.mSteam.amount += 300;
- } else {
- this.mSteam = GT_ModHandler.getSteam(300L);
- }
- }
- } else {
- this.mHadNoWater = false;
- }
- }
- if ((this.mSteam != null) &&
- (this.mSteam.amount > 32000)) {
- sendSound((byte) 1);
- this.mSteam.amount = 24000;
- }
- if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) &&
- (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucket.get(Materials.Lava)))) {
- this.mProcessingEnergy += 1000;
- aBaseMetaTileEntity.decrStackSize(2, 1);
- aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L));
- }
- if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 8L == 0L)) {
- this.mProcessingEnergy -= 3;
- this.mTemperature += 1;
- }
+ @Override
+ protected int getPollution() {
+ return 20;
+ }
- if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) {
- GT_Pollution.addPollution(getBaseMetaTileEntity(), 20);
- }
- aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ @Override
+ protected int getProductionPerSecond() {
+ return 600;
+ }
+
+ @Override
+ protected int getMaxTemperature() {
+ return 1000;
+ }
+
+ @Override
+ protected int getEnergyConsumption() {
+ return 3;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return 20;
+ }
+
+ @Override
+ protected void updateFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucket.get(Materials.Lava))) {
+ this.mProcessingEnergy += 1000;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L));
}
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java
index 2c79d507eb..3fd061eff5 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java
@@ -1,199 +1,309 @@
package gregtech.common.tileentities.boilers;
import gregtech.api.enums.Dyes;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_Boiler;
import gregtech.common.gui.GT_GUIContainer_Boiler;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
+import static gregtech.api.GregTech_API.sMachineFile;
+import static gregtech.api.enums.ConfigCategories.machineconfig;
public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler {
+ public static final String LPS_FMT = "%s L/s";
+ private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization(
+ "gt.blockmachines.boiler.solar.desc.format",
+ "Steam Power by the Sun%n" +
+ "Produces %sL of Steam per second%n" +
+ "Calcifies over time, reducing Steam output to %sL/s%n" +
+ "Break and replace to descale");
+ protected final Config mConfig;
+ protected int basicTemperatureMod = 5; // Base Celsius gain or loss
+ private int mRunTimeTicks = 0;
+
public GT_MetaTileEntity_Boiler_Solar(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, new String[0]);
+ mConfig = createConfig();
}
public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
+ mConfig = createConfig();
}
public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
+ mConfig = createConfig();
+ }
+
+ protected GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, Config aConfig) {
+ super(aName, aTier, aDescription, aTextures);
+ mConfig = aConfig;
+ }
+
+ protected Config createConfig() {
+ return new Config(machineconfig + ".boiler.solar.bronze",1080000,40,120,45);
+ }
+
+ /**
+ * for WAILA
+ *
+ * @deprecated replaced by {@link #getMaxOutputPerSecond()}
+ */
+ @Deprecated
+ public int getBasicOutput() {
+ return (int) (getMaxOutputPerSecond() * 1.25F);
+ }
+
+ public int getMaxOutputPerSecond() {
+ return mConfig.getMaxOutputPerSecond();
+ }
+
+ /**
+ * for WAILA
+ *
+ * @deprecated replaced by {@link #getProductionPerSecond()}
+ */
+ @SuppressWarnings("unused")
+ @Deprecated
+ public int getCalcificationOutput() {
+ return (int) (getProductionPerSecond() * 1.25F);
}
@Override
public String[] getDescription() {
- return new String[]{
- "Steam Power by the Sun",
- "Produces 120L of Steam per second",
- "Calcifies over time, reducing Steam output to 40L/s",
- "Break and replace to decalcify"};
+ return String.format(localizedDescFormat,
+ GT_Utility.formatNumbers(getMaxOutputPerSecond()),
+ GT_Utility.formatNumbers(getMinOutputPerSecond()))
+ .split("\\R");
}
+ public int getMinOutputPerSecond() {
+ return mConfig.getMinOutputPerSecond();
+ }
+ @Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[4][17][];
- for (byte i = -1; i < 16; i = (byte) (i + 1)) {
- ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))};
- rTextures[0][(i + 1)] = tmp0;
- ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)};
- rTextures[1][(i + 1)] = tmp1;
- ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))};
- rTextures[2][(i + 1)] = tmp2;
- ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)};
- rTextures[3][(i + 1)] = tmp3;
+ for (int color = -1; color < 16; color++) {
+ int i = color + 1;
+ short[] colorModulation = Dyes.getModulation(color, Dyes._NULL.mRGBa);
+ rTextures[0][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, colorModulation)};
+ rTextures[1][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_TOP, colorModulation),
+ new GT_RenderedTexture(BlockIcons.BOILER_SOLAR)};
+ rTextures[2][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation)};
+ rTextures[3][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE)};
}
return rTextures;
}
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return mTextures[aSide >= 2 ? ((byte) (aSide != aFacing ? 2 : 3)) : aSide][aColorIndex + 1];
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, getCapacity());
}
- public int maxProgresstime() {
- return 500;
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", getCapacity());
}
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 16000);
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ int i = aColorIndex + 1;
+ if (aSide >= 2) {
+ if (aSide != aFacing) return mTextures[2][i];
+ return mTextures[3][i];
+ }
+ return mTextures[aSide][i];
}
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000);
+ @Override
+ public int maxProgresstime() {
+ return 500;
}
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescriptionArray, this.mTextures);
- }
-
- private int mRunTime = 0;
-
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- aNBT.setInteger("mRunTime", this.mRunTime);
+ aNBT.setInteger("mRunTime", mRunTimeTicks);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- this.mRunTime = aNBT.getInteger("mRunTime");
+ mRunTimeTicks = aNBT.getInteger("mRunTime");
}
@Override
- public String[] getInfoData() {
- return new String[]{
- "Heat Capacity: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTemperature * 100 / maxProgresstime()) + " % " + EnumChatFormatting.RESET
- + " Hot time: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.mRunTime*25/20)+EnumChatFormatting.RESET+" s",
- "Min output: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.basicMaxOuput*20/25)+EnumChatFormatting.RESET+ " L/s"
- + " Max output: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.basicOutput*20/25)+EnumChatFormatting.RESET+" L/s",
- "Current Output: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCalcificationOutput()*20/25) +EnumChatFormatting.RESET+" L/s"};
+ protected void produceSteam(int aAmount) {
+ super.produceSteam(aAmount);
+ // produceSteam is getting called every 10 ticks
+ if (mRunTimeTicks >= 0 && mRunTimeTicks < (Integer.MAX_VALUE - 10)) mRunTimeTicks += 10;
+ else mRunTimeTicks = Integer.MAX_VALUE; // Prevent Integer overflow wrap
}
@Override
- public boolean isGivingInformation() {
- return true;
+ protected void pushSteamToInventories(IGregTechTileEntity aBaseMetaTileEntity) {
+ if (mSteam == null || mSteam.amount == 0) return;
+ pushSteamToSide(aBaseMetaTileEntity, aBaseMetaTileEntity.getFrontFacing());
}
- protected int basicOutput = 150;
- protected int basicMaxOuput = 50;
- protected int basicTemperatureMod = 5;
- protected int basicLossTimerLimit = 45;
+ @Override
+ protected int getPollution() {
+ return 0;
+ }
- // Calcification start time is 43200*25/20=54,000s or 15 hours of game time.
- static final int CALCIFICATION_TIME = 43200;
-
- public int getCalcificationOutput() { // Returns how much output the boiler can do.
- if (this.mTemperature < 100 ) {
+ @Override
+ public int getProductionPerSecond() {
+ if (mTemperature < 100) {
return 0;
}
- if (this.mRunTime > CALCIFICATION_TIME) {
- // Calcification takes about 2/3 CALCIFICATION_TIME to completely calcify on basic solar. For HP solar, it takes about 2x CALCIFICATION_TIME
- return Math.max(this.basicMaxOuput, this.basicOutput - ((this.mRunTime - CALCIFICATION_TIME) / (CALCIFICATION_TIME/150))); // Every 288*25 ticks, or 6 minutes, lose 1 L output.
+ if (mRunTimeTicks > mConfig.getCalcificationTicks()) {
+ /* When reaching calcification ticks; discount the proportion of run-time spent on calcification
+ * from the maximum output per second, and return this or the minimum output per second
+ */
+ return Math.max(mConfig.getMinOutputPerSecond(),
+ mConfig.getMaxOutputPerSecond()
+ - mConfig.getMaxOutputPerSecond() * (mRunTimeTicks - mConfig.getCalcificationTicks()) / mConfig.getCalcificationTicks());
} else {
- return this.basicOutput;
+ return mConfig.getMaxOutputPerSecond();
}
}
- public int getBasicOutput() {
- return this.basicOutput;
+ @Override
+ protected int getMaxTemperature() {
+ return 500;
}
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) {
- if (this.mTemperature <= 20) {
- this.mTemperature = 20;
- this.mLossTimer = 0;
- }
- if (++this.mLossTimer > basicLossTimerLimit) {
- this.mTemperature -= basicTemperatureMod;
- this.mLossTimer = 0;
- }
- if (this.mSteam != null) {
- byte i = aBaseMetaTileEntity.getFrontFacing();
- IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
- if (tTileEntity != null) {
- FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
- if (tDrained != null) {
- int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
- if (tFilledAmount > 0) {
- tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
- }
- }
- }
- }
- if (aTick % 25L == 0L) { // Every 25 ticks since 1L of water = 150L of steam. So for 120L, have to use 25 instead of 20.
- if (this.mTemperature > 100) {
- if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) {
- this.mHadNoWater = true;
- } else {
- if (this.mHadNoWater) {
- GT_Log.exp.println("Boiler "+this.mName+" had no Water!");
- aBaseMetaTileEntity.doExplosion(2048L);
- return;
- }
- this.mFluid.amount -= (basicOutput/150);
- mRunTime += 1;
-
- int tOutput = getCalcificationOutput();
-
- if (this.mSteam == null) {
- this.mSteam = GT_ModHandler.getSteam(tOutput);
- } else if (GT_ModHandler.isSteam(this.mSteam)) {
- this.mSteam.amount += tOutput;
- } else {
- this.mSteam = GT_ModHandler.getSteam(tOutput);
- }
- }
- } else {
- this.mHadNoWater = false;
- }
- }
- if ((this.mSteam != null) &&
- (this.mSteam.amount > this.getCapacity())) {
- sendSound((byte) 1);
- this.mSteam.amount = 3*(this.getCapacity()/4);
- }
- if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 256L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) {
- boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F;
- mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8*basicTemperatureMod : basicTemperatureMod;
- }
- if ((this.mTemperature < maxProgresstime()) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) {
- this.mProcessingEnergy -= basicTemperatureMod;
- this.mTemperature += basicTemperatureMod;
+ @Override
+ protected int getEnergyConsumption() {
+ return basicTemperatureMod;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return mConfig.getCoolDownTicks() / basicTemperatureMod;
+ }
+
+ @Override
+ protected int getHeatUpAmount() {
+ return basicTemperatureMod;
+ }
+
+ @Override
+ protected void updateFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ World world = aBaseMetaTileEntity.getWorld();
+ // Heat-up every 12s (240 ticks), has to be multiple of 20 ticks
+ if ((aTick % 240L != 0L) || (world.isThundering())) {
+ return;
+ }
+ if (!aBaseMetaTileEntity.getSkyAtSide((byte) ForgeDirection.UP.ordinal())) {
+ return;
+ }
+ boolean weatherClear = !world.isRaining() || aBaseMetaTileEntity.getBiome().rainfall == 0.0F;
+ if (!weatherClear && world.skylightSubtracted >= 4) {
+ return;
+ }
+ if (weatherClear) {
+ if (world.isDaytime()) {
+ mProcessingEnergy += 8 * basicTemperatureMod;
+ } else {
+ mProcessingEnergy += basicTemperatureMod;
}
- aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ } else {
+ mProcessingEnergy += basicTemperatureMod;
+ }
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return String.format("Heat Capacity: " + EnumChatFormatting.GREEN + "%s %%" + EnumChatFormatting.RESET +
+ " Hot time: " + EnumChatFormatting.RED + "%s s" + EnumChatFormatting.RESET + "%n" +
+ "Min output: " + EnumChatFormatting.RED + LPS_FMT + EnumChatFormatting.RESET +
+ " Max output: " + EnumChatFormatting.RED + LPS_FMT + EnumChatFormatting.RESET + "%n" +
+ "Current Output: " + EnumChatFormatting.YELLOW + LPS_FMT + EnumChatFormatting.RESET,
+ GT_Utility.formatNumbers(getHeatCapacityPercent()),
+ GT_Utility.formatNumbers(getHotTimeSeconds()),
+ GT_Utility.formatNumbers(getMinOutputPerSecond()),
+ GT_Utility.formatNumbers(getMaxOutputPerSecond()),
+ GT_Utility.formatNumbers(getProductionPerSecond()))
+ .split("\\R");
+ }
+
+ public int getHeatCapacityPercent() {
+ return mTemperature * 100 / maxProgresstime();
+ }
+
+ public int getHotTimeSeconds() {
+ return mRunTimeTicks / 20;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boiler_Solar(mName, mTier, mDescriptionArray, mTextures, mConfig);
+ }
+
+ protected static class Config {
+ private final int calcificationTicks;
+ private final int minOutputPerSecond;
+ private final int maxOutputPerSecond;
+ private final int coolDownTicks;
+
+ public Config(String aCategory,
+ int aDefaultCalcificationTicks,
+ int aDefaultMinOutputPerSecond,
+ int aDefaultMaxOutputPerSecond,
+ int aDefaultCoolDownTicks) {
+ calcificationTicks = get(aCategory,"CalcificationTicks", aDefaultCalcificationTicks,
+ "Number of run-time ticks before boiler starts calcification.",
+ "100% calcification and minimal output will be reached at 2 times this.");
+ minOutputPerSecond = get(aCategory,"MinOutputPerSecond", aDefaultMinOutputPerSecond);
+ maxOutputPerSecond = get(aCategory,"MaxOutputPerSecond", aDefaultMaxOutputPerSecond);
+ coolDownTicks = get(aCategory,"CoolDownTicks", aDefaultCoolDownTicks, "Number of ticks it takes to lose 1°C.");
+ }
+
+ protected int get(final String aCategory, final String aKey, final int aDefaultValue, final String... aComments) {
+ final StringBuilder tCommentBuilder = new StringBuilder();
+ for (String tComment: aComments)
+ tCommentBuilder.append(tComment).append('\n');
+ tCommentBuilder.append("Default: ").append(aDefaultValue);
+ return sMachineFile.mConfig.get(aCategory, aKey, aDefaultValue, tCommentBuilder.toString()).getInt();
+ }
+
+ public int getCalcificationTicks() {
+ return calcificationTicks;
+ }
+
+ public int getMinOutputPerSecond() {
+ return minOutputPerSecond;
+ }
+
+ public int getMaxOutputPerSecond() {
+ return maxOutputPerSecond;
+ }
+
+ public int getCoolDownTicks() {
+ return coolDownTicks;
}
}
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java
index 594d338204..feaaa7fa32 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java
@@ -1,75 +1,71 @@
package gregtech.common.tileentities.boilers;
import gregtech.api.enums.Dyes;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.common.gui.GT_Container_Boiler;
import gregtech.common.gui.GT_GUIContainer_Boiler;
import net.minecraft.entity.player.InventoryPlayer;
+import static gregtech.api.enums.ConfigCategories.machineconfig;
+
public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boiler_Solar {
public GT_MetaTileEntity_Boiler_Solar_Steel(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- basicOutput = 450;
- basicMaxOuput = 150;
- basicLossTimerLimit = 75; // Cools down slower than normal boiler
}
public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
- basicOutput = 450;
- basicMaxOuput = 150;
- basicLossTimerLimit = 75;
}
public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
- basicOutput = 450;
- basicMaxOuput = 150;
- basicLossTimerLimit = 75;
}
+ public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, Config aConfig) {
+ super(aName, aTier, aDescription, aTextures, aConfig);
+ }
+
+ @Override
+ protected Config createConfig() {
+ return new Config(machineconfig + ".boiler.solar.steel",108000, 120, 360, 75);
+ }
+
+ @Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+
ITexture[][][] rTextures = new ITexture[4][17][];
- for (byte i = -1; i < 16; i = (byte) (i + 1)) {
- ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))};
- rTextures[0][(i + 1)] = tmp0;
- ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)};
- rTextures[1][(i + 1)] = tmp1;
- ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))};
- rTextures[2][(i + 1)] = tmp2;
- ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)};
- rTextures[3][(i + 1)] = tmp3;
+ for (int color = -1; color < 16; color++) {
+ int i = color + 1;
+ short[] colorModulation = Dyes.getModulation(color, Dyes._NULL.mRGBa);
+ rTextures[0][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_BOTTOM, colorModulation)};
+ rTextures[1][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_TOP, colorModulation),
+ new GT_RenderedTexture(BlockIcons.BOILER_SOLAR)};
+ rTextures[2][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation)};
+ rTextures[3][i] = new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE)};
}
return rTextures;
}
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 32000);
- }
-
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarHPBoiler.png", 32000);
+ return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarHPBoiler.png", getCapacity());
}
@Override
- public String[] getDescription() {
- return new String[]{
- "Steam Power by the Sun",
- "Produces 360L of Steam per second",
- "Calcifies over time, reducing Steam output to 120L/s",
- "Break and replace to decalcify"};
- }
-
public int getCapacity() {
return 32000;
}
+ @Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Boiler_Solar_Steel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures);
+ return new GT_MetaTileEntity_Boiler_Solar_Steel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mConfig);
}
-
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java
index 068e7fd82b..0f5dee8eb2 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java
@@ -61,7 +61,33 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bro
return new GT_MetaTileEntity_Boiler_Steel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures);
}
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.singleBlockBoilerLogic(aBaseMetaTileEntity,aTick,2,40,10L,30);
+ @Override
+ protected int getPollution() {
+ return 30;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000;
+ }
+
+ @Override
+ protected int getProductionPerSecond() {
+ return 300;
+ }
+
+ @Override
+ protected int getMaxTemperature() {
+ return 1000;
+ }
+
+ @Override
+ protected int getEnergyConsumption() {
+ return 2;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return 40;
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
index 910ad73d65..ba1c74e66e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
+++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java
@@ -18,6 +18,7 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.util.Platform;
import cpw.mods.fml.common.Optional;
+import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -60,6 +61,16 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc
getProxy();
}
+ @Override
+ public boolean storeAll(ItemStack aStack) {
+ if (!GregTech_API.mAE2)
+ return false;
+ int tTotal = aStack.stackSize;
+ int tStored = store(aStack);
+ aStack.stackSize -= tStored;
+ return tTotal == tStored;
+ }
+
@Optional.Method(modid = "appliedenergistics2")
public int store(final ItemStack stack) {
if (stack == null)
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
index d892adabfb..aabce730d0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
@@ -122,28 +122,26 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine
return DID_NOT_FIND_RECIPE;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- if (mDisableFilter) return true;
- ItemStack tInput1 = getInputAt(1);
- if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) {
- if (hasValidCache(aStack,aTypeCache,false))
- return true;
- if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), tInput1}) != null) {
- return true;
- }
- if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null)
- return true;
- if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, null, aStack, aStack}) != null) {
- return true;
- }
- if (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack}) != null)) {
- return true;
- }
- } else {
- return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
+ return false;
+ }
+ ItemStack tInput1 = getInputAt(1);
+ if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) {
+ if (hasValidCache(aStack,aTypeCache,false))
+ return true;
+ if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), tInput1}) != null) {
+ return true;
+ }
+ if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null)
+ return true;
+ if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, null, aStack, aStack}) != null) {
+ return true;
}
+ return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack}) != null);
+ } else {
+ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);
}
- return false;
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
index 11f653f085..2772d15386 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java
@@ -34,8 +34,9 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine
return new GT_MetaTileEntity_CuringOven(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName);
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (mDisableFilter || (ItemList.Cell_Empty.isStackEqual(aStack)));
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ItemList.Cell_Empty.isStackEqual(aStack);
}
public boolean isFluidInputAllowed(FluidStack aFluid) {
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 755fae8bce..2260949ff1 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
@@ -107,24 +107,53 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi
private static final ArrayListMultimap<GT_ItemStack, ItemStack> outputHardOverrides;
+ private static final Set<GT_ItemStack> blackList;
+
+ public static Set<GT_ItemStack> getBlackList() {
+ return blackList;
+ }
+
static {
outputHardOverrides = ArrayListMultimap.create();
outputHardOverrides.put(new GT_ItemStack(new ItemStack(Blocks.torch,6)), new ItemStack(Items.stick));
+ blackList = new HashSet<>();
+ blackList.add(new GT_ItemStack(ItemList.Casing_Coil_Superconductor.get(1L)));
+ }
+
+ private boolean compareToUnpacker(ItemStack is){
+ return null != GT_Recipe.GT_Recipe_Map.sUnboxinatorRecipes.findRecipe(
+ null,
+ true,
+ true,
+ Long.MAX_VALUE,
+ null,
+ is);
}
public int checkRecipe() {
ItemStack is = getInputAt(0);
+
if (GT_Utility.isStackInvalid(is))
return DID_NOT_FIND_RECIPE;
- if (is.getItem() instanceof GT_MetaGenerated_Tool)
+
+ if (
+ is.getItem() instanceof GT_MetaGenerated_Tool
+ || blackList.contains(new GT_ItemStack(is))
+ || compareToUnpacker(is)
+ )
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;
- }
+
+ if (checkTier(is))
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+
+ Integer handleHardOverride = handleHardOverride(is);
+ if (handleHardOverride != null)
+ return handleHardOverride;
+
+ return process();
+ }
+
+ private Integer handleHardOverride(ItemStack is) {
Set<GT_ItemStack> stacks = outputHardOverrides.keySet();
for (GT_ItemStack stack : stacks) {
ItemStack in = is.copy();
@@ -135,32 +164,60 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi
: DID_NOT_FIND_RECIPE;
}
}
- return process()
- ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
- : DID_NOT_FIND_RECIPE;
+ return null;
}
- private boolean process(){
+ private boolean checkTier(ItemStack is) {
+ ItemStack comp = new ItemStack(GregTech_API.sBlockMachines);
+ if (is.getItem() == comp.getItem()) {
+ IMetaTileEntity iMetaTileEntity = GregTech_API.METATILEENTITIES[is.getItemDamage()];
- 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);
+ return iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock &&
+ ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier;
}
+ return false;
+ }
+
+ private int process(){
+ int statusCode = checkRecipeMap();
+ if (statusCode != DID_NOT_FIND_RECIPE)
+ return statusCode;
+ return onTheFlyGeneration();
+ }
+
+ private int onTheFlyGeneration() {
Collection<DissassembleReference> recipes = this.findRecipeFromMachine();
if (recipes.isEmpty())
- return false;
+ return DID_NOT_FIND_RECIPE;
DissassembleReference recipe = ensureDowncasting(recipes);
+ removeInvalidStacks(recipe);
+
+ return setOutputsAndTime(recipe.inputs, recipe.stackSize)
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+
+ private void removeInvalidStacks(DissassembleReference recipe) {
for (int i = 0; i < recipe.inputs.length; i++)
if (GT_Utility.isStackInvalid(recipe.inputs[i]) || recipe.inputs[i].stackSize < 1)
recipe.inputs[i] = null;
recipe.inputs = GT_Utility.getArrayListWithoutNulls(recipe.inputs).toArray(new ItemStack[0]);
+ }
+
+ private int checkRecipeMap() {
+ GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs());
+ if (gt_recipe == null)
+ return DID_NOT_FIND_RECIPE;
+ if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs()))
+ return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize)
+ ? FOUND_AND_SUCCESSFULLY_USED_RECIPE
+ : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- return setOutputsAndTime(recipe.inputs, recipe.stackSize);
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
}
private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize){
@@ -420,22 +477,24 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi
//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 (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (mDisableFilter || (aStack.getTagCompound() != null) && (aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null));
+ .sorted(Comparator.comparingDouble(GT_MetaTileEntity_Disassembler::getCheaperInputs))
+ .collect(Collectors.toList());
+ }
+
+ private static double getCheaperInputs(GT_MetaTileEntity_Disassembler.DissassembleReference 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;
+ }
+
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(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_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
index 35cc78d162..2acad0edfa 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
@@ -79,8 +79,9 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
return new GT_MetaTileEntity_Miner(mName, mTier, mDescriptionArray, mTextures, mGUIName, mNEIName);
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (mDisableFilter || aStack.getItem() == MINING_PIPE.getItem());
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && aStack.getItem() == MINING_PIPE.getItem();
}
public boolean hasFreeSpace() {
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
index 7341d3cd78..67db36d6e2 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
@@ -130,8 +130,9 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi
return 2;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (mDisableFilter || getRecipeList().containsInput(aStack));
+ @Override
+ public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack);
}
public boolean isFluidInputAllowed(FluidStack aFluid) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java
index 151a2cf25b..3df33fc6c4 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java
@@ -101,8 +101,9 @@ public class GT_MetaTileEntity_Replicator
return GT_Recipe.GT_Recipe_Map.sReplicatorFakeRecipes;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (mDisableFilter || ItemList.Cell_Empty.isStackEqual(aStack));
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && ItemList.Cell_Empty.isStackEqual(aStack);
}
public boolean isFluidInputAllowed(FluidStack aFluid) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java
index 932c7a14ec..37113e0f9a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java
@@ -35,8 +35,9 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin
return GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (mDisableFilter || getRecipeList().containsInput(aStack));
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack);
}
public int checkRecipe() {
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
index 3e4a0846b5..2fcecc41ad 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
@@ -348,8 +348,9 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine {
return 1000;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (mDisableFilter || getRecipeList().containsInput(aStack));
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack);
}
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
index 68770644de..fdb61e1945 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
@@ -4,6 +4,7 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IChunkLoader;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -29,7 +30,7 @@ import java.util.ArrayList;
import static gregtech.api.enums.GT_Values.W;
-public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase {
+public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase implements IChunkLoader {
private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0);
private static final ItemStack miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0);
private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe);
@@ -466,4 +467,6 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
}
return false;
}
+ @Override
+ public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
index e80f3dfb39..2d8ae1f144 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
@@ -18,16 +18,20 @@ 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.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
+import static gregtech.api.enums.GT_Values.STEAM_PER_WATER;
+
public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_MultiBlockBase {
private boolean firstRun = true;
private int mSuperEfficencyIncrease = 0;
private int integratedCircuitConfig = 0; //Steam output is reduced by 1000L per config
+ private int excessWater = 0; //Eliminate rounding errors for water
private int excessFuel = 0; //Eliminate rounding errors for fuels that burn half items
private int excessProjectedEU = 0; //Eliminate rounding errors from throttling the boiler
@@ -185,7 +189,10 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
mEfficiency = Math.max(0, Math.min(mEfficiency + mSuperEfficencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000)));
int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L);
if (tGeneratedEU > 0) {
- long amount = (tGeneratedEU + 160) / 160;
+ long amount = (tGeneratedEU + STEAM_PER_WATER) / STEAM_PER_WATER;
+ excessWater += amount * STEAM_PER_WATER - tGeneratedEU;
+ amount -= excessWater / STEAM_PER_WATER;
+ excessWater %= STEAM_PER_WATER;
if (depleteInput(Materials.Water.getFluid(amount)) || depleteInput(GT_ModHandler.getDistilledWater(amount))) {
addOutput(GT_ModHandler.getSteam(tGeneratedEU));
} else {
@@ -199,6 +206,22 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu
}
@Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("excessFuel", excessFuel);
+ aNBT.setInteger("excessWater", excessWater);
+ aNBT.setInteger("excessProjectedEU", excessProjectedEU);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ excessFuel = aNBT.getInteger("excessFuel");
+ excessWater = aNBT.getInteger("excessWater");
+ excessProjectedEU = aNBT.getInteger("excessProjectedEU");
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (mProgresstime > 0 && firstRun) {
firstRun = false;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
index 306dfe734d..baa63a3e84 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
@@ -19,11 +19,12 @@ import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
+import static gregtech.api.enums.GT_Values.STEAM_PER_WATER;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_LargeTurbine {
- private float water;
+ private int excessWater;
private boolean achievement = false;
private boolean looseFit=false;
@@ -90,11 +91,11 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
return 0;
}
- private int useWater(float input) {
- water = water + input;
- int usage = (int) water;
- water = water - usage;
- return usage;
+ private int condenseSteam(int steam) {
+ excessWater += steam;
+ int water = excessWater / STEAM_PER_WATER;
+ excessWater %= STEAM_PER_WATER;
+ return water;
}
@Override
@@ -127,7 +128,7 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
totalFlow += flow; // track total input used
if (!achievement) {
- GT_Mod.instance.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam");
+ GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam");
achievement = true;
}
}else if(GT_ModHandler.isSuperHeatedSteam(aFluidStack)) {
@@ -136,11 +137,10 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
}
if(totalFlow<=0)return 0;
tEU = totalFlow;
- int waterToOutput = useWater(totalFlow / 160.0f);
+ int waterToOutput = condenseSteam(totalFlow);
addOutput(GT_ModHandler.getDistilledWater(waterToOutput));
if (totalFlow != aOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float)aOptFlow);
- //if(totalFlow>aOptFlow){efficiency = 1.0f;}
tEU *= efficiency;
tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 20000L));
} else {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
index a7a7023d34..3c19be674a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -2,6 +2,7 @@ package gregtech.common.tileentities.machines.multi;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_ChunkManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
@@ -9,8 +10,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -25,10 +28,7 @@ import static gregtech.common.GT_UndergroundOil.undergroundOil;
import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_DrillerBase {
-
- private boolean completedCycle = false;
-
- private ArrayList<Chunk> mOilFieldChunks = new ArrayList<Chunk>();
+ private final ArrayList<Chunk> mOilFieldChunks = new ArrayList<>();
private int mOilId = 0;
private int chunkRangeConfig = getRangeInChunks();
@@ -95,6 +95,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ int oldChunkRange = chunkRangeConfig;
if (aPlayer.isSneaking()) {
if (chunkRangeConfig > 0) {
chunkRangeConfig--;
@@ -108,6 +109,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
if (chunkRangeConfig > getRangeInChunks())
chunkRangeConfig = 1;
}
+ if (oldChunkRange != chunkRangeConfig) mOilFieldChunks.clear();
GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + chunkRangeConfig + "x" + chunkRangeConfig + StatCollector.translateToLocal("GT5U.machines.chunks"));//TODO Add translation support
}
@@ -137,6 +139,11 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
}
if (reachingVoidOrBedrock() && tryFillChunkList()) {
+ if (mWorkChunkNeedsReload) {
+ mCurrentChunk = new ChunkCoordIntPair(xDrill >> 4, zDrill >> 4);
+ GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), null);
+ mWorkChunkNeedsReload = false;
+ }
float speed = .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F;
FluidStack tFluid = pumpOil(speed);
if (tFluid != null && tFluid.amount > getTotalConfigValue()){
@@ -144,6 +151,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
return true;
}
}
+ GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity());
workState = STATE_UPWARD;
return true;
}
@@ -220,7 +228,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
);
}
- ArrayList<Chunk> emptyChunks = new ArrayList<Chunk>();
+ ArrayList<Chunk> emptyChunks = new ArrayList<>();
for (Chunk tChunk : mOilFieldChunks) {
tFluid = undergroundOil(tChunk,speed);
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
index e34ed7466f..ea894fc725 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
@@ -37,7 +37,7 @@ import org.lwjgl.input.Keyboard;
import static gregtech.api.enums.GT_Values.VN;
-public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase implements IChunkLoader {
+public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase {
private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>();
protected int mTier = 1;
private int chunkRadiusConfig = getRadiusInChunks();
@@ -64,9 +64,6 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
}
@Override
- public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;}
-
- @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png");
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 1fdc698fe4..d86e8cf7f8 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -139,6 +139,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
private String mMachine = "";
+
public boolean checkRecipe(ItemStack aStack) {
if (!isCorrectMachinePart(mInventory[1])) {
return false;
@@ -146,62 +147,66 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
GT_Recipe.GT_Recipe_Map map = getRecipeMap();
if (map == null) return false;
- if (mInventory[1].getUnlocalizedName().endsWith("10")) {
- tTier = 9;
- mMult = 2;//u need 4x less machines and they will use 4x less power
- } else if (mInventory[1].getUnlocalizedName().endsWith("11")) {
- tTier = 9;
- mMult = 4;//u need 16x less machines and they will use 16x less power
- } else if (mInventory[1].getUnlocalizedName().endsWith("12") ||
- mInventory[1].getUnlocalizedName().endsWith("13") ||
- mInventory[1].getUnlocalizedName().endsWith("14") ||
- mInventory[1].getUnlocalizedName().endsWith("15")) {
- tTier = 9;
- mMult = 6;//u need 64x less machines and they will use 64x less power
- } else if (mInventory[1].getUnlocalizedName().endsWith("1")) {
- tTier = 1;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("2")) {
- tTier = 2;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("3")) {
- tTier = 3;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("4")) {
- tTier = 4;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("5")) {
- tTier = 5;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("6")) {
- tTier = 6;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("7")) {
- tTier = 7;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("8")) {
- tTier = 8;
- mMult = 0;//*1
- } else if (mInventory[1].getUnlocalizedName().endsWith("9")) {
- tTier = 9;
- mMult = 0;//*1
- } else {
- tTier = 0;
- mMult = 0;//*1
+ if (!mMachine.equals(mInventory[1].getUnlocalizedName())) {
+ mLastRecipe = null;
+ mMachine = mInventory[1].getUnlocalizedName();
}
- if (!mMachine.equals(mInventory[1].getUnlocalizedName())) mLastRecipe = null;
- mMachine = mInventory[1].getUnlocalizedName();
+ int machineTier = 0;
+
+ if (mLastRecipe == null) {
+ try {
+ int length = mMachine.length();
+
+ machineTier = Integer.parseInt(mMachine.substring(length - 2));
+
+ } catch (NumberFormatException e) {
+ }
+
+ switch (machineTier) {
+ default:
+ tTier = 0;
+ mMult = 0;//*1
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ tTier = machineTier;
+ mMult = 0;//*1
+ break;
+ case 10:
+ tTier = 9;
+ mMult = 2;//u need 4x less machines and they will use 4x less power
+ break;
+ case 11:
+ tTier = 9;
+ mMult = 4;//u need 16x less machines and they will use 16x less power
+ break;
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ tTier = 9;
+ mMult = 6;//u need 64x less machines and they will use 64x less power
+ break;
+ }
+ }
ArrayList<FluidStack> tFluidList = getStoredFluids();
FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]);
if (mSeparate) {
ArrayList<ItemStack> tInputList = new ArrayList<ItemStack>();
for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) {
- IGregTechTileEntity tInpuBus = tHatch.getBaseMetaTileEntity();
- for (int i = tInpuBus.getSizeInventory() - 1; i >= 0; i--) {
- if (tInpuBus.getStackInSlot(i) != null)
- tInputList.add(tInpuBus.getStackInSlot(i));
+ IGregTechTileEntity tInputBus = tHatch.getBaseMetaTileEntity();
+ for (int i = tInputBus.getSizeInventory() - 1; i >= 0; i--) {
+ if (tInputBus.getStackInSlot(i) != null)
+ tInputList.add(tInputBus.getStackInSlot(i));
}
ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
if (processRecipe(tInputs, tFluids, map))
diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java
index e7a83eda38..de8dd8aa64 100644
--- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java
+++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java
@@ -43,11 +43,9 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac
return 0;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- return false;
- }
- return mDisableFilter || GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null;
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null;
}
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java
index 9d0fb8309e..095328eb95 100644
--- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java
@@ -43,11 +43,9 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach
return 0;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- return false;
- }
- return mDisableFilter || GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null;
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null;
}
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java
index 758d206755..7460b874df 100644
--- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java
+++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java
@@ -77,11 +77,9 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- return false;
- }
- return mDisableFilter || GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack));
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack));
}
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java
index 235b341210..2af1ae0793 100644
--- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java
+++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java
@@ -77,11 +77,9 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- return false;
- }
- return mDisableFilter || GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack));
+ @Override
+ public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack));
}
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
diff --git a/src/main/java/gregtech/loaders/misc/GT_Achievements.java b/src/main/java/gregtech/loaders/misc/GT_Achievements.java
index 456705eba4..c67fa69fd8 100644
--- a/src/main/java/gregtech/loaders/misc/GT_Achievements.java
+++ b/src/main/java/gregtech/loaders/misc/GT_Achievements.java
@@ -198,7 +198,7 @@ public class GT_Achievements {
if (special) {
achievement.setSpecial();
}
- achievement.registerStat();
+ ((StatBase)achievement).registerStat();
if (GT_Values.D2) {
GT_Log.out.println("achievement." + textId + "=");
GT_Log.out.println("achievement." + textId + ".desc=");
@@ -216,7 +216,7 @@ public class GT_Achievements {
if (special) {
achievement.setSpecial();
}
- achievement.registerStat();
+ ((StatBase)achievement).registerStat();
if (GT_Values.D2) {
GT_Log.out.println("achievement." + textId + "=");
GT_Log.out.println("achievement." + textId + ".desc=");
diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java
index 7ed86696fe..620d62211e 100644
--- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java
+++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java
@@ -17,8 +17,8 @@ public class ProcessingFineWire implements gregtech.api.interfaces.IOreRecipeReg
public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) {
if (!aMaterial.contains(gregtech.api.enums.SubTag.NO_SMASHING)) {
- GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_Utility.copyAmount(8L, aStack)), 500, 4);
- GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 1L), GT_Utility.copyAmount(4L, aStack)), 200, 4);
+ GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_Utility.copyAmount(8L, aStack)), 100, 4);
+ GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 1L), GT_Utility.copyAmount(4L, aStack)), 50, 4);
}
if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial) && !aMaterial.contains(SubTag.NO_WORKING)) {
GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), GT_Proxy.tBits, new Object[]{"Xx", 'X', OrePrefixes.foil.get(aMaterial)});
diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java
index ce5625fa48..73248fb2c7 100644
--- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java
+++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java
@@ -146,8 +146,8 @@ public class GT_MachineRecipeLoader implements Runnable {
GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.LightFuel, 5L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.HeavyFuel, 1L), GT_Values.NI, GT_Values.NI, GT_Values.NF, GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Fuel, 6L), 16, 120);
GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.LightFuel, 5L), Materials.Empty.getCells(1), GT_Values.NI, GT_Utility.getIntegratedCircuit(1), Materials.HeavyFuel.getFluid(1000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Fuel, 6L), 16, 120);
GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.HeavyFuel, 1L), Materials.Empty.getCells(5), GT_Values.NI, GT_Utility.getIntegratedCircuit(1), Materials.LightFuel.getFluid(5000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Fuel, 6L), 16, 120);
- GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.LightFuel, 5L), GT_Values.NI, GT_Values.NI, GT_Utility.getIntegratedCircuit(5), Materials.HeavyFuel.getFluid(1000L), Materials.Fuel.getFluid(6000L), Materials.Empty.getCells(5), 120, 120);
- GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.HeavyFuel, 1L), GT_Values.NI, GT_Values.NI, GT_Utility.getIntegratedCircuit(6), Materials.LightFuel.getFluid(5000L), Materials.Fuel.getFluid(6000L), Materials.Empty.getCells(1), 120, 120);
+ GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.LightFuel, 5L), GT_Values.NI, GT_Values.NI, GT_Utility.getIntegratedCircuit(5), Materials.HeavyFuel.getFluid(1000L), Materials.Fuel.getFluid(6000L), Materials.Empty.getCells(5), 16, 120);
+ GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.HeavyFuel, 1L), GT_Values.NI, GT_Values.NI, GT_Utility.getIntegratedCircuit(6), Materials.LightFuel.getFluid(5000L), Materials.Fuel.getFluid(6000L), Materials.Empty.getCells(1), 16, 120);
GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Water, 5L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), GT_Values.NI, GT_Values.NI, Materials.Lubricant.getFluid(20), new FluidStack(ItemList.sDrillingFluid, 5000), Materials.Empty.getCells(5), 64, 16);
GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lapis, 1L), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Water.getFluid(125), FluidRegistry.getFluidStack("ic2coolant", 125), GT_Values.NI, 256, 48);
GT_Values.RA.addMixerRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lapis, 1L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_ModHandler.getDistilledWater(1000), FluidRegistry.getFluidStack("ic2coolant", 1000), GT_Values.NI, 256, 48);
@@ -2636,10 +2636,10 @@ public class GT_MachineRecipeLoader implements Runnable {
ItemList.Hull_LV.get(1L),
new ItemStack[]{
new ItemStack(Blocks.beacon),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L),
- GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Aluminium, 1L),
ItemList.Sensor_MV.get(2L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 1L),
GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Thaumium, 1L),
ItemList.Sensor_MV.get(2L)
},
@@ -2668,11 +2668,11 @@ public class GT_MachineRecipeLoader implements Runnable {
ItemList.Hull_MV.get(1L),
new ItemStack[]{
new ItemStack(Blocks.beacon),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L),
GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Thaumium, 1L),
ItemList.Sensor_HV.get(2L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 1L),
- GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Titanium, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.StainlessSteel, 1L),
ItemList.Sensor_HV.get(2L)
},
ItemList.MagicEnergyConverter_MV.get(1L),
@@ -2700,11 +2700,11 @@ public class GT_MachineRecipeLoader implements Runnable {
ItemList.Hull_HV.get(1L),
new ItemStack[]{
new ItemStack(Blocks.beacon),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 1L),
GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1L),
ItemList.Field_Generator_MV.get(1L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 1L),
- GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.TungstenSteel, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Titanium, 1L),
ItemList.Field_Generator_MV.get(1L)
},
ItemList.MagicEnergyConverter_HV.get(1L),
@@ -2733,7 +2733,7 @@ public class GT_MachineRecipeLoader implements Runnable {
ItemList.Hull_LV.get(1L),
new ItemStack[]{
ItemList.MagicEnergyConverter_LV.get(1L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 1L),
GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Thaumium, 1L),
ItemList.Sensor_MV.get(2L)
},
@@ -2785,11 +2785,11 @@ public class GT_MachineRecipeLoader implements Runnable {
ItemList.Hull_HV.get(1L),
new ItemStack[]{
ItemList.MagicEnergyConverter_MV.get(1L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 1L),
- GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1, 16),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Void, 1),
ItemList.Field_Generator_MV.get(1L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 1L),
- GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1, 16)
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Void, 1),
},
ItemList.MagicEnergyAbsorber_HV.get(1L),
8,
@@ -2805,11 +2805,13 @@ public class GT_MachineRecipeLoader implements Runnable {
ItemList.Hull_EV.get(1L),
new ItemStack[]{
ItemList.MagicEnergyConverter_HV.get(1L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 1L),
- GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1, 16),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Void, 1),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 1),
ItemList.Field_Generator_HV.get(1L),
- GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 1L),
- GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1, 16)
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 1L),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Void, 1),
+ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 1),
},
ItemList.MagicEnergyAbsorber_EV.get(1L),
10,
diff --git a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java
index ddfab9c02f..0a4fbdaf00 100644
--- a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java
+++ b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java
@@ -218,8 +218,11 @@ public class GT_Worldgenloader implements Runnable {
GT_Log.out.println("Started Galactic Greg ore gen code");
//this function calls Galactic Greg and enables its generation.
} catch (Exception e) {
- GT_Log.err.println("Unable to start Galactic Greg ore gen code");
- e.printStackTrace(GT_Log.err);
+ // ClassNotFound is expected if Galactic Greg is absent, so only report if other problem
+ if (!(e instanceof ClassNotFoundException)) {
+ GT_Log.err.println("Unable to start Galactic Greg ore gen code");
+ e.printStackTrace(GT_Log.err);
+ }
}
//DO NOT DELETE ^ THIS ^
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java
index 737d023759..c185fa8177 100644
--- a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java
+++ b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java
@@ -81,6 +81,8 @@ public class GT_Loader_OreDictionary implements Runnable {
GT_OreDictUnificator.set(OrePrefixes.block, Materials.Lapis, new ItemStack(Blocks.lapis_block, 1, 0));
GT_OreDictUnificator.set(OrePrefixes.block, Materials.Coal, new ItemStack(Blocks.coal_block, 1, 0));
GT_OreDictUnificator.set(OrePrefixes.block, Materials.Redstone, new ItemStack(Blocks.redstone_block, 1, 0));
+ GT_OreDictUnificator.set(OrePrefixes.block, Materials.NetherQuartz, new ItemStack(Blocks.quartz_block, 1, 0));
+ GT_OreDictUnificator.set(OrePrefixes.block, Materials.Clay, new ItemStack(Blocks.clay, 1, 0));
if (Blocks.ender_chest != null) {
GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(Blocks.ender_chest, 1));
}
@@ -96,6 +98,7 @@ public class GT_Loader_OreDictionary implements Runnable {
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, GT_ModHandler.getModItem("Railcraft", "tile.railcraft.brick.abyssal", 1L, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, GT_ModHandler.getModItem("Railcraft", "tile.railcraft.brick.quarried", 1L, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(Blocks.obsidian, 1, 32767));
+ GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Stone, new ItemStack(Blocks.stone, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stoneMossy, new ItemStack(Blocks.mossy_cobblestone, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stoneCobble, new ItemStack(Blocks.mossy_cobblestone, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stoneCobble, new ItemStack(Blocks.cobblestone, 1, 32767));
@@ -108,6 +111,7 @@ public class GT_Loader_OreDictionary implements Runnable {
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Netherrack, new ItemStack(Blocks.netherrack, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.NetherBrick, new ItemStack(Blocks.nether_brick, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Endstone, new ItemStack(Blocks.end_stone, 1, 32767));
+ GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Glowstone, new ItemStack(Blocks.glowstone, 1, 32767));
GT_OreDictUnificator.registerOre("paperResearchFragment", GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1L, 9));
GT_OreDictUnificator.registerOre("itemCertusQuartz", GT_ModHandler.getModItem("appliedenergistics2", "item.ItemMultiMaterial", 1L, 1));