Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Update to P2 extended heights (#1581)
Dieser Commit ist enthalten in:
Ursprung
3ee9797408
Commit
f59353006a
@ -19,7 +19,7 @@ mcore = "7.0.1"
|
||||
residence = "4.5._13.1"
|
||||
towny = "0.97.5.0"
|
||||
protocollib = "4.7.0"
|
||||
plotsquared = "6.5.1"
|
||||
plotsquared = "6.6.0"
|
||||
redprotect = "1.9.6"
|
||||
|
||||
# Third party
|
||||
|
@ -117,29 +117,34 @@ public class FaweDelegateRegionManager {
|
||||
final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern();
|
||||
final BiomeType biome = hybridPlotWorld.getPlotBiome();
|
||||
|
||||
BlockVector3 pos1 = plot.getBottomAbs().getBlockVector3().withY(0);
|
||||
BlockVector3 pos1 = plot.getBottomAbs().getBlockVector3();
|
||||
BlockVector3 pos2 = pos1.add(BlockVector3.at(
|
||||
hybridPlotWorld.PLOT_WIDTH - 1,
|
||||
255,
|
||||
hybridPlotWorld.getMaxGenHeight(),
|
||||
hybridPlotWorld.PLOT_WIDTH - 1
|
||||
));
|
||||
|
||||
Region bedrockRegion = new CuboidRegion(pos1, pos2.withY(0));
|
||||
Region fillingRegion = new CuboidRegion(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1));
|
||||
if (hybridPlotWorld.PLOT_BEDROCK) {
|
||||
Region bedrockRegion = new CuboidRegion(pos1, pos2.withY(hybridPlotWorld.getMinGenHeight()));
|
||||
editSession.setBlocks(bedrockRegion, bedrock);
|
||||
}
|
||||
|
||||
Region fillingRegion = new CuboidRegion(
|
||||
pos1.withY(hybridPlotWorld.getMinGenHeight() + 1),
|
||||
pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1)
|
||||
);
|
||||
Region floorRegion = new CuboidRegion(
|
||||
pos1.withY(hybridPlotWorld.PLOT_HEIGHT),
|
||||
pos2.withY(hybridPlotWorld.PLOT_HEIGHT)
|
||||
);
|
||||
Region airRegion = new CuboidRegion(
|
||||
pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
|
||||
pos2.withY(manager.getWorldHeight())
|
||||
pos2.withY(hybridPlotWorld.getMaxGenHeight())
|
||||
);
|
||||
|
||||
editSession.setBlocks(bedrockRegion, bedrock);
|
||||
editSession.setBlocks(fillingRegion, filling);
|
||||
editSession.setBlocks(floorRegion, plotfloor);
|
||||
editSession.setBlocks(airRegion, air);
|
||||
editSession.flushQueue();
|
||||
}
|
||||
|
||||
if (hybridPlotWorld.PLOT_SCHEMATIC) {
|
||||
@ -157,7 +162,7 @@ public class FaweDelegateRegionManager {
|
||||
}
|
||||
BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(Settings.Schematics.PASTE_ON_TOP
|
||||
? hybridPlotWorld.SCHEM_Y
|
||||
: 1);
|
||||
: hybridPlotWorld.getMinBuildHeight());
|
||||
try {
|
||||
Clipboard clip = ClipboardFormats
|
||||
.findByFile(schematicFile)
|
||||
@ -171,7 +176,6 @@ public class FaweDelegateRegionManager {
|
||||
scheditsession.flushQueue();
|
||||
}
|
||||
|
||||
// Be verbose in editsession flushing
|
||||
editSession.flushQueue();
|
||||
FaweAPI.fixLighting(
|
||||
world,
|
||||
@ -210,13 +214,12 @@ public class FaweDelegateRegionManager {
|
||||
.limitUnlimited()
|
||||
.changeSetNull()
|
||||
.build();
|
||||
CuboidRegion regionA = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
||||
CuboidRegion regionA = new CuboidRegion(pos1World, pos1.getBlockVector3(), pos2.getBlockVector3());
|
||||
CuboidRegion regionB = new CuboidRegion(
|
||||
pos3World,
|
||||
swapPos.getBlockVector3(),
|
||||
swapPos.getBlockVector3().add(pos2.getBlockVector3()).subtract(pos1.getBlockVector3())
|
||||
);
|
||||
regionA.setWorld(pos1World);
|
||||
regionB.setWorld(pos3World);
|
||||
Clipboard clipA = Clipboard.create(regionA, UUID.randomUUID());
|
||||
Clipboard clipB = Clipboard.create(regionB, UUID.randomUUID());
|
||||
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, clipA, clipA.getMinimumPoint());
|
||||
@ -230,10 +233,11 @@ public class FaweDelegateRegionManager {
|
||||
clipB.flush();
|
||||
clipA.paste(sessionB, swapPos.getBlockVector3(), true, true, true);
|
||||
clipB.paste(sessionA, pos1.getBlockVector3(), true, true, true);
|
||||
sessionA.close();
|
||||
sessionB.close();
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
sessionA.close();
|
||||
sessionB.close();
|
||||
}
|
||||
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()), null,
|
||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
|
||||
|
@ -9,7 +9,10 @@ import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag;
|
||||
import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag;
|
||||
import com.fastasyncworldedit.core.util.IOUtil;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.generator.ClassicPlotWorld;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.schematic.Schematic;
|
||||
@ -57,6 +60,7 @@ public class FaweDelegateSchematicHandler {
|
||||
|
||||
private static final AtomicBoolean exportingAll = new AtomicBoolean();
|
||||
|
||||
@Deprecated
|
||||
public void paste(
|
||||
final Schematic schematic,
|
||||
final Plot plot,
|
||||
@ -65,6 +69,19 @@ public class FaweDelegateSchematicHandler {
|
||||
final int zOffset,
|
||||
final boolean autoHeight,
|
||||
final RunnableVal<Boolean> whenDone
|
||||
) {
|
||||
paste(schematic, plot , xOffset, yOffset, zOffset, autoHeight, null, whenDone);
|
||||
}
|
||||
|
||||
public void paste(
|
||||
final Schematic schematic,
|
||||
final Plot plot,
|
||||
final int xOffset,
|
||||
final int yOffset,
|
||||
final int zOffset,
|
||||
final boolean autoHeight,
|
||||
final PlotPlayer<?> actor,
|
||||
final RunnableVal<Boolean> whenDone
|
||||
) {
|
||||
Runnable r = () -> {
|
||||
if (whenDone != null) {
|
||||
@ -80,8 +97,20 @@ public class FaweDelegateSchematicHandler {
|
||||
final int WIDTH = dimension.getX();
|
||||
final int LENGTH = dimension.getZ();
|
||||
final int HEIGHT = dimension.getY();
|
||||
final int worldHeight = plot.getArea().getMaxGenHeight() - plot.getArea().getMinGenHeight() + 1;
|
||||
// Validate dimensions
|
||||
CuboidRegion region = plot.getLargestRegion();
|
||||
boolean sizeMismatch =
|
||||
((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
> worldHeight);
|
||||
if (!Settings.Schematics.PASTE_MISMATCHES && sizeMismatch) {
|
||||
if (actor != null) {
|
||||
actor.sendMessage(TranslatableCaption.of("schematics.schematic_size_mismatch"));
|
||||
}
|
||||
TaskManager.runTask(whenDone);
|
||||
return;
|
||||
}
|
||||
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
> 256)) {
|
||||
@ -90,28 +119,6 @@ public class FaweDelegateSchematicHandler {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Calculate the optimal height to paste the schematic at
|
||||
final int y_offset_actual;
|
||||
if (autoHeight) {
|
||||
if (HEIGHT >= 256) {
|
||||
y_offset_actual = yOffset;
|
||||
} else {
|
||||
PlotArea pw = plot.getArea();
|
||||
if (pw instanceof ClassicPlotWorld) {
|
||||
y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||
} else {
|
||||
y_offset_actual = yOffset + 1 + PlotSquared.platform().worldUtil()
|
||||
.getHighestBlockSynchronous(plot.getWorldName(), region.getMinimumPoint().getX() + 1,
|
||||
region.getMinimumPoint().getZ() + 1
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
y_offset_actual = yOffset;
|
||||
}
|
||||
|
||||
final BlockVector3 to = BlockVector3
|
||||
.at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
|
||||
|
||||
try (EditSession editSession = WorldEdit
|
||||
.getInstance()
|
||||
@ -122,13 +129,33 @@ public class FaweDelegateSchematicHandler {
|
||||
.limitUnlimited()
|
||||
.changeSetNull()
|
||||
.build()) {
|
||||
// Calculate the optimal height to paste the schematic at
|
||||
final int y_offset_actual;
|
||||
if (autoHeight) {
|
||||
if (HEIGHT >= worldHeight) {
|
||||
y_offset_actual = yOffset;
|
||||
} else {
|
||||
PlotArea pw = plot.getArea();
|
||||
if (pw instanceof ClassicPlotWorld) {
|
||||
y_offset_actual = yOffset + pw.getMinBuildHeight() + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||
} else {
|
||||
y_offset_actual = yOffset + pw.getMinBuildHeight() + editSession.getHighestTerrainBlock(region
|
||||
.getMinimumPoint()
|
||||
.getX() + 1, region.getMinimumPoint().getZ() + 1, pw.getMinGenHeight(), pw.getMaxGenHeight()
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
y_offset_actual = yOffset;
|
||||
}
|
||||
|
||||
final BlockVector3 to = BlockVector3
|
||||
.at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
|
||||
final Clipboard clipboard = schematic.getClipboard();
|
||||
clipboard.paste(editSession, to, true, false, true);
|
||||
if (whenDone != null) {
|
||||
whenDone.value = true;
|
||||
if (whenDone != null) {
|
||||
TaskManager.runTask(whenDone);
|
||||
}
|
||||
TaskManager.runTask(whenDone);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -73,7 +73,7 @@ public class FaweQueueCoordinator extends QueueCoordinator {
|
||||
@Override
|
||||
public boolean setBiome(int x, int z, BiomeType biomeType) {
|
||||
setbiome = true;
|
||||
return instance.setBiome(x, 0, z, biomeType);
|
||||
return instance.setBiome(BlockVector2.at(x, z), biomeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,8 +158,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
|
||||
Region maskedRegion;
|
||||
if (regions.size() == 1) {
|
||||
int min = area != null ? area.getMinBuildHeight() : 0;
|
||||
int max = area != null ? Math.min(255, area.getMaxBuildHeight()) : 255;
|
||||
int min = area != null ? area.getMinBuildHeight() : player.getWorld().getMinY();
|
||||
int max = area != null ? Math.min(player.getWorld().getMaxY(), area.getMaxBuildHeight()) : player.getWorld().getMaxY();
|
||||
|
||||
final CuboidRegion region = regions.iterator().next();
|
||||
final BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren