I have some code that turns metal blocks into fluids in a custom dimension, and while testing it against some blocks that are only metal via metadata, it only spawned the fluid which was for the metadata of 0. After debugging a little, I found that the metadata of the block placed is always zero, regardless of the block.
I was wondering how to fix this.
Code:
if(OreDictionary.doesOreNameExist("blockTin")) {
for(ItemStack ore : OreDictionary.getOres("blockTin")) {
if(ore != null) {
if(event.block == Block.getBlockFromItem(ore.getItem()) && event.blockMetadata == ore.getItemDamage()) {
System.out.println("block=" + Block.getBlockFromItem(ore.getItem()) + ", meta=" + ore.getItemDamage());
System.out.println("event.block=" + event.block + ", event.meta=" + event.blockMetadata);
if(FluidRegistry.getFluid("tin.molten") != null) {
event.world.setBlock(event.x, event.y, event.z, FluidRegistry.getFluid("tin.molten").getBlock());
} else {
event.world.setBlock(event.x, event.y, event.z, Blocks.lava);
}
}
}
}
}