IntellectualSites / PlotSquared

PlotSquared - Reinventing the plotworld
GNU General Public License v3.0
547 stars 752 forks source link

Freshly create plot schematic is regenerated (cleared) one block too low #4404

Open PierreSchwang opened 6 months ago

PierreSchwang commented 6 months ago

Server Implementation

Paper

Server Version

1.20.4

Describe the bug

When clearing a plot in an area utilizing plot schematics, the schematic will be pasted one block too low. World-Generation itself works (e.g. //regen works).

The culprit seems to be somewhere here (used by the FAWE Delegate to determine minY for plot schematics): https://github.com/IntellectualSites/PlotSquared/blob/a6412581a6bef54b816c078c690e6815495377dd/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java#L558-L560

When replacing SCHEM_Y + plotY with getMinBuildHeight() (the same reference point the world generator uses, as visible in HybridGen: https://github.com/IntellectualSites/PlotSquared/blob/main/Core/src/main/java/com/plotsquared/core/generator/HybridGen.java#L76) clear works. My only idea for that being is, that one of these two variables is normalized somewhere - possibly against the road height. I don't just want to PR my fix, as I'm not sure what the reasoning behind the change was (@dordsor21 ?) and if that does not have any unexpected side effects.

To Reproduce

  1. Create plot schematic as described in wiki (/plot schematic save, move to appropriate schematic folder)
  2. World will be generated accordingly
  3. Claim Plot and run /plot clear
  4. Schematic will be one block too low

Expected behaviour

The schematic should be pasted from the correct y-level

Screenshots / Videos

No response

Error log (if applicable)

No response

Fawe Debugpaste

-

Fawe Version

-

Checklist

Anything else?

No response

RedstoneFuture commented 5 days ago

I can replicate this.

grafik

schematics:
  # Whether schematic based generation should paste schematic on top of plots, or from Y=1
  paste-on-top: true
  # Whether schematic based road generation should paste schematic on top of roads, or from Y=1
  paste-road-on-top: true
  # If schematics that do not match a plot's size should be pasted anyway
  #  - This will still only paste a schematic with a plot's bounds.
  #  - If a schematic is too big, it will cut off, and if too small, will not full the plot.
  paste-mismatches: true
  # If the wall height should be taken into account when calculating the road schematic paste height
  #  - If true, will use the lower of wall and road height.
  #  - If true, will ensure correct schematic behaviour (no parts are cut off).
  #  - Set to false if you experience the road being set one block too low
  #    (only for road schematics created pre 6.1.4).
  use-wall-in-road-schem-height: true
RedstoneFuture commented 5 days ago

@dordsor21 Are you involved in the logic of the paste algorithm?

The fix looks simple, but I don't want to just increment any value. ^^