-
Notifications
You must be signed in to change notification settings - Fork 569
Fix ghost BlockStorage blocks due to iron golems, snow golems and wither spawning #3796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Just a note, I haven't completed a full test with Slimefun/addons however I've manually tested the core logic of parsing the removed blocks (So A final note on possible improvements: this fix could be made significantly easier if a PR to spigot was made to add a new event which extends |
That's awesome! Does this also prevent the blocks from being removed or will it just cancel the mob spawning? |
The current implementation just cancels the mob spawning as I'm not sure how to deal with whether or not the |
I meaan the physical blocks, not the block storage data. |
src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java
Outdated
Show resolved
Hide resolved
...o/github/thebusybiscuit/slimefun4/implementation/listeners/entity/CreatureBuildListener.java
Outdated
Show resolved
Hide resolved
...o/github/thebusybiscuit/slimefun4/implementation/listeners/entity/CreatureBuildListener.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TShapedBlockPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TShapedBlockPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/WitherBuildPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/WitherBuildPattern.java
Outdated
Show resolved
Hide resolved
This will leave the structure behind, no physical blocks will be removed. |
Perfect! That's what I wanted to know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also don't forget to mark params are nonnull and add Validate checks
...o/github/thebusybiscuit/slimefun4/implementation/listeners/entity/CreatureBuildListener.java
Show resolved
Hide resolved
I added the class-level annotation |
...o/github/thebusybiscuit/slimefun4/implementation/listeners/entity/CreatureBuildListener.java
Outdated
Show resolved
Hide resolved
...o/github/thebusybiscuit/slimefun4/implementation/listeners/entity/CreatureBuildListener.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TShapedBlockPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TShapedBlockPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TShapedBlockPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/WitherBuildPattern.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/WitherBuildPattern.java
Outdated
Show resolved
Hide resolved
...a/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCreatureBuildListener.java
Outdated
Show resolved
Hide resolved
...test/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TestTShapedBlockPattern.java
Outdated
Show resolved
Hide resolved
src/test/java/io/github/thebusybiscuit/slimefun4/utils/blockpattern/TestWitherBuildPattern.java
Outdated
Show resolved
Hide resolved
Marking this as stale. |
Totally forgot about this, will push some changes in the next few days |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/3796/26e448c9
|
I'm gonna leave a comment here before I push the commit which changes Validate for Preconditions. I can see Validate being used in other SF classes (ex: |
We do, validate only runs on tests as we have found, there's an open issue about it iirc, new code uses preconditions until a better thing is created in dough |
can we also unmark this as stale? |
Just tested this on 1.20.1, there a few things that I found:
Video: https://youtu.be/qaD1JPAZJqI P.S. Here is a little addon to add snow block, soul sand, and soul soil for spawning those mob. (Use it on your own risk) P.S.S. If you need me to test the build, feel free to ping me on Discord or Github and flag the PR "Needs Testing", I will look into it later! |
the edge cases you have found seem to be edge cases where spigot doesnt even check for. |
does paper check for these? |
interesting, i'm very surprised it is not working as expected, let me have another crack |
dont know dont think they do var most likely tested on paper |
Yeah I exclusively tested everything on paper these days |
…ocks are tracked by blockstorage fixes 2425
…n/listeners/TestCreatureBuildListener.java Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com>
…n/listeners/entity/CreatureBuildListener.java Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com>
…n/listeners/entity/CreatureBuildListener.java Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com>
…ttern/TShapedBlockPattern.java Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com>
…ttern/TestTShapedBlockPattern.java Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com>
…ttern/TestWitherBuildPattern.java Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com>
…factor the CreatureBuildListener to check for inverted cases
d080cec
to
1eb1721
Compare
…Fix TShapedBlockPattern#getMatchingBlocks not testing inverted cases
…o fix incorrect construction of inverted withers
Ready for another round of testing. Fixes the issues with inverted orientations and the use of soul sand. Also added more unit tests for the new cases. |
Description
Fix ghost
BlockStorage
blocks due to players building/spawning iron golems, snow golems, and withers.\Fixes 2425 (tagged below)
Proposed changes
Adds a new listener (
CreatureBuildListener
) which cancelsCreatureSpawnEvents
if one of the blocks used to buildeither an iron golem, snow golem (
EntityType#SNOWMAN
), or wither is tracked byBlockStorage
(BlockStorage#hasInfo == true
)Related Issues (if applicable)
Resolves #2425
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values