Builder silk touch stack creation
rubensworks opened this issue ยท 3 comments
The builder seems to call Block#getMetaFromState
directly instead of invoking Block#createStackedBlock
when creating ItemStacks
for silk touched blocks.
The vanilla silk touch logic will also invoke Block#createStackedBlock
, as can be seen in Block#harvestBlock.
The problem is that this can set a non-zero metavalue to the ItemStack
, even if this is not intended by the block.
This causes issues like CyclopsMC/EvilCraft#515, and possibly also for other blocks like vanilla Redstone when it is activated.
I cannot call createStackedBlock() as that is not a public method. Any other proposed solution?
Ah, my bad, didn't look good enough at the method signature...
Reflection of an AT would be a straightforward, but not that clean solution.
Unless Forge would add a default AT for making that method public.
Alternatively, you could call harvestBlock
with a fake player holding a dummy stack that has the silk touch enchantment. The only problem is that this drops the item entity in the world, so you'd have to somehow detect and grab this...