diff options
Diffstat (limited to 'src/main/java')
6 files changed, 667 insertions, 250 deletions
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java index 909f4077f0..8392616f34 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IPipeRenderedTileEntity.java @@ -1,6 +1,7 @@ package gregtech.api.interfaces.tileentity; import gregtech.api.interfaces.ITexture; +import net.minecraft.block.Block; public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity { float getThickNess(); @@ -8,4 +9,8 @@ public interface IPipeRenderedTileEntity extends ICoverable, ITexturedTileEntity byte getConnections(); ITexture[] getTextureUncovered(byte aSide); + + default ITexture[] getTextureCovered(byte aSide) { + return getTextureUncovered(aSide); + }; }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 6025e7eb13..26fee68f2b 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -784,6 +784,20 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE } @Override + public ITexture[] getTextureCovered(byte aSide) { + ITexture coverTexture = getCoverTexture(aSide); + ITexture[] textureUncovered = getTextureUncovered(aSide); + ITexture[] textureCovered; + if (coverTexture != null) { + textureCovered = Arrays.copyOf(textureUncovered, textureUncovered.length + 1); + textureCovered[textureUncovered.length] = coverTexture; + return textureCovered; + } else { + return textureUncovered; + } + } + + @Override public ITexture[] getTextureUncovered(byte aSide) { if ((mConnections & 64) != 0) return Textures.BlockIcons.FRESHFOAM; if ((mConnections & -128) != 0) return Textures.BlockIcons.HARDENEDFOAMS[mColor]; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 5e9715493b..0781c57086 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -8,7 +8,6 @@ import appeng.me.helpers.AENetworkProxy; import appeng.me.helpers.IGridProxyable; import appeng.tile.TileEvent; import appeng.tile.events.TileEventType; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -22,7 +21,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.*; +import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; import ic2.api.Direction; import net.minecraft.block.Block; @@ -1169,11 +1172,18 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE @Override public ITexture[] getTexture(Block aBlock, byte aSide) { - ITexture rIcon = getCoverTexture(aSide); - if (rIcon != null) return new ITexture[]{rIcon}; - if (hasValidMetaTileEntity()) - return mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0); - return Textures.BlockIcons.ERROR_RENDERING; + ITexture coverTexture = getCoverTexture(aSide); + ITexture[] textureUncovered = hasValidMetaTileEntity() ? + mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0) : + Textures.BlockIcons.ERROR_RENDERING; + ITexture[] textureCovered; + if (coverTexture != null) { + textureCovered = Arrays.copyOf(textureUncovered, textureUncovered.length + 1); + textureCovered[textureUncovered.length] = coverTexture; + return textureCovered; + } else { + return textureUncovered; + } } private boolean isEnergyInputSide(byte aSide) { 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 5265be43e1..e95f508d80 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -21,6 +21,7 @@ import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { + private static final float NoZFightOffset = 1.0F / 16384.0F; public static GT_Renderer_Block INSTANCE; public final int mRenderID; @@ -117,8 +118,23 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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 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; } @@ -182,12 +198,10 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[4]) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false); - } - if (!tIsCovered[5]) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], 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); @@ -195,12 +209,10 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[0]) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false); - } - if (!tIsCovered[1]) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], 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); @@ -208,17 +220,14 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[2]) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false); - } - if (!tIsCovered[3]) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], 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); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], false); } else { aBlock.setBlockBounds(0.0F, sp, sp, sp, sp + tThickness, sp + tThickness); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -226,14 +235,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[4]) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[4], 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); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], false); } else { aBlock.setBlockBounds(sp + tThickness, sp, sp, 1.0F, sp + tThickness, sp + tThickness); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -241,14 +248,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[5]) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[5], 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); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], false); } else { aBlock.setBlockBounds(sp, 0.0F, sp, sp + tThickness, sp, sp + tThickness); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -256,14 +261,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[0]) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[0], 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); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], false); } else { aBlock.setBlockBounds(sp, sp + tThickness, sp, sp + tThickness, 1.0F, sp + tThickness); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -271,14 +274,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[1]) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[1], 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); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], false); } else { aBlock.setBlockBounds(sp, sp, 0.0F, sp + tThickness, sp + tThickness, sp); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -286,14 +287,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[2]) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[2], 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); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false); } else { aBlock.setBlockBounds(sp, sp, sp + tThickness, sp + tThickness, sp + tThickness, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -301,13 +300,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { 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); - if (!tIsCovered[3]) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false); - } + } + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false); } if (tIsCovered[0]) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + aBlock.setBlockBounds(0.0F, 0.0F + NoZFightOffset, 0.0F, 1.0F, 0.125F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); @@ -325,7 +323,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[1]) { - aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F, 1.0F); + aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F - NoZFightOffset, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); @@ -343,7 +341,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[2]) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F); + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F + NoZFightOffset, 1.0F, 1.0F, 0.125F); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); @@ -361,7 +359,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[3]) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F); + aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F - NoZFightOffset); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); @@ -379,7 +377,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[4]) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); + aBlock.setBlockBounds(0.0F + NoZFightOffset, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); @@ -397,7 +395,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); } if (tIsCovered[5]) { - aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F - NoZFightOffset, 1.0F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 787c3c0d76..35cc78d162 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -175,10 +175,19 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { if (drillY == 0 || oreBlockPositions.isEmpty()) { moveOneDown(aBaseMetaTileEntity); } else { - ChunkPosition oreBlockPos = oreBlockPositions.remove(0); - mineBlock(aBaseMetaTileEntity, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); - if (debugBlockMiner) { - GT_Log.out.println("MINER: Mining GT ore block at " + oreBlockPos.chunkPosX + " " + drillY + " " + oreBlockPos.chunkPosZ); + ChunkPosition oreBlockPos; + Block block; + do { + oreBlockPos = oreBlockPositions.remove(0); + block = aBaseMetaTileEntity.getBlockOffset(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + } // someone else might have removed the block + while (block == Blocks.air && !oreBlockPositions.isEmpty()); + + if (block != Blocks.air) { + mineBlock(aBaseMetaTileEntity, block, + aBaseMetaTileEntity.getXCoord() + oreBlockPos.chunkPosX, + aBaseMetaTileEntity.getYCoord() + oreBlockPos.chunkPosY, + aBaseMetaTileEntity.getZCoord() + oreBlockPos.chunkPosZ); } } } @@ -236,11 +245,9 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { waitMiningPipe = true; return false; } - if (aBaseMetaTileEntity.getBlockOffset(0, drillY - 1, 0) != Blocks.air) { - mineBlock(aBaseMetaTileEntity, 0, drillY - 1, 0); - if (debugBlockMiner) { - GT_Log.out.println("MINER: Removed block to replace with pipe" ); - } + Block block = aBaseMetaTileEntity.getBlockOffset(0, drillY - 1, 0); + if (block != Blocks.air) { + mineBlock(aBaseMetaTileEntity, block, xCoord, yCoord + drillY - 1, zCoord); } aBaseMetaTileEntity.getWorld().setBlock(xCoord, yCoord + drillY - 1, zCoord, MINING_PIPE_TIP_BLOCK); drillY--; @@ -248,18 +255,20 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { return true; } - public void mineBlock(IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z) { - if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseMetaTileEntity), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z, true)) { + public void mineBlock(IGregTechTileEntity aBaseMetaTileEntity, Block block, int x, int y, int z) { + if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseMetaTileEntity), x, y, z, true)) { if (debugBlockMiner) - GT_Log.out.println("MINER: FakePlayer cannot mine block at " + (aBaseMetaTileEntity.getXCoord() + x) + ", " + (aBaseMetaTileEntity.getYCoord() + y) + ", " + (aBaseMetaTileEntity.getZCoord() + z)); - return; + GT_Log.out.println("MINER: FakePlayer cannot mine block at " + x + ", " + y + ", " + z); + } else { + ArrayList<ItemStack> drops = getBlockDrops(block, x, y, z); + if (drops.size() > 0) + mOutputItems[0] = drops.get(0); + if (drops.size() > 1) + mOutputItems[1] = drops.get(1); + aBaseMetaTileEntity.getWorld().setBlockToAir(x, y, z); + if (debugBlockMiner) + GT_Log.out.println("MINER: Mining GT ore block at " + x + " " + y + " " + z); } - ArrayList<ItemStack> drops = getBlockDrops(aBaseMetaTileEntity.getBlockOffset(x, y, z), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z); - if (drops.size() > 0) - mOutputItems[0] = drops.get(0); - if (drops.size() > 1) - mOutputItems[1] = drops.get(1); - aBaseMetaTileEntity.getWorld().setBlockToAir(aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z); } private ArrayList<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java index 1621793098..ec86673c58 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java @@ -1,18 +1,34 @@ package gregtech.loaders.oreprocessing; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TextureSet; +import gregtech.api.enums.ToolDictNames; import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.GT_StdRenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_RecipeRegistrator; import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Proxy; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -public class ProcessingPlate implements gregtech.api.interfaces.IOreRecipeRegistrator {//TODO COMPARE WITH OLD PLATE## generator +import static gregtech.api.enums.ConfigCategories.Recipes.harderrecipes; +import static gregtech.api.enums.GT_Values.L; +import static gregtech.api.enums.GT_Values.NI; +import static gregtech.api.enums.GT_Values.RA; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED; +import static gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS; +import static gregtech.common.GT_Proxy.tBits; + +public class ProcessingPlate implements gregtech.api.interfaces.IOreRecipeRegistrator { public ProcessingPlate() { OrePrefixes.plate.add(this); OrePrefixes.plateDouble.add(this); @@ -24,195 +40,560 @@ public class ProcessingPlate implements gregtech.api.interfaces.IOreRecipeRegist OrePrefixes.itemCasing.add(this); } - public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - boolean aNoSmashing = aMaterial.contains(SubTag.NO_SMASHING); - boolean aNoWorking = aMaterial.contains(SubTag.NO_WORKING); - long aMaterialMass = aMaterial.getMass(); - + /** + * Register processes for the {@link ItemStack} with Ore Dictionary Name Prefix "plate" + * + * @param aPrefix always != null, the {@link OrePrefixes} of the {@link ItemStack} + * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! + * the {@link Materials} of the {@link ItemStack} + * @param aOreDictName the Ore Dictionary Name {@link String} of the {@link ItemStack} + * @param aModName the ModID {@link String} of the mod providing this {@link ItemStack} + * @param aStack always != null, the {@link ItemStack} to register + */ + public void registerOre(OrePrefixes aPrefix, + Materials aMaterial, + String aOreDictName, + String aModName, + ItemStack aStack) { + + final boolean aNoSmashing = aMaterial.contains(SubTag.NO_SMASHING); + final boolean aNoWorking = aMaterial.contains(SubTag.NO_WORKING); + final long aMaterialMass = aMaterial.getMass(); + switch (aPrefix) { case plate: - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GT_ModHandler.removeRecipeDelayed(aStack); - - if (aMaterial.mStandardMoltenFluid != null) { - if (!(aMaterial == Materials.AnnealedCopper || aMaterial == Materials.WroughtIron)) { - GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Plate.get(0L), aMaterial.getMolten(144L), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), 32, 8); - } - } - switch (aMaterial.mName) { - case "Iron": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.iron_block, 1, 0), null); - break; - case "Gold": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.gold_block, 1, 0), null); - break; - case "Diamond": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.diamond_block, 1, 0), null); - break; - case "Emerald": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.emerald_block, 1, 0), null); - break; - case "Lapis": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.lapis_block, 1, 0), null); - break; - case "Coal": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.coal_block, 1, 0), null); - break; - case "Redstone": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.redstone_block, 1, 0), null); - break; - case "Glowstone": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.glowstone, 1, 0), null); - break; - case "NetherQuartz": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.quartz_block, 1, 0), null); - break; - case "Obsidian": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.obsidian, 1, 0), null); - break; - case "Stone": - GregTech_API.registerCover(aStack, new GT_CopiedBlockTexture(Blocks.stone, 1, 0), null); - break; - case "GraniteBlack": - GregTech_API.registerCover(aStack, new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.GRANITE_BLACK_SMOOTH), null); - break; - case "GraniteRed": - GregTech_API.registerCover(aStack, new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.GRANITE_RED_SMOOTH), null); - break; - case "Basalt": - GregTech_API.registerCover(aStack, new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.BASALT_SMOOTH), null); - break; - case "Marble": - GregTech_API.registerCover(aStack, new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.MARBLE_SMOOTH), null); - break; - case "Concrete": - GregTech_API.registerCover(aStack, new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.CONCRETE_LIGHT_SMOOTH), null); - break; - default: - GregTech_API.registerCover(aStack, new GT_RenderedTexture(aMaterial.mIconSet.mTextures[71], aMaterial.mRGBa, false), null); - } - - if (aMaterial.mFuelPower > 0) - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower, aMaterial.mFuelType); - GT_Utility.removeSimpleIC2MachineRecipe(GT_Utility.copyAmount(9L, aStack), GT_ModHandler.getCompressorRecipeList(), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L)); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"hX", 'X', OrePrefixes.plate.get(aMaterial)}); - - if (aMaterial == Materials.Paper) - GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Recipes.harderrecipes, aStack, true) ? 2L : 3L, aStack), GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"XXX", 'X', new ItemStack(net.minecraft.init.Items.reeds, 1, 32767)}); - - if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial)) { - if (!aNoSmashing && GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"h", "X", "X", 'X', OrePrefixes.ingot.get(aMaterial)}); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', OrePrefixes.ingot.get(aMaterial)}); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"h", "X", 'X', OrePrefixes.gem.get(aMaterial)}); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', OrePrefixes.gem.get(aMaterial)}); - //GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"h", "X", 'X', OrePrefixes.ingotDouble.get(aMaterial)}); - //GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"H", "X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', OrePrefixes.ingotDouble.get(aMaterial)}); - } - if ((aMaterial.contains(SubTag.MORTAR_GRINDABLE)) && (GregTech_API.sRecipeFile.get(ConfigCategories.Tools.mortar, aMaterial.mName, true))) - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"X", "m", 'X', OrePrefixes.plate.get(aMaterial)}); - } + registerPlate(aMaterial, aStack, aNoSmashing); break; case plateDouble: - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GregTech_API.registerCover(aStack, new gregtech.api.objects.GT_RenderedTexture(aMaterial.mIconSet.mTextures[72], aMaterial.mRGBa, false), null); - if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); - if (GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Tools.hammerdoubleplate, OrePrefixes.plate.get(aMaterial).toString(), true)) { - Object aPlateStack = OrePrefixes.plate.get(aMaterial); - GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"I", "B", "h", 'I', aPlateStack, 'B', aPlateStack}); - GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(1L, aStack), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, aPlateStack, aPlateStack}); - } - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 2L, 1L), 96); - } else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 2L), Materials.Glue.getFluid(10L), GT_Utility.copyAmount(1L, aStack), 64, 8); - } + registerPlateDouble(aMaterial, aStack, aNoSmashing, aMaterialMass); break; case plateTriple: - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GregTech_API.registerCover(aStack, new gregtech.api.objects.GT_RenderedTexture(aMaterial.mIconSet.mTextures[73], aMaterial.mRGBa, false), null); - if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); - if (GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Tools.hammertripleplate, OrePrefixes.plate.get(aMaterial).toString(), true)) { - Object aPlateStack = OrePrefixes.plate.get(aMaterial); - GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"I", "B", "h", 'I', OrePrefixes.plateDouble.get(aMaterial), 'B', aPlateStack}); - GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(1L, aStack), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, aPlateStack, aPlateStack, aPlateStack}); - } - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 3L), GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 3L, 1L), 96); - }else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 3L), gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 3L), Materials.Glue.getFluid(20L), GT_Utility.copyAmount(1L, aStack), 96, 8); - } - GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(1L, aStack), 2, GT_OreDictUnificator.get(OrePrefixes.compressed, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));//added + registerPlateTriple(aMaterial, aStack, aNoSmashing, aMaterialMass); break; case plateQuadruple: - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GregTech_API.registerCover(aStack, new gregtech.api.objects.GT_RenderedTexture(aMaterial.mIconSet.mTextures[74], aMaterial.mRGBa, false), null); - if (!aNoWorking) - GT_Values.RA.addCNCRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.gearGt, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 30); - if (!aNoSmashing) { - if (GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Tools.hammerquadrupleplate, OrePrefixes.plate.get(aMaterial).toString(), true)) { - Object aPlateStack = OrePrefixes.plate.get(aMaterial); - GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"I", "B", "h", 'I', OrePrefixes.plateTriple.get(aMaterial), 'B', aPlateStack}); - GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(1L, aStack), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, aPlateStack, aPlateStack, aPlateStack, aPlateStack}); - } - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 4L, 1L), 96); - } else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 4L), Materials.Glue.getFluid(30L), GT_Utility.copyAmount(1L, aStack), 128, 8); - } + registerPlateQuadruple(aMaterial, aStack, aNoSmashing, aMaterialMass, aNoWorking); break; case plateQuintuple: - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GregTech_API.registerCover(aStack, new gregtech.api.objects.GT_RenderedTexture(aMaterial.mIconSet.mTextures[75], aMaterial.mRGBa, false), null); - if (!aNoSmashing) { - if (GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Tools.hammerquintupleplate, OrePrefixes.plate.get(aMaterial).toString(), true)) { - Object aPlateStack = OrePrefixes.plate.get(aMaterial); - GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"I", "B", "h", 'I', OrePrefixes.plateQuadruple.get(aMaterial), 'B', aPlateStack}); - GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(1L, aStack), new Object[]{ToolDictNames.craftingToolForgeHammer, aPlateStack, aPlateStack, aPlateStack, aPlateStack, aPlateStack}); - } - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 5L), GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 5L, 1L), 96); - } else { - gregtech.api.enums.GT_Values.RA.addAssemblerRecipe(gregtech.api.util.GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 5L), ItemList.Circuit_Integrated.getWithDamage(0L, 5L), Materials.Glue.getFluid(40L), GT_Utility.copyAmount(1L, aStack), 160, 8); - } + registerPlateQuintuple(aMaterial, aStack, aNoSmashing, aMaterialMass); break; case plateDense: - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GregTech_API.registerCover(aStack, new GT_RenderedTexture(aMaterial.mIconSet.mTextures[76], aMaterial.mRGBa, false), null); - if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 9L), GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 9L, 1L), 96); - } + registerPlateDense(aMaterial, aStack, aNoSmashing, aMaterialMass); break; case itemCasing: + registerItemCasing(aPrefix, aMaterial, aStack, aNoSmashing); + break; + case plateAlloy: + registerPlateAlloy(aOreDictName, aStack); + break; + default: + break; + } + } + + private void registerPlate(final Materials aMaterial, final ItemStack aStack, final boolean aNoSmashing) { + + registerCover(aMaterial, aStack); + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + GT_ModHandler.removeRecipeDelayed(aStack); + + GT_Utility.removeSimpleIC2MachineRecipe( + GT_Utility.copyAmount(9L, aStack), + GT_ModHandler.getCompressorRecipeList(), + GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L)); + + if (aMaterial.mFuelPower > 0) { + + RA.addFuel( + GT_Utility.copyAmount(1L, aStack), + NI, + aMaterial.mFuelPower, + aMaterial.mFuelType); + + } + + if (aMaterial.mStandardMoltenFluid != null && + !(aMaterial == Materials.AnnealedCopper || aMaterial == Materials.WroughtIron)) { + + RA.addFluidSolidifierRecipe( + ItemList.Shape_Mold_Plate.get(0L), + aMaterial.getMolten(L), + aMaterial.getPlates(1), + 32, 8); + + } + + GT_ModHandler.addCraftingRecipe( + GT_OreDictUnificator.get(OrePrefixes.foil, aMaterial, 2L), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "hX", + 'X', OrePrefixes.plate.get(aMaterial)}); + + if (aMaterial == Materials.Paper) { + + GT_ModHandler.addCraftingRecipe( + GT_Utility.copyAmount( + GregTech_API.sRecipeFile.get(harderrecipes, aStack, true) ? 2L : 3L, + aStack), + BUFFERED, + new Object[]{ + "XXX", + 'X', new ItemStack(Items.reeds, 1, W)}); + } + + if (aMaterial.mUnificatable && aMaterial.mMaterialInto == aMaterial) { + + if (!aNoSmashing && + GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) { + + GT_ModHandler.addCraftingRecipe( + aMaterial.getPlates(1), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "h", // craftingToolHardHammer + "X", + "X", + 'X', OrePrefixes.ingot.get(aMaterial)}); + + // Only added if IC2 Forge Hammer is enabled in Recipes.cfg: B:ic2forgehammer_true=false + GT_ModHandler.addCraftingRecipe( + aMaterial.getPlates(1), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "H", // craftingToolForgeHammer + "X", + 'H', ToolDictNames.craftingToolForgeHammer, + 'X', OrePrefixes.ingot.get(aMaterial)}); + + GT_ModHandler.addCraftingRecipe( + aMaterial.getPlates(1), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "h", // craftingToolHardHammer + "X", + 'X', OrePrefixes.gem.get(aMaterial)}); + + // Only added if IC2 Forge Hammer is enabled in Recipes.cfg: B:ic2forgehammer_true=false + GT_ModHandler.addCraftingRecipe( + aMaterial.getPlates(1), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "H", // craftingToolForgeHammer + "X", + 'H', ToolDictNames.craftingToolForgeHammer, + 'X', OrePrefixes.gem.get(aMaterial)}); + + } + + if ((aMaterial.contains(SubTag.MORTAR_GRINDABLE)) && + (GregTech_API.sRecipeFile.get(ConfigCategories.Tools.mortar, aMaterial.mName, true))) { + + GT_ModHandler.addCraftingRecipe( + aMaterial.getDust(1), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "X", + "m", + 'X', OrePrefixes.plate.get(aMaterial)}); + + } + } + } + + private void registerPlateDouble(final Materials aMaterial, + final ItemStack aStack, + final boolean aNoSmashing, + final long aMaterialMass) { + + registerCover(aMaterial, aStack); + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + + if (!aNoSmashing) { + + RA.addBenderRecipe( + GT_Utility.copyAmount(2L, aStack), + GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), + (int) Math.max(aMaterialMass * 2L, 1L), + 96); + + if (GregTech_API.sRecipeFile.get( + gregtech.api.enums.ConfigCategories.Tools.hammerdoubleplate, + OrePrefixes.plate.get(aMaterial).toString(), true)) { + + Object aPlateStack = OrePrefixes.plate.get(aMaterial); + + GT_ModHandler.addCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + "I", + "B", + "h", // craftingToolHardHammer + 'I', aPlateStack, + 'B', aPlateStack}); + + // Only added if IC2 Forge Hammer is enabled in Recipes.cfg: B:ic2forgehammer_true=false + GT_ModHandler.addShapelessCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + aPlateStack, + aPlateStack}); + + } + + RA.addBenderRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), + GT_Utility.copyAmount(1L, aStack), + (int) Math.max(aMaterialMass * 2L, 1L), + 96); + + } else { + + RA.addAssemblerRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), + gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 2L), + Materials.Glue.getFluid(10L), + GT_Utility.copyAmount(1L, aStack), + 64, 8); + + } + } + + private void registerPlateTriple(final Materials aMaterial, + final ItemStack aStack, + final boolean aNoSmashing, + final long aMaterialMass) { + + registerCover(aMaterial, aStack); + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + + if (!aNoSmashing) { + + RA.addBenderRecipe( + GT_Utility.copyAmount(3L, aStack), + GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), + (int) Math.max(aMaterialMass * 3L, 1L), + 96); + + if (GregTech_API.sRecipeFile.get( + gregtech.api.enums.ConfigCategories.Tools.hammertripleplate, + OrePrefixes.plate.get(aMaterial).toString(), true)) { + + Object aPlateStack = OrePrefixes.plate.get(aMaterial); + + GT_ModHandler.addCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + "I", + "B", + "h", // craftingToolHardHammer + 'I', OrePrefixes.plateDouble.get(aMaterial), + 'B', aPlateStack}); + + GT_ModHandler.addShapelessCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + aPlateStack, aPlateStack, aPlateStack}); + + } + + RA.addBenderRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 3L), + GT_Utility.copyAmount(1L, aStack), + (int) Math.max(aMaterialMass * 3L, 1L), + 96); + + } else { + + RA.addAssemblerRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 3L), + gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 3L), + Materials.Glue.getFluid(20L), + GT_Utility.copyAmount(1L, aStack), + 96, 8); + + } + + RA.addImplosionRecipe( + GT_Utility.copyAmount(1L, aStack), + 2, + GT_OreDictUnificator.get(OrePrefixes.compressed, aMaterial, 1L), + GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + + } + + private void registerPlateQuadruple(final Materials aMaterial, + final ItemStack aStack, + final boolean aNoSmashing, + final long aMaterialMass, + final boolean aNoWorking) { + + registerCover(aMaterial, aStack); + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + + if (!aNoWorking) + + RA.addCNCRecipe( + GT_Utility.copyAmount(1L, aStack), + GT_OreDictUnificator.get(OrePrefixes.gearGt, aMaterial, 1L), + (int) Math.max(aMaterialMass * 2L, 1L), + 30); + + if (!aNoSmashing) { + + if (GregTech_API.sRecipeFile.get( + gregtech.api.enums.ConfigCategories.Tools.hammerquadrupleplate, + OrePrefixes.plate.get(aMaterial).toString(), true)) { + + Object aPlateStack = OrePrefixes.plate.get(aMaterial); + + GT_ModHandler.addCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + "I", + "B", + "h", // craftingToolHardHammer + 'I', OrePrefixes.plateTriple.get(aMaterial), + 'B', aPlateStack}); + + GT_ModHandler.addShapelessCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + aPlateStack, aPlateStack, aPlateStack, aPlateStack}); + + } + + RA.addBenderRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), + GT_Utility.copyAmount(1L, aStack), + (int) Math.max(aMaterialMass * 4L, 1L), + 96); + + } else { + + RA.addAssemblerRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), + gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 4L), + Materials.Glue.getFluid(30L), GT_Utility.copyAmount(1L, aStack), + 128, 8); + + } + } + + private void registerPlateQuintuple(final Materials aMaterial, + final ItemStack aStack, + final boolean aNoSmashing, + final long aMaterialMass) { + + registerCover(aMaterial, aStack); + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + + if (!aNoSmashing) { + + if (GregTech_API.sRecipeFile.get( + gregtech.api.enums.ConfigCategories.Tools.hammerquintupleplate, + OrePrefixes.plate.get(aMaterial).toString(), true)) { + + Object aPlateStack = OrePrefixes.plate.get(aMaterial); + + GT_ModHandler.addCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + "I", + "B", + "h", // craftingToolHardHammer + 'I', OrePrefixes.plateQuadruple.get(aMaterial), + 'B', aPlateStack}); + + GT_ModHandler.addShapelessCraftingRecipe( + GT_Utility.copyAmount(1L, aStack), + DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED, + new Object[]{ + ToolDictNames.craftingToolForgeHammer, + aPlateStack, aPlateStack, aPlateStack, aPlateStack, aPlateStack}); + + } + + RA.addBenderRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 5L), + GT_Utility.copyAmount(1L, aStack), + (int) Math.max(aMaterialMass * 5L, 1L), + 96); + + } else { + + RA.addAssemblerRecipe( + gregtech.api.util.GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 5L), + ItemList.Circuit_Integrated.getWithDamage(0L, 5L), + Materials.Glue.getFluid(40L), + GT_Utility.copyAmount(1L, aStack), + 160, 8); + + } + } + + private void registerPlateDense(final Materials aMaterial, + final ItemStack aStack, + final boolean aNoSmashing, + final long aMaterialMass) { + + registerCover(aMaterial, aStack); + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + + if (!aNoSmashing) { + + RA.addBenderRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 9L), + GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 9L, 1L), + 96); + + } + + } + + private void registerItemCasing(final OrePrefixes aPrefix, + final Materials aMaterial, + final ItemStack aStack, + final boolean aNoSmashing) { + + GT_ModHandler.removeRecipeByOutputDelayed(aStack); + + if (aMaterial.mStandardMoltenFluid != null) { + + RA.addFluidSolidifierRecipe( + ItemList.Shape_Mold_Casing.get(0L), + aMaterial.getMolten(L / 2), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L), + 16, 8); + + } + + if (aMaterial.mUnificatable && + aMaterial.mMaterialInto == aMaterial && + !aNoSmashing && + GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) { + + GT_ModHandler.addCraftingRecipe( + GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "h X", + 'X', OrePrefixes.plate.get(aMaterial)}); + + // Only added if IC2 Forge Hammer is enabled in Recipes.cfg: B:ic2forgehammer_true=false + GT_ModHandler.addCraftingRecipe( + GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L), + tBits, // DO_NOT_CHECK_FOR_COLLISIONS|BUFFERED|ONLY_ADD_IF_RESULT_IS_NOT_NULL|NOT_REMOVABLE + new Object[]{ + "H X", + 'H', ToolDictNames.craftingToolForgeHammer, + 'X', OrePrefixes.plate.get(aMaterial)}); + + } + + RA.addAlloySmelterRecipe( + GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 2L), + ItemList.Shape_Mold_Casing.get(0L), GT_Utility.copyAmount(3L, aStack), 128, 15); + + RA.addCutterRecipe( + GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 2L), + NI, + (int) Math.max(aMaterial.getMass(), 1L), + 16); + + RA.addExtruderRecipe( + GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), + ItemList.Shape_Extruder_Casing.get(0L), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 2L), + (int) Math.max(aMaterial.getMass(), 1L), + 45); + + GT_RecipeRegistrator.registerReverseFluidSmelting(aStack, aMaterial, aPrefix.mMaterialAmount, null); + + } + + private void registerPlateAlloy(final String aOreDictName, + final ItemStack aStack) { + + switch (aOreDictName) { + + case "plateAlloyCarbon": + + RA.addAssemblerRecipe( + GT_ModHandler.getIC2Item("generator", 1L), + GT_Utility.copyAmount(4L, aStack), + GT_ModHandler.getIC2Item("windMill", 1L), + 6400, 8); + + break; + + case "plateAlloyAdvanced": + + GT_ModHandler.addAlloySmelterRecipe( + GT_Utility.copyAmount(1L, aStack), + new ItemStack(Blocks.glass, 3, W), + GT_ModHandler.getIC2Item("reinforcedGlass", 4L), + 400, 4, false); + + GT_ModHandler.addAlloySmelterRecipe( + GT_Utility.copyAmount(1L, aStack), + Materials.Glass.getDust(3), + GT_ModHandler.getIC2Item("reinforcedGlass", 4L), + 400, 4, false); + + break; + + case "plateAlloyIridium": + + // Remove IC2 Shaped recipe for Iridium Reinforced Plate GT_ModHandler.removeRecipeByOutputDelayed(aStack); - if (aMaterial.mStandardMoltenFluid != null) { - GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Casing.get(0L), aMaterial.getMolten(72L), GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L), 16, 8); - } - if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial)) { - if (!aNoSmashing && GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"h X", 'X', OrePrefixes.plate.get(aMaterial)}); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"H X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', OrePrefixes.plate.get(aMaterial)}); - } - } - GT_Values.RA.addAlloySmelterRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 2L), ItemList.Shape_Mold_Casing.get(0L), GT_Utility.copyAmount(3L, aStack), 128, 15); - GT_Values.RA.addCutterRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 2L), null, (int) Math.max(aMaterial.getMass(), 1L), 16); - GT_Values.RA.addExtruderRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), ItemList.Shape_Extruder_Casing.get(0L), GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 2L), (int) Math.max(aMaterial.getMass(), 1L), 45); - GT_RecipeRegistrator.registerReverseFluidSmelting(aStack, aMaterial, aPrefix.mMaterialAmount, null); + break; - case plateAlloy: - switch (aOreDictName) { - case "plateAlloyCarbon": - GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getIC2Item("generator", 1L), GT_Utility.copyAmount(4L, aStack), GT_ModHandler.getIC2Item("windMill", 1L), 6400, 8); - case "plateAlloyAdvanced": - GT_ModHandler.addAlloySmelterRecipe(GT_Utility.copyAmount(1L, aStack), new ItemStack(Blocks.glass, 3, 32767), GT_ModHandler.getIC2Item("reinforcedGlass", 4L), 400, 4, false); - GT_ModHandler.addAlloySmelterRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glass, 3L), GT_ModHandler.getIC2Item("reinforcedGlass", 4L), 400, 4, false); - case "plateAlloyIridium": - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - case "plateIron": case "plateCopper": case "plateTin": case "plateBronze": case "plateGold": case "plateSteel ": case "plateLead": case "plateAluminium": case "plateStainlessSteel": case "plateTitanium": case "plateTungsten": case "plateTungstenSteel": case "plateIridium": case "plateChrome": case "plateOsmium": case "plateNeutronium": - GT_ModHandler.removeRecipeByOutputDelayed(aStack); - } + default: break; - default: - break; + } + } + + private void registerCover(final Materials aMaterial, final ItemStack aStack) { + + // Get ItemStack of Block matching Materials + ItemStack tStack = NI; + // Try different prefixes to use same smooth stones as older GT5U + for (OrePrefixes orePrefix : new OrePrefixes[]{ + OrePrefixes.block, OrePrefixes.block_, OrePrefixes.stoneSmooth, OrePrefixes.stone}) { + if ((tStack = GT_OreDictUnificator.get(orePrefix, aMaterial, 1)) != NI) break; + } + + // Register the cover + GregTech_API.registerCover( + aStack, + // If there is an ItemStack of Block for Materials + tStack != NI ? + // Copy Block texture + new GT_CopiedBlockTexture(Block.getBlockFromItem(tStack.getItem()), 1, tStack.getItemDamage()) : + // or use Materials mRGBa dyed blocs/materialicons/MATERIALSET/block1 icons + new GT_StdRenderedTexture( + aMaterial.mIconSet.mTextures[TextureSet.INDEX_block1], aMaterial.mRGBa, false), + null); + + } + } |