Structure - add placement options
Redo of https://github.com/PaperMC/Paper/pull/12398
This PR originally aimed to add an option to place structures without doing block updates.
This was something Minecraft added in 1.21.5 to Structure Blocks as well as the /place template command.
After a great suggestion from Kashike, this PR changed to add a new PlacementOptions class. This will allow for deciding which options you want to add, or fallback to defaults. This will also be great in the future if Mojang adds more options for placement, won't need to create more methods in the structure class.
While I understand the team is not wanting PRs for 1.21.5 yet, I just wanted to get this done as early as possible. I'm ok with the PR sitting here til the team accepts 1.21.5 PRs.
This feature (the earlier mentioned strict option) has been requested by users of my plugin for over a year now, so Im super excited to have this. I did test with my plugin locally and it works like a charm :)
Side note (re: Strict placement): I did a test on 1.21.4 for this, it technically works as well, but only like 50/50. For example:
- Fences didn't connect as expected (yay)
- Water still flowed (boo)
- I didn't test other blocks but it felt a bit unstable, so I didn't want to do the PR for 1.21.4 due to instability.
Closes #12381
Maybe also on the names, but I don't think we have proper guidelines for that. Stuff like isIncludeEntities is a bit off, I think we usually do shouldIncludeEntities or includesEntities... or just includeEntities if it's clear it's a getter, this needs more input
Maybe also on the names, but I don't think we have proper guidelines for that. Stuff like
isIncludeEntitiesis a bit off, I think we usually doshouldIncludeEntitiesorincludesEntities... or justincludeEntitiesif it's clear it's a getter, this needs more input
You’re totally right here. IntelliJ suggested these when I wrote it, and I wasn't too sure about it, but after you said that, it makes sense to remove "is"
@notTamion when you have a chance could you please re-review this. Would love to get this out of "changes requested" Thank you 😊
Would love to get this into a plugin soon.
Just a general thought It would be more consistent to make the PlacementOptions class an interface That way the random instance doesn't have to be passed or exposed and could be moved to the internals unless that is intentionally expised
Hi, I don't know if this is still being worked on or not, but I would still love to see this added, as I'm at a really big roadblock in my soon-to-be-public server, because I am not able to (as far as I'm aware) use strict placement to paste my custom structure files. This is a really big issue for me. I hope this gets approved soon.
I would also very much like this for my server, would optimize things a ton
I am still waiting for this :)