-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
[Feature] Use Structure Void instead of Air #82
base: main
Are you sure you want to change the base?
[Feature] Use Structure Void instead of Air #82
Conversation
Working on testing this as we speak 👍 |
Will review this later but for some reason we decided not to use structure void blocks. I don’t know the reason for it anymore |
I don’t think we decided to not use them but instead were informed of their usefulness too late into proceedings, possibly even after go live. Either way I’m all for this and the other PR and will review later today. |
@@ -112,6 +112,7 @@ private void unsafelyKillItem(@Nonnull Location location, @Nullable SlimefunItem | |||
location.getWorld().dropItem(location, bush.getItem().clone()); | |||
bush.removeBushDisplayGroup(location); | |||
BlockStorage.clearBlockInfo(location); | |||
location.getBlock().setType(Material.AIR); | |||
} |
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.
I've found bushes have similar issues as plants in regards to the unsafelyKillItem
method. To fix this, I've added:
} else if (slimefunItem instanceof CultivationBush bush) {
location.getWorld().dropItem(location, bush.getItem().clone());
bush.removeBushDisplayGroup(location);
BlockStorage.clearBlockInfo(location);
location.getBlock().setType(Material.AIR);
}
Like most things, I'm not 100% this is efficient, but it's been working for us for a while
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.
?
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.
Ignore me, its been a long day :D I was thinking of something else that's not in scope here, apologies!
For reference I was thinking about
Cultivation/src/main/java/dev/sefiraat/cultivation/api/slimefun/items/plants/CultivationPlant.java
Line 155 in b1dfa47
public void onBreak(@NotNull BlockBreakEvent event) { |
event.getBlock().setType(Material.AIR);
to stop a dupe
This PR simply sets the block to be a structure void instead of air when the plants or bushes grow. The reason for this is to allow other plugins such as SlimeHUD to properly recognize the plant. It also helps prevent interactions that may other wise break the plant such as piston pushes. (The point of leaving the listeners for that in is that any old plants won't be structure void)
I've also added a line to set the block to air in the case of killing a bush, as now if its not air it will be a structure void instead. Unless there is a specific reason it doesn't do this already I think this is meant to be here.