Roots

Roots

24M Downloads

Soft touch ignored metadata and other values when casting

Prunoideae opened this issue ยท 3 comments

commented

General Information

Describe the bug:
You used IBlockState.getBlock to create a silktouched drop which will make the meta and tags lost because they are not handled. In certain circumstances this will cause wrong drops.

caster.world.spawnEntity(new EntityItem(caster.world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(state.getBlock())));

To Reproduce:

  1. Apply softtouch spell on any block that requires silk touch and have a meta greater than 0
  2. A 0 meta block with same registry name will be dropped.

Expected behavior:
Drop block as player harvested with silk touch.


Environment Versions

  • Windows 10 build 19041.84

Mystic Mods Versions

  • MysticalLib: 1.1.1
  • MysticalWorld: 1.7.1
  • Roots: 3.1.0
    I cloned the repository and have the code compiled so the version number is odd, but the code reference obviously shows that this is a bug.

Other Versions:

  • Minecraft : 1.12.2
  • Forge : 14.23.5.2847

Additional context (optional):
My solution is to simulate how the block is broken by player with a virtual tool given silk touch generated by code:
image

Though it's limited by the tool class of pickaxe, I think it's just enough, for an instant break with obsidian level and silk touch enchantment.
Sorry for I'm not creating an pull request for this, since the modification is much more than this line of code for integration and expanding the line, I used the modified version of Roots just for my own private fun.

commented

Also, there's a bug in the check of herbs of Components Pouch:

// I feel like this is faster than streams
return HERB_ITEMS.contains(item);

In game it proofs that using contains will NOT properly check if the Item is a registered herb, it may be some tricky game mechanism or else, which made this not working.
Replacing this with the old code made the bug solved.

commented

Thanks for the heads-up! I'll look into it.

EDIT: For context, this is an older spell that got merged. It will actually be changed and potentially removed as I'm planning on updating the modifiers system to allow you to apply Silk Touch to the shatter spell, which will take its place.

commented

This is going to be merged into Shatter with the Dewgonia modifier.