aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common')
-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.java864
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java257
-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.java117
-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/multi/GT_MetaTileEntity_LargeBoiler.java25
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java18
11 files changed, 950 insertions, 755 deletions
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 2f33a80dca..51e0b8fd6f 100644
--- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java
+++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
@@ -20,9 +20,29 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
-import static gregtech.api.util.LightingHelper.NO_Z_FIGHT_OFFSET;
+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 {
+ 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;
@@ -32,6 +52,453 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
RenderingRegistry.registerBlockHandler(this);
}
+ 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())});
+ }
+ 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())});
+ }
+ 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);
+
+ 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);
+ }
+
+ 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);
+
+ 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);
+
+ return true;
+ }
+
+ 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.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(blockMin, blockMin, blockMin, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+
private static void renderNormalInventoryMetaTileEntity(Block aBlock, int aMeta, RenderBlocks aRenderer) {
if ((aMeta <= 0) || (aMeta >= GregTech_API.METATILEENTITIES.length)) {
return;
@@ -43,382 +510,81 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler {
aBlock.setBlockBoundsForItemRender();
aRenderer.setRenderBoundsFromBlock(aBlock);
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ final IGregTechTileEntity iGregTechTileEntity = tMetaTileEntity.getBaseMetaTileEntity();
+
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;
+ if ((iGregTechTileEntity instanceof IPipeRenderedTileEntity)) {
+ final float tThickness = ((IPipeRenderedTileEntity) iGregTechTileEntity).getThickNess();
+ final float pipeMin = (blockMax - tThickness) / 2.0F;
+ final float pipeMax = blockMax - pipeMin;
- aBlock.setBlockBounds(0.0F, sp, sp, 1.0F, sp + tThickness, sp + tThickness);
+ aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax);
aRenderer.setRenderBoundsFromBlock(aBlock);
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);
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
Tessellator.instance.draw();
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);
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
Tessellator.instance.draw();
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);
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
Tessellator.instance.draw();
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);
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true);
Tessellator.instance.draw();
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);
+ 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.draw();
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();
+ renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true);
} 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);
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) EAST.ordinal(), (byte) -1, true, false), true);
Tessellator.instance.draw();
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);
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) EAST.ordinal(), (byte) -1, true, false), true);
Tessellator.instance.draw();
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);
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) EAST.ordinal(), (byte) -1, true, false), true);
Tessellator.instance.draw();
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);
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) EAST.ordinal(), (byte) -1, true, false), true);
Tessellator.instance.draw();
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);
+ renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) EAST.ordinal(), (byte) -1, true, false), true);
Tessellator.instance.draw();
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, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) EAST.ordinal(), (byte) -1, true, false), 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);
}
- 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)});
- }
- 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)});
- }
- 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);
- 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;
- }
-
- 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;
-
- 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);
- 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);
-
- } 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);
-
- renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false);
- renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false);
-
- } 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);
-
- renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false);
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
-
- } 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);
-
- }
- 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);
-
- }
- 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);
-
- }
- 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);
-
- }
- 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);
-
- }
- renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false);
- }
- if (tIsCovered[0]) {
- aBlock.setBlockBounds(0.0F, 0.0F + NO_Z_FIGHT_OFFSET, 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 - NO_Z_FIGHT_OFFSET, 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 + NO_Z_FIGHT_OFFSET, 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 - NO_Z_FIGHT_OFFSET);
- 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 + NO_Z_FIGHT_OFFSET, 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 - NO_Z_FIGHT_OFFSET, 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);
- }
- 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) {
if (aWorld != null) {
if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) return;
@@ -497,58 +663,6 @@ 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;
TileEntity tileEntity = aWorld.getTileEntity(aX, aY, aZ);
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..9c52df7986 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,165 @@ 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 + 1;
+ 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 += 1;
+ }
+ 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;
+ }
+
+ private void pushSteamToInventories(IGregTechTileEntity aBaseMetaTileEntity) {
+ for (int i = 1; (this.mSteam != null) && (i < 6); i++) {
+ if (i == aBaseMetaTileEntity.getFrontFacing())
+ continue;
+ IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide((byte) i);
+ if (tTileEntity == null)
+ continue;
+ FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
+ if (tDrained == null)
+ continue;
+ int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
+ if (tFilledAmount <= 0)
+ continue;
+ tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
+ }
+ }
+
+ 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 +342,25 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa
}
}
+ @Override
+ public int getTankPressure() {
+ return 100;
+ }
+
+ 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 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..e7b318d27d 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
@@ -6,17 +6,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_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.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler {
@@ -126,74 +121,50 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler {
}
}
- public int getBasicOutput() {
- return this.basicOutput;
- }
-
- 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;
- }
- aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ @Override
+ protected void produceSteam(int aAmount) {
+ super.produceSteam(aAmount);
+ mRunTime++;
+ }
+
+ @Override
+ protected int getPollution() {
+ return 0;
+ }
+
+ @Override
+ protected int getProductionPerSecond() {
+ if (this.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.
+ } else {
+ return this.basicOutput;
+ }
+ }
+
+ @Override
+ protected int getMaxTemperature() {
+ return 500;
+ }
+
+ @Override
+ protected int getEnergyConsumption() {
+ return 1;
+ }
+
+ @Override
+ protected int getCooldownInterval() {
+ return basicLossTimerLimit / basicTemperatureMod;
+ }
+
+ @Override
+ protected void updateFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if ((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;
}
}
}
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/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 {