Slimefun4 icon indicating copy to clipboard operation
Slimefun4 copied to clipboard

Fix disappearing sensitive blocks on slimefun blocks

Open EpicPlayerA10 opened this issue 4 years ago • 9 comments

Description

Fix disappearing sensitive blocks on slimefun blocks

Proposed changes

BlockListener#dropItems calls e.setDropItems(false) which also cancels drops from sensitive block above. I added to BlockListener#checkForSensitiveBlockAbove check for non-slimefun sensitive blocks. I also added some other sensitive materials to sensitive_materials.json.

Related Issues (if applicable)

Resolves #3182

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 followed the existing code standards and didn't mess up the formatting.
  • [ ] I did my best to add documentation to any public classes or methods I added.
  • [ ] I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • [ ] I added sufficient Unit Tests to cover my code.

EpicPlayerA10 avatar Jul 29 '21 12:07 EpicPlayerA10

Closing this PR for now. We need to find a better solution for this bug.

EpicPlayerA10 avatar Oct 12 '22 13:10 EpicPlayerA10

I do think this would be a good fix even if its a temporarily fix since it now breaks some things in core sf and the addons.

J3fftw1 avatar Oct 12 '22 15:10 J3fftw1

But there is also a bug where blocks that are attached on the side of slimefun block e.g. banner won't drop. This fix will be harder to implement.

EpicPlayerA10 avatar Oct 12 '22 16:10 EpicPlayerA10

Yea fair their will always be edge cases and will always be pain to update. But i think the changes you made should still be applied

J3fftw1 avatar Oct 12 '22 16:10 J3fftw1

Ah, you convinced me

EpicPlayerA10 avatar Oct 12 '22 16:10 EpicPlayerA10

Since you reopened it, it would be nice to support 1.19 blocks aswell.

J3fftw1 avatar Oct 12 '22 16:10 J3fftw1

and maybe we need to think of a way to support wall blocks like banners torches paintings etc, not sure if they even bug if you place them on it. needs testing

J3fftw1 avatar Oct 12 '22 16:10 J3fftw1

There is a cool method in bukkit Block#canPlace but it has been added since 1.18

EpicPlayerA10 avatar Oct 12 '22 16:10 EpicPlayerA10

But there is also a bug where blocks that are attached on the side of slimefun block e.g. banner won't drop. This fix will be harder to implement.

Mmh my message apparently didnt send yesterday. We should probably look in a way to just send physics updates to blocks around it. Not sure if thats have at all since we need all sides of the block being updated.

Edit; from quickly glancing over the code it seems like we dont send physics update. Im also not sure how heavy that is to send to 6 blocks each time a slimefun blocm is broken. It might be good to check that out then we wont even need to update #sentive-materials

J3fftw1 avatar Oct 13 '22 04:10 J3fftw1