Slimefun4
Slimefun4 copied to clipboard
exploded sf blocks now drop their sf item
Description
Slimefun blocks didn't drop when exploded because the drops argument in BlockBreakHandler::onExplode did nothing.
Proposed changes
~~Pass the SlimefunItem to the handleEplosion method in ExplosionsListener.java and drop the item there.~~
~~Other changes:~~ ~~Removed unused import.~~
~~I didn't change the method signature for BlockBreakHandler::onExplode since it's a public method and that seemed like a bad idea to change.~~
EDIT: Changed approach completely. Now added drops logic to SimpleBlockBreakHandler::onExplode.
Related Issues (if applicable)
Resolves #3601 Also resolves Slimefun blocks not dropping from explosions, but somehow there was no issue open
Checklist
- [x] I have fully tested the proposed changes and promise that they will not break everything into chaos.
- [ ] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
- [x] I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
- [x] I followed the existing code standards and didn't mess up the formatting.
- [x] I did my best to add documentation to any public classes or methods I added.
- [x] I have added
NonnullandNullableannotations to my methods to indicate their behaviour for null values - [ ] I added sufficient Unit Tests to cover my code.
Your Pull Request was automatically labelled as: "✨ Fix" Thank you for contributing to this project! ❤️
Slimefun preview build
A Slimefun preview build is available for testing! Commit: a18957ab
https://preview-builds.walshy.dev/download/Slimefun/3929/a18957ab
Note: This is not a supported build and is only here for the purposes of testing. Do not run this on a live server and do not report bugs anywhere but this PR!
i built a wall of 5x5 slimefun items. I hit the center with the upgraded explosive pickaxe from fluffy machines and only the center block dropped. however using the core slimefun explosive pickaxe (3x3) everything dropped as expected and stayed slimefun items. creeper explosions and tnt did not drop any slimefun blocks, nor were the blocks damaged. that doesn't seem like that should be the case. if a vanilla block explodes, so should the slimefun block
I just tested this again, and for me the blocks were broken and dropped for the explosive pickaxe, tnt and creepers. The Fluffy explosive pickaxe code says it shouldn't remove Slimefun blocks, so I guess that's working as intended.
SlimefunItem sfItem = BlockStorage.check(b);
// Don't break SF blocks
if (sfItem != null) {
return;
}
in doing additional testing, some slimefun items broke, where others do not. core slimefun that broke were regulators and cargo and core machines. addon blocks that i tested didnt break. so far i can't get any addon blocks to drop.
The way it's implemented now allows devs to choose what behaviour they want. This pr changes SimpleBlockBreakHandler which is used by core sf. If we wanted the blocks to drop regardless of how BlockBreakHandler::onExplode is implemented we could drop the blocks in the ExplosionsListener instead.
whichever way the team wants to go. just providing testing results. thanks itwins
And thank you a lot for testing 😁 !!
it doesnt seem to work for me. However i think this pr handles it already https://github.com/Slimefun/Slimefun4/pull/4062 alessio just needs to adress those comments if thats merged we need to rebase this pr and see if its even still needed and/or if it fixes it