grondag / facility

GNU Lesser General Public License v3.0
1 stars 1 forks source link

Crates do not drop when broken with an axe enchanted with Timber from More Enchantments #15

Closed bluebear94 closed 4 years ago

bluebear94 commented 4 years ago

When broken with an axe enchanted with Timber from More Enchantments, Facility crates drop nothing.

To reproduce:

Give yourself an axe, /enchant @s biom4st3rmoenchantments:tree_feller 3, place down some crates, break one of them with the axe in survival mode.

Expected: Crates drop as if broken with literally anything else. Actual: Nothing drops at all.

grondag commented 4 years ago

Thank you for reporting. I took a quick look at what More Enchantments is doing and it isn't immediately obvious where the problem is. Will look at this soon.

grondag commented 4 years ago

Issue here is that More Enchantments does not check if the block has a BlockEntity and circumvents the call to Block.onBreak.

It does call Block.dropStacks but always passes null as the BlockEntity, meaning the crate will have no way to discover content.

It does this for any block with a WOOD material and there does not seem to be any sort of white/black list for axe blocks.

https://gitlab.com/biom4st3r/moenchantments/-/blob/default/src/main/java/com/biom4st3r/moenchantments/Logic/VeinMinerLogic.java#L103

This could be fixed in More Enchantments but seems like a mistake that will likely happen again, so I am changing the material of crates to something other than wood. I've also added check to dropStacks that will crash if BlockEntity is null - to prevent loss of storage. (Won't work with NEC installed, but at least it will be captured in the log.)