diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index 6fde0e50..0a38cd51 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -842,7 +842,7 @@ public class BlockGenericPipe extends BlockContainer { } return item; } - + public static boolean isPipeRegistered(int key) { return pipes.containsKey(key); } diff --git a/common/buildcraft/transport/ItemFacade.java b/common/buildcraft/transport/ItemFacade.java index 0cb21e69..d0a9f9d2 100644 --- a/common/buildcraft/transport/ItemFacade.java +++ b/common/buildcraft/transport/ItemFacade.java @@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; +import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; import buildcraft.api.recipes.AssemblyRecipe; import buildcraft.core.CreativeTabBuildCraft; @@ -44,6 +45,9 @@ public class ItemFacade extends ItemBuildCraft { String name = super.getItemDisplayName(itemstack); int decodedBlockId = ItemFacade.getBlockId(itemstack.getItemDamage()); int decodedMeta = ItemFacade.getMetaData(itemstack.getItemDamage()); + if (decodedBlockId < Block.blocksList.length && Block.blocksList[decodedBlockId] != null && Block.blocksList[decodedBlockId].getRenderType() == 31) { + decodedMeta &= 0x3; + } ItemStack newStack = new ItemStack(decodedBlockId, 1, decodedMeta); if (Item.itemsList[decodedBlockId] != null) { name += ": " + CoreProxy.proxy.getItemDisplayName(newStack); @@ -107,10 +111,10 @@ public class ItemFacade extends ItemBuildCraft { if (!(b.blockID == 20)){ //Explicitly allow glass if (b.blockID == 7 //Bedrock || b.blockID == 2 //Grass block - || b.blockID == 18 //Oak leaves + || b.blockID == 18 //Oak leaves || b.blockID == 19 //Sponge || b.blockID == 95 //Locked chest - ) { + ) { continue; } if (!b.isOpaqueCube() || b.hasTileEntity(0) || !b.renderAsNormalBlock()) { @@ -157,6 +161,21 @@ public class ItemFacade extends ItemBuildCraft { // 3 Structurepipes + this block makes 6 facades AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeStructureCobblestone, 3), itemStack }, 8000, new ItemStack(BuildCraftTransport.facadeItem, 6, ItemFacade.encode(itemStack.itemID, itemStack.getItemDamage())))); + if (itemStack.itemID < Block.blocksList.length && Block.blocksList[itemStack.itemID] != null) { + Block bl = Block.blocksList[itemStack.itemID]; + + // Special handling for logs + if (bl.getRenderType() == 31) { + ItemStack mainLog = new ItemStack(BuildCraftTransport.facadeItem, 1, ItemFacade.encode(itemStack.itemID, itemStack.getItemDamage())); + ItemStack rotLog1 = new ItemStack(BuildCraftTransport.facadeItem, 1, ItemFacade.encode(itemStack.itemID, itemStack.getItemDamage() | 4)); + ItemStack rotLog2 = new ItemStack(BuildCraftTransport.facadeItem, 1, ItemFacade.encode(itemStack.itemID, itemStack.getItemDamage() | 8)); + allFacades.add(rotLog1); + allFacades.add(rotLog2); + CoreProxy.proxy.addShapelessRecipe(rotLog1, new Object[] { mainLog }); + CoreProxy.proxy.addShapelessRecipe(rotLog2, new Object[] { rotLog1 }); + CoreProxy.proxy.addShapelessRecipe(mainLog, new Object[] { rotLog2 }); + } + } } @Override diff --git a/common/buildcraft/transport/render/PipeWorldRenderer.java b/common/buildcraft/transport/render/PipeWorldRenderer.java index 6d91e40d..e8c6b6f8 100644 --- a/common/buildcraft/transport/render/PipeWorldRenderer.java +++ b/common/buildcraft/transport/render/PipeWorldRenderer.java @@ -183,7 +183,24 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (state.facadeMatrix.getFacadeBlockId(direction) != 0) { - state.currentTexture = Block.blocksList[state.facadeMatrix.getFacadeBlockId(direction)].getIcon(direction.ordinal(), state.facadeMatrix.getFacadeMetaId(direction)); + Block renderBlock = Block.blocksList[state.facadeMatrix.getFacadeBlockId(direction)]; + int renderMeta = state.facadeMatrix.getFacadeMetaId(direction); + state.currentTexture = renderBlock.getIcon(direction.ordinal(), renderMeta); + + if (renderBlock.getRenderType() == 31) { + if ((renderMeta & 12) == 4) + { + renderblocks.uvRotateEast = 1; + renderblocks.uvRotateWest = 1; + renderblocks.uvRotateTop = 1; + renderblocks.uvRotateBottom = 1; + } + else if ((renderMeta & 12) == 8) + { + renderblocks.uvRotateSouth = 1; + renderblocks.uvRotateNorth = 1; + } + } // Hollow facade if (state.pipeConnectionMatrix.isConnected(direction)) { @@ -228,6 +245,15 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } + + if (renderBlock.getRenderType() == 31) { + renderblocks.uvRotateSouth = 0; + renderblocks.uvRotateEast = 0; + renderblocks.uvRotateWest = 0; + renderblocks.uvRotateNorth = 0; + renderblocks.uvRotateTop = 0; + renderblocks.uvRotateBottom = 0; + } } } @@ -256,7 +282,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { } private void pipePlugRenderer(RenderBlocks renderblocks, Block block, PipeRenderState state, int x, int y, int z) { - + float zFightOffset = 1F / 4096F; float[][] zeroState = new float[3][2]; @@ -269,7 +295,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { // Z START - END zeroState[2][0] = 0.25F + zFightOffset; zeroState[2][1] = 0.75F - zFightOffset; - + state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { @@ -282,7 +308,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { renderblocks.renderStandardBlock(block, x, y, z); } } - + // X START - END zeroState[0][0] = 0.25F + 0.125F/2 + zFightOffset; zeroState[0][1] = 0.75F - 0.125F/2 + zFightOffset; @@ -292,7 +318,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { // Z START - END zeroState[2][0] = 0.25F + 0.125F/2; zeroState[2][1] = 0.75F - 0.125F/2; - + state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { @@ -305,7 +331,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { renderblocks.renderStandardBlock(block, x, y, z); } } - + } private void pipeWireRender(RenderBlocks renderblocks, Block block, PipeRenderState state, float cx, float cy, float cz, IPipe.WireColor color, int x, @@ -476,7 +502,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { renderblocks.renderStandardBlock(block, x, y, z); } } - + private boolean shouldRenderNormalPipeSide(PipeRenderState state, ForgeDirection direction){ return !state.pipeConnectionMatrix.isConnected(direction) && state.facadeMatrix.getFacadeBlockId(direction) == 0 && !state.plugMatrix.isConnected(direction); }