Posted June 5, 201411 yr I have a problem with the block metadata textures. All the textures appear correct while in your inventory, but when you place them they all have the same texture, being the first block's texture. I don't know what I'm doing wrong. Here's my block file: package com.eastonium.bionicle.blocks; import java.util.List; import com.eastonium.bionicle.Bionicle; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; public class BlockKoro extends Block { public static final String[] stoneBlockNames = new String[] {"Onu_1", "Onu_2", "Po_1", "Po_2", "Ta_1", "Ta_2", "Ta_3", "Trdx_1", "Trdx_2"}; public static final String[] litBlockNames = new String[] {"Onu_1", "Ta_0"}; public static final String[] iceBlockNames = new String[] {"Ko_1", "Ko_2"}; public static final String[] leafyBlockNames = new String[] {"Ga_1", "Ga_2", "Ga_3"}; @SideOnly(Side.CLIENT) private IIcon[] icons; public BlockKoro(Material blockMaterial) { super(blockMaterial); this.setCreativeTab(Bionicle.bioBlockTab); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int par1, int par2) { if (par2 < 0 || par2 >= this.icons.length) { par2 = 0; } return this.icons[par2]; } @Override public int damageDropped(int damage) { return damage; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list) { int type = (this.getMaterial() == Material.rock ? 9 : (this.getMaterial() == Material.leaves ? 3 : 2)); for(int i = 0; i < type; i++) { list.add(new ItemStack(block, 1, i)); } } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegisterer) { int type = (this.getMaterial() == Material.rock ? 9 : (this.getMaterial() == Material.leaves ? 3 : 2)); this.icons = new IIcon[type]; for (int i = 0; i < this.icons.length; ++i) { if(this.getMaterial() == Material.rock){ this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + stoneBlockNames[i]); }else if(this.getMaterial() == Material.redstoneLight){ this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + litBlockNames[i]); }else if(this.getMaterial() == Material.packedIce){ this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + iceBlockNames[i]); }else if(this.getMaterial() == Material.leaves){ this.icons[i] = iconRegisterer.registerIcon(Bionicle.MODID + ":" + leafyBlockNames[i]); } } } }
June 5, 201411 yr Hi This link might be of some help http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-standard-blocks-cubes.html It looks to me like you need to change your getIcon to take account of the metadata, not just the side. -TGG
June 5, 201411 yr Author the par2 in getIcon is the metadata, so I am accounting for it. the blocks don't have different textures on the sides.
June 5, 201411 yr the par2 in getIcon is the metadata, so I am accounting for it. the blocks don't have different textures on the sides. Ah, yeah so it is. I have them swapped in my helper function for some reason, sorry about that. I'm guessing then that your block is always being placed with metadata 0. Have you registered the Blocks correctly? i.e. are you using ItemBlockWithMetadata, not just ItemBlock? (or alternatively - your own Item extend ItemBlock overriding getMetadata() )? -TGG
June 5, 201411 yr Author Yeah, I'm not using an Itemblock thing, I realized I needed that earlier today. I think i can take it from here
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.