From 10a6619853de61d4433ef43cdf23a417e1b55268 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 10 Nov 2019 22:20:46 +0000 Subject: [PATCH] Update to latest P2 --- buildSrc/src/main/kotlin/CommonConfig.kt | 2 +- worldedit-core/build.gradle.kts | 2 +- .../brush/visualization/cfi/MCAWriter.java | 10 ++++-- .../plotquared/FaweLocalBlockQueue.java | 33 +++++++------------ .../integrations/plotquared/PlotSetBiome.java | 3 +- 5 files changed, 23 insertions(+), 27 deletions(-) diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index eede45e43..a3b1bb38d 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -8,7 +8,7 @@ fun Project.applyCommonConfiguration() { repositories { mavenCentral() mavenLocal() - maven { url = uri("http://ci.athion.net/job/PlotSquared-we/ws/mvn/") } + maven { url = uri("http://ci.athion.net/job/PlotSquared-breaking/ws/mvn/") } maven { url = uri("https://maven.sk89q.com/repo/") } maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } maven { url = uri("http://empcraft.com/maven2") } diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index a4d23ef91..c9f525ffb 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } repositories { - maven { url = uri("http://ci.athion.net/job/PlotSquared-we/ws/mvn/") } + maven { url = uri("http://ci.athion.net/job/PlotSquared-breaking/ws/mvn/") } } applyPlatformAndCoreConfiguration() diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/MCAWriter.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/MCAWriter.java index 2a8a8b63f..3d952538a 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/MCAWriter.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/MCAWriter.java @@ -6,6 +6,7 @@ import com.boydti.fawe.object.io.BufferedRandomAccessFile; import com.boydti.fawe.util.MainUtil; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.block.BlockID; +import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -138,11 +139,14 @@ public abstract class MCAWriter implements Extent { chunk.setPosition(fcx + (getOffsetX() >> 4), fcz + (getOffsetZ() >> 4)); // Compress - byte[] bytes = chunk.toBytes(byteStore1.get()); - byte[] compressedBytes = MainUtil.compress(bytes, byteStore2.get(), deflateStore.get()); + FastByteArrayOutputStream uncompressed = chunk.toBytes(byteStore1.get()); + int len = uncompressed.length; + uncompressed.reset(); + MainUtil.compress(uncompressed.array, len , byteStore2.get(), uncompressed, deflateStore.get()); + byte[] clone = Arrays.copyOf(uncompressed.array, uncompressed.length); // TODO optimize (avoid cloning) by add a synchronized block and write to the RAF here instead of below - compressed[((fcx & 31)) + ((fcz & 31) << 5)] = compressedBytes.clone(); + compressed[((fcx & 31)) + ((fcz & 31) << 5)] = clone; } } catch (Throwable e) { e.printStackTrace(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java index 47b875f67..f64e2b7f6 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/FaweLocalBlockQueue.java @@ -4,20 +4,16 @@ import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IQueueExtent; -import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.registry.BiomeRegistry; import com.sk89q.worldedit.world.registry.LegacyMapper; -import java.util.Collection; // TODO FIXME public class FaweLocalBlockQueue extends LocalBlockQueue { @@ -25,6 +21,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue { public final IQueueExtent IMP; private final LegacyMapper legacyMapper; private final World world; + private BlockVector3 mutable = new MutableBlockVector3(); public FaweLocalBlockQueue(String worldName) { super(worldName); @@ -74,6 +71,12 @@ public class FaweLocalBlockQueue extends LocalBlockQueue { return IMP.setBlock(x, y, z, id); } + @Override + public boolean setBlock(int x, int y, int z, Pattern pattern) { + mutable.setComponents(x, y, z); + return pattern.apply(IMP, mutable, mutable); + } + @Override public boolean setBlock(final int x, final int y, final int z, final BaseBlock id) { return IMP.setBlock(x, y, z, id); @@ -84,21 +87,9 @@ public class FaweLocalBlockQueue extends LocalBlockQueue { return IMP.getBlock(x, y, z); } - private BiomeType biome; - private String lastBiome; - private BiomeRegistry reg; - @Override - public boolean setBiome(int x, int z, String biome) { - if (!StringMan.isEqual(biome, lastBiome)) { - if (reg == null) { - reg = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.USER_COMMANDS).getRegistries().getBiomeRegistry(); - } - Collection biomes = BiomeTypes.values(); - lastBiome = biome; - this.biome = Biomes.findBiomeByName(biomes, biome, reg); - } - return IMP.setBiome(x, 0, z, this.biome); + public boolean setBiome(int x, int z, BiomeType biomeType) { + return IMP.setBiome(x, 0, z, biomeType); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSetBiome.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSetBiome.java index 0993064e5..20d7023c0 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSetBiome.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSetBiome.java @@ -59,7 +59,8 @@ public class PlotSetBiome extends Command { Collection knownBiomes = BiomeTypes.values(); final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry); if (biome == null) { - String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATOR.toString()); + String biomes = StringMan + .join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated()); Captions.NEED_BIOME.send(player); MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.toString() + biomes); return CompletableFuture.completedFuture(false);