Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JustAHuman-xD
Copy link
Contributor

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.

@JustAHuman-xD
Copy link
Contributor Author

Working on testing this as we speak 👍

@JustAHuman-xD
Copy link
Contributor Author

Water not being a problem:
2024-03-04_19 08 13
Piston Behavior:
2024-03-04_19 08 27
SlimeHUD installed:
2024-03-04_19 09 58
Can still pass through:
2024-03-04_19 11 14

Other testing:
Both bushes and plants that do not have a structure void work as intended.
Structure void is removed properly when breaking and appears properly when placing.

Is there anything left I should test?

@J3fftw1
Copy link
Collaborator

J3fftw1 commented Mar 5, 2024

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

@Sefiraat
Copy link
Owner

Sefiraat commented Mar 5, 2024

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);
}
Copy link
Contributor

@Bunnky Bunnky Mar 22, 2024

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor

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

where I added event.getBlock().setType(Material.AIR); to stop a dupe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants