Posted June 18, 201312 yr Hello, I've created a block but the texture of it and the texture that shows up on the hotbar or toolbar(dont know the name) its not the same... How can I change that? block code: public class BlockPolluCraft extends Block { @SideOnly(Side.CLIENT) private Icon iconTopBot; @SideOnly(Side.CLIENT) private Icon iconFront; @SideOnly(Side.CLIENT) private Icon iconBack; public BlockPolluCraft(int par1, Material material) { super(par1, material); this.setHardness(2F); this.setStepSound(Block.soundMetalFootstep); this.setCreativeTab(Hygienic.hygienicCreativeTab); } public int idDropped(int par1, Random par2Random, int par3) { return BlockIDs.BLOCK_POLLUCRAFT; } public int quantityDropped(Random par1Random) { return 1; } @SideOnly(Side.CLIENT) public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { if (par5 == 1 || par5 == 0) return this.iconTopBot; else { int par6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); if (par5 == 2) { if (par6 == 2) return this.iconFront; else if (par6 == 3) return this.iconBack; else return this.blockIcon; } else if (par5 == 3) { if (par6 == 3) return this.iconFront; else if (par6 == 2) return this.iconBack; else return this.blockIcon; } else if (par5 == 4) { if (par6 == 4) return this.iconFront; else if (par6 == 5) return this.iconBack; else return this.blockIcon; } else if (par5 == 5) { if (par6 == 5) return this.iconFront; else if (par6 == 4) return this.iconBack; else return this.blockIcon; } } return this.blockIcon; } public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.setDefaultDirection(par1World, par2, par3, par4); } private void setDefaultDirection(World par1World, int par2, int par3, int par4) { if (!par1World.isRemote) { int l = par1World.getBlockId(par2, par3, par4 - 1); int i1 = par1World.getBlockId(par2, par3, par4 + 1); int j1 = par1World.getBlockId(par2 - 1, par3, par4); int k1 = par1World.getBlockId(par2 + 1, par3, par4); byte b0 = 3; if (Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[i1]) b0 = 3; if (Block.opaqueCubeLookup[i1] && !Block.opaqueCubeLookup[l]) b0 = 2; if (Block.opaqueCubeLookup[j1] && !Block.opaqueCubeLookup[k1]) b0 = 5; if (Block.opaqueCubeLookup[k1] && !Block.opaqueCubeLookup[j1]) b0 = 4; par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2); } } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double) (par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); if (l == 1) par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); if (l == 2) par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); if (l == 3) par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); if (par6ItemStack.hasDisplayName()) ((TileEntityFurnace) par1World.getBlockTileEntity(par2, par3, par4)).func_94129_a(par6ItemStack.getDisplayName()); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(ModInfo.polluCraft_Sides); this.iconTopBot = par1IconRegister.registerIcon(ModInfo.polluCraft_TopBot); this.iconFront = par1IconRegister.registerIcon(ModInfo.polluCraft_Front); this.iconBack = par1IconRegister.registerIcon(ModInfo.polluCraft_Back); } @SideOnly(Side.CLIENT) public boolean onBlockActivated(World var1, int var2, int var3, int var4, EntityPlayer player, int var6, float var7, float var8, float var9) { if (!player.isSneaking()) { player.openGui(Hygienic.instance, 1, var1, var2, var3, var4); return true; } else return false; } }
June 18, 201312 yr Because the item in the hotbar doesn't call getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) It calls getBlockTexture(int side, int metadata) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
June 18, 201312 yr Author So how can I do this? I need to use the getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) so I can have the block facing me...
June 18, 201312 yr so I can have the block facing me... Look at the furnace. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
June 19, 201312 yr Author I've done it bug it only worked half... the block rended the top and the sides... there's no front being rended... why? Render code: public Icon getIcon(int par1, int par2) { if (par1 == 1 || par1 == 0) return this.iconTopBot; else { if (par1 == 2) { if (par2 == 2) return this.iconFront; else if (par2 == 3) return this.iconBack; else return this.blockIcon; } else if (par1 == 3) { if (par2 == 3) return this.iconFront; else if (par2 == 2) return this.iconBack; else return this.blockIcon; } else if (par1 == 4) { if (par2 == 4) return this.iconFront; else if (par2 == 5) return this.iconBack; else return this.blockIcon; } else if (par1 == 5) { if (par2 == 5) return this.iconFront; else if (par2 == 4) return this.iconBack; else return this.blockIcon; } } return this.blockIcon; }
June 19, 201312 yr Honestly. I'd just return different icons. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
June 19, 201312 yr I've done it bug it only worked half... the block rended the top and the sides... there's no front being rended... -snip- why? -snip- Um... what's the metadata of the IS in your inventory? Because if it's 0 or 1, you're not going to get anything. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 19, 201312 yr Author I dont know the metadata for inventory.... Is there any way to check if the block is on inventory or if it is placed?
June 19, 201312 yr @Override public void registerIcons(IconRegister par1IconRegister) { blockIcon = par1IconRegister .registerIcon("Hunting-Traps-Mod:cage_trap"); } this is the code i use, difference is that my image renders all face to have the same texture.... Don't know if this helps I took over Hunting Traps Mod and work on helping the forge community as much as I can. View my work here: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1443756-1-7-2-1-6-4-1-5-2-1-4-7-hunting-traps-mod-v-0-4-0
June 19, 201312 yr Author That is the problem I have 4 diferent textures for each side.... Top and Bot is one Sides Front and Back but dont know why in the inventory is only rendering the bot and top and sides....
June 19, 201312 yr I dont know the metadata for inventory.... Is there any way to check if the block is on inventory or if it is placed? You could put a "print par2" statement in your getIcon() code (this will spam stdout, but it's the easiest way.) Make sure there's none of your blocks in the world. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
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.