So I'm tracing some issues I have placing a block that has Meta-data.
I'm using this library for reference: forgeSrc-1.11.2-13.20.0.2262.jar. For the sake of this post I updated to the most recent MDK just before posting.
The problem seem to originate in the referenced library net.minecraft.item.ItemBlock.class in function onItemUse().
As you see the function does
ItemStack itemstack = player.getHeldItem(hand);
and then
int i = this.getMetadata(itemstack.getMetadata());
The problem here is that this.getMetadata() has two different calltypes (net.minecraft.item.item.class)
Now, seeing as
itemstack.getMetadata()
returns the actual meta-data of the item as an int, the code
int i = this.getMetadata(itemstack.getMetadata());
will ALWAYS return 0 as it calls
public int getMetadata(int damage).
This causes the problem I have that whenever I have one of my added blocks with meta-data as an item, and right-click to place it as a block, the placed block is always default (0) meta-variant.
If this was intentional behaviour it seems strange to call itemstack.getMetadata() in the first place. It feels like the variable decleration should be int i = itemstack.getMetadata(); or possibly public int getMetadata(int damage) { return damage; }.
Does anyone have any information on something I might be doing wrong here? I Am fairly new to modding in minecraft so I might just be missing something.