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