Posted August 9, 201411 yr I have a block that has a few different textures and I hae gotten it so, the front texture faces you when it is placed. But how would I make the icon when it is in my inventory display similar to how the furnace does? Here is my code: @SideOnly(Side.CLIENT) private IIcon blockTop; @SideOnly(Side.CLIENT) private IIcon blockSide; public BlockFactoryTerminal() { super(); this.setBlockName("factoryFactoryTerminal"); } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int l = MathHelper.floor_double((double) (player.rotationYaw * 4f / 360f) + .5d) & 3; if(l == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(l == 1) world.setBlockMetadataWithNotify(x, y, z, 5, 2); if(l == 2) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(l == 3) world.setBlockMetadataWithNotify(x, y, z, 4, 2); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon(String.format("%s", getUnWrappedUnlocalizedName(this.getUnlocalizedName()))); blockTop = iconRegister.registerIcon(String.format("%s", getUnWrappedUnlocalizedName(ElectricFactoryBlocks.factoryFactoryStructureBlock.getUnlocalizedName() + "Top"))); blockSide = iconRegister.registerIcon(String.format("%s", getUnWrappedUnlocalizedName(ElectricFactoryBlocks.factoryFactoryStructureBlock.getUnlocalizedName()))); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { if(side == 0 || side == 1) return blockTop; else if(side != meta) return blockSide; else return blockIcon; }
August 9, 201411 yr I have a block that has a few different textures and I hae gotten it so, the front texture faces you when it is placed. But how would I make the icon when it is in my inventory display similar to how the furnace does? What do you mean "similar to how the furnace does" ? Do you mean you want the inventory block to face a particular direction? If so, I would suggest one of two things- either change your metadata meanings so that medata=0 gives you the inventory rendering appearance that you want, or use an ISimpleBlockRenderingHandler or an IItemRenderer for your item to give you more control. For some background info, see here under the Item Rendering topics http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html -TGG
August 10, 201411 yr Author yes in the direction it faces, I got it figured out by doing what you said and if the meta = 0, render it the way I want it to
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.