Posted October 20, 201311 yr Hello, I've made a block with metadata. All is working fine except when i break the block, it drops with metadata 0. I've also tried overriding damageDropped() and idDropped() and getBlockDropped() but no such luck. Here is my Block class: public class Phantomblock extends Block { public Phantomblock(int par1, Material par2Material) { super(par1, par2Material); } @SideOnly(Side.CLIENT) @Override public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); } @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { if (world.getBlockMetadata(x, y, z) == 1) { return new ItemStack(blockID, 1, 1); } return new ItemStack(blockID, 1, 0); } @Override public int damageDropped(int par1) { return par1; } } My ItemBlock class: public class PhantomblockItem extends ItemBlock { public PhantomblockItem(int par1) { super(par1); } @Override public String getUnlocalizedName(ItemStack par1ItemStack) { if (par1ItemStack.getItemDamage() == 1) { return "phantomblock_inverted"; } return "phantomblock"; } @Override public int getMetadata(int par1) { return par1; } } And i register it like this: GameRegistry.registerBlock(phantomblock, PhantomblockItem.class, "phantomblock"); I hope you know why it's not dropping with metadata! Thanks in advance! ss7 You sir are a god damn hero.
October 20, 201311 yr Hi I don't know why, but I suggest: add a breakpoint in Block.harvestBlock() and step through until you find out where the metadata is being discarded. It should be pretty easy to track? -TGG
October 20, 201311 yr add to your Block class: public int damageDropped(int par1) { return par1; } minecraft returns 0 by default so you need to overide it. http://www.minecraftforum.net/topic/1937703-162smpforge-pet-mastery-hatch-level-battle/
October 21, 201311 yr Author Hello, @shucke Have you even looked at my Block class? There is already that damageDropped() method! The strange thing is that the block drops with metadata 1. EDIT: OK, i haven't had that setHasSubtypes(true) in my ItemBlock class. That solved everything! This is now SOLVED ss7 You sir are a god damn hero.
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.