From c98a31114681caf8c38eae64e112dcee7e512831 Mon Sep 17 00:00:00 2001 From: IronApollo Date: Wed, 6 Mar 2019 03:06:47 -0500 Subject: [PATCH] Update to working PlotSquared repo; Update to PlotSquared C>Captions class rename; Cleaning and minor modifications to SpongeSchematicReader --- build.gradle | 2 - worldedit-bukkit/build.gradle | 5 +- worldedit-core/build.gradle | 6 +- .../com/boydti/fawe/command/CFICommands.java | 4 +- .../regions/general/plot/CFIRedirect.java | 10 +- .../fawe/regions/general/plot/FaweTrim.java | 4 +- .../fawe/regions/general/plot/MoveTo512.java | 2 +- .../regions/general/plot/PlotSetBiome.java | 18 +- .../fawe/regions/general/plot/ReplaceAll.java | 12 +- .../clipboard/io/SpongeSchematicReader.java | 232 +----------------- 10 files changed, 30 insertions(+), 265 deletions(-) diff --git a/build.gradle b/build.gradle index a2dab283d..a71802690 100644 --- a/build.gradle +++ b/build.gradle @@ -79,11 +79,9 @@ subprojects { maven { url "http://maven.sk89q.com/repo/" } maven { url "http://repo.maven.apache.org/maven2" } // Fawe - maven {url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/"} maven {url "https://mvnrepository.com/artifact/"} maven {url "http://repo.dmulloy2.net/content/groups/public/"} maven {url "https://repo.destroystokyo.com/repository/maven-public//"} - maven {url "http://ci.athion.net/job/PlotSquared/ws/mvn/"} mavenLocal() maven {url "http://empcraft.com/maven2"} maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"} diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 87c28ceb9..6bf506475 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -4,7 +4,6 @@ apply plugin: 'maven' repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } - maven { url "https://ci.athion.net/job/FAWE-WorldGuard-1.13/lastSuccessfulBuild/artifact/mvn" } } dependencies { @@ -27,8 +26,8 @@ dependencies { compile 'com.thevoxelbox.voxelsniper:voxelsniper:5.171.0' compile 'com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT' compile 'com.wasteofplastic:askyblock:3.0.8.2' - compile 'com.sk89q:worldguard-core:latest' - compile 'com.sk89q:worldguard-legacy:latest' + compileOnly 'com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39' + compileOnly 'com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39' } processResources { diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index a9ab23076..89a595b92 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'eclipse' apply plugin: 'idea' repositories { - maven {url "http://ci.athion.net/job/PlotSquared/ws/mvn/"} + maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"} } dependencies { compile 'de.schlichtherle:truezip:6.8.3' @@ -13,16 +13,14 @@ dependencies { compile 'com.google.code.gson:gson:2.8.0' compile 'com.sk89q.lib:jlibnoise:1.0.0' compile 'com.googlecode.json-simple:json-simple:1.1.1' - //compile 'net.sf.trove4j:trove4j:3.0.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' // Fawe depends compile 'org.yaml:snakeyaml:1.19' compile 'net.fabiozumbi12:redprotect:1.9.6' - compile ("com.plotsquared:plotsquared-api:latest") { + compile ("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { transitive = false } -// compile 'org.primesoft:BlocksHub:2.0' compile 'com.github.luben:zstd-jni:1.1.1' compile 'co.aikar:fastutil-lite:1.0' } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java index 30043de3d..22d6b21f3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java @@ -14,7 +14,7 @@ import com.boydti.fawe.util.chat.Message; import com.boydti.fawe.util.image.ImageUtil; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.Auto; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.object.Plot; @@ -213,7 +213,7 @@ public class CFICommands extends MethodCommands { int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(area.worldname); int diff = player.getAllowedPlots() - currentPlots; if (diff < 1) { - C.CANT_CLAIM_MORE_PLOTS_NUM.send(player, -diff); + Captions.CANT_CLAIM_MORE_PLOTS_NUM.send(player, -diff); return; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/CFIRedirect.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/CFIRedirect.java index 0bbd953c6..ac338bd82 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/CFIRedirect.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/CFIRedirect.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -33,10 +33,10 @@ public class CFIRedirect extends Command { @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - checkTrue(args.length >= 1, C.COMMAND_SYNTAX, getUsage()); - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - checkTrue(plot.isOwner(player.getUUID()), C.NOW_OWNER); - checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); + checkTrue(args.length >= 1, Captions.COMMAND_SYNTAX, getUsage()); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + checkTrue(plot.isOwner(player.getUUID()), Captions.NOW_OWNER); + checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER); final PlotArea area = plot.getArea(); if (area instanceof SinglePlotArea) { player.sendMessage("The command has been changed to: //cfi"); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweTrim.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweTrim.java index c41ed8678..2222f9859 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweTrim.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweTrim.java @@ -5,7 +5,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; import com.github.intellectualsites.plotsquared.plot.commands.SubCommand; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; @@ -33,7 +33,7 @@ public class FaweTrim extends SubCommand { return false; } if (!WorldUtil.IMP.isWorld(strings[0])) { - C.NOT_VALID_PLOT_WORLD.send(plotPlayer, strings[0]); + Captions.NOT_VALID_PLOT_WORLD.send(plotPlayer, strings[0]); return false; } ran = true; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/MoveTo512.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/MoveTo512.java index 1ef77170f..bcd558cc7 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/MoveTo512.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/MoveTo512.java @@ -15,7 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; import com.github.intellectualsites.plotsquared.plot.database.SQLManager; import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java index d22b6c706..7b6eafdd8 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper; @@ -47,28 +47,28 @@ public class PlotSetBiome extends Command { @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"), C.NO_PLOT_PERMS); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + checkTrue(plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"), Captions.NO_PLOT_PERMS); if (plot.getRunning() != 0) { - C.WAIT_FOR_TIMER.send(player); + Captions.WAIT_FOR_TIMER.send(player); return; } - checkTrue(args.length == 1, C.COMMAND_SYNTAX, getUsage()); + checkTrue(args.length == 1, Captions.COMMAND_SYNTAX, getUsage()); final HashSet regions = plot.getRegions(); BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List knownBiomes = biomeRegistry.getBiomes(); final BaseBiome biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry); if (biome == null) { - String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), C.BLOCK_LIST_SEPARATER.s()); - C.NEED_BIOME.send(player); - MainUtil.sendMessage(player, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); + String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s()); + Captions.NEED_BIOME.send(player); + MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); return; } confirm.run(this, new Runnable() { @Override public void run() { if (plot.getRunning() != 0) { - C.WAIT_FOR_TIMER.send(player); + Captions.WAIT_FOR_TIMER.send(player); return; } plot.addRunning(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/ReplaceAll.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/ReplaceAll.java index 8005419f8..80aa7e704 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/ReplaceAll.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/ReplaceAll.java @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.commands.RequiredType; -import com.github.intellectualsites.plotsquared.plot.config.C; +import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; @@ -36,15 +36,15 @@ public class ReplaceAll extends Command { @Override public void execute(final PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) throws CommandException { - checkTrue(args.length >= 1, C.COMMAND_SYNTAX, getUsage()); - final Plot plot = check(player.getCurrentPlot(), C.NOT_IN_PLOT); - checkTrue(plot.isOwner(player.getUUID()), C.NOW_OWNER); - checkTrue(plot.getRunning() == 0, C.WAIT_FOR_TIMER); + checkTrue(args.length >= 1, Captions.COMMAND_SYNTAX, getUsage()); + final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); + checkTrue(plot.isOwner(player.getUUID()), Captions.NOW_OWNER); + checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER); final PlotArea area = plot.getArea(); if (area instanceof SinglePlotArea) { plot.addRunning(); FawePlayer fp = FawePlayer.wrap(player.getName()); - C.TASK_START.send(player); + Captions.TASK_START.send(player); TaskManager.IMP.async(new Runnable() { @Override public void run() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index bd9ea9aa1..74748983e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -127,200 +127,14 @@ public class SpongeSchematicReader extends NBTSchematicReader { } return fc; } -//<<<<<<< HEAD if (Settings.IMP.CLIPBOARD.USE_DISK) { return fc = new DiskOptimizedClipboard(size, 1, 1, uuid); } else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) { return fc = new CPUOptimizedClipboard(size, 1, 1); -//======= -// -// BlockVector3 min = BlockVector3.at(offsetParts[0], offsetParts[1], offsetParts[2]); -// -// if (metadata.containsKey("WEOffsetX")) { -// // We appear to have WorldEdit Metadata -// int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); -// int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); -// int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); -// BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); -// origin = min.subtract(offset); -// region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); -//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching } else { return fc = new MemoryOptimizedClipboard(size, 1, 1); } } -// BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]); -// -// if (metadata.containsKey("WEOffsetX")) { -// // We appear to have WorldEdit Metadata -// int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); -// int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); -// int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); -// BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ); -// origin = min.subtract(offset); -// region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); -// } else { -// origin = min; -// region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); -// } -// -// int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue(); -// Map paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue(); -// if (paletteObject.size() != paletteMax) { -// throw new IOException("Differing given palette size to actual size"); -//>>>>>>> 399e0ad5... Refactor vector system to be cleaner - -// private Clipboard readVersion1(UUID uuid) throws IOException { -// width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE; -// -// final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc); -// FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream(); -// FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream(); -// -// NBTStreamer streamer = new NBTStreamer(inputStream); -// streamer.addReader("Schematic.Width", (BiConsumer) (i, v) -> width = v); -// streamer.addReader("Schematic.Height", (BiConsumer) (i, v) -> height = v); -// streamer.addReader("Schematic.Length", (BiConsumer) (i, v) -> length = v); -// streamer.addReader("Schematic.Offset", (BiConsumer) (i, v) -> min = new BlockVector(v[0], v[1], v[2])); -// streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer) (i, v) -> offsetX = v); -// streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer) (i, v) -> offsetY = v); -// streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer) (i, v) -> offsetZ = v); -// streamer.addReader("Schematic.Palette", (BiConsumer>) (i, v) -> { -// palette = new char[v.size()]; -// for (Map.Entry entry : v.entrySet()) { -// BlockState state = BlockState.get(entry.getKey()); -// int index = ((IntTag) entry.getValue()).getValue(); -// palette[index] = (char) state.getOrdinal(); -// } -//<<<<<<< HEAD -// }); -// streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() { -// @Override -// public void accept(Integer arrayLen, DataInputStream dis) { -// try (FaweOutputStream blocks = new FaweOutputStream(new LZ4BlockOutputStream(blocksOut))) { -// IOUtil.copy(dis, blocks, arrayLen); -// } catch (IOException e) { -// e.printStackTrace(); -// } -//======= -// palette.put(id, state); -// } -// -// byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); -// -// Map> tileEntitiesMap = new HashMap<>(); -// try { -// List> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream() -// .map(tag -> (CompoundTag) tag) -// .map(CompoundTag::getValue) -// .collect(Collectors.toList()); -// -// for (Map tileEntity : tileEntityTags) { -// int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); -// tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity); -//>>>>>>> 399e0ad5... Refactor vector system to be cleaner -// } -// }); -// streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() { -// @Override -// public void accept(Integer arrayLen, DataInputStream dis) { -// try (FaweOutputStream biomes = new FaweOutputStream(new LZ4BlockOutputStream(biomesOut))) { -// IOUtil.copy(dis, biomes, arrayLen); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } -// }); -// streamer.addReader("Schematic.TileEntities.#", new BiConsumer() { -// @Override -// public void accept(Integer index, CompoundTag value) { -// if (fc == null) { -// setupClipboard(0, uuid); -// } -// int[] pos = value.getIntArray("Pos"); -// int x = pos[0]; -// int y = pos[1]; -// int z = pos[2]; -// fc.setTile(x, y, z, value); -// } -// }); -// streamer.addReader("Schematic.Entities.#", new BiConsumer() { -// @Override -// public void accept(Integer index, CompoundTag compound) { -// if (fc == null) { -// setupClipboard(0, uuid); -// } -// String id = compound.getString("id"); -// if (id.isEmpty()) { -// return; -// } -// ListTag positionTag = compound.getListTag("Pos"); -// ListTag directionTag = compound.getListTag("Rotation"); -// EntityType type = EntityTypes.parse(id); -// if (type != null) { -// compound.getValue().put("Id", new StringTag(type.getId())); -// BaseEntity state = new BaseEntity(type, compound); -// fc.createEntity(clipboard, positionTag.asDouble(0), positionTag.asDouble(1), positionTag.asDouble(2), (float) directionTag.asDouble(0), (float) directionTag.asDouble(1), state); -// } else { -// Fawe.debug("Invalid entity: " + id); -// } -// } -//<<<<<<< HEAD -// }); -// streamer.readFully(); -// if (fc == null) setupClipboard(length * width * height, uuid); -// Vector origin = min; -// CuboidRegion region; -// if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) { -// origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ)); -// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE)); -// } else { -// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE)); -// } -// if (blocksOut.getSize() != 0) { -// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) { -// int volume = width * height * length; -// if (palette.length < 128) { -// for (int index = 0; index < volume; index++) { -// BlockState state = BlockTypes.states[palette[fis.read()]]; -// fc.setBlock(index, state); -//======= -// // index = (y * length + z) * width + x -// int y = index / (width * length); -// int z = (index % (width * length)) / width; -// int x = (index % (width * length)) % width; -// BlockState state = palette.get(value); -// BlockVector3 pt = new BlockVector3(x, y, z); -// try { -// if (tileEntitiesMap.containsKey(pt)) { -// Map values = Maps.newHashMap(tileEntitiesMap.get(pt)); -// for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { -// if (handler.isAffectedBlock(state)) { -// handler.updateNBT(state, values); -// } -//>>>>>>> 399e0ad5... Refactor vector system to be cleaner -// } -// } else { -// for (int index = 0; index < volume; index++) { -// BlockState state = BlockTypes.states[palette[fis.readVarInt()]]; -// fc.setBlock(index, state); -// } -// } -// } -// } -// if (biomesOut.getSize() != 0) { -// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(biomesOut.toByteArrays())))) { -// int volume = width * length; -// for (int index = 0; index < volume; index++) { -// fc.setBiome(index, fis.read()); -// } -// } -// } -// fc.setDimensions(new Vector(width, height, length)); -// clipboard.init(region, fc); -// clipboard.setOrigin(origin); -// return clipboard; -// } private Clipboard readVersion1(UUID uuid) throws IOException { width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE; @@ -344,7 +158,6 @@ public class SpongeSchematicReader extends NBTSchematicReader { int index = ((IntTag) entry.getValue()).getValue(); palette[index] = (char) state.getOrdinal(); } -//<<<<<<< HEAD }); streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() { @Override @@ -354,23 +167,6 @@ public class SpongeSchematicReader extends NBTSchematicReader { } catch (IOException e) { e.printStackTrace(); } -//======= -// palette.put(id, state); -// } -// -// byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); -// -// Map> tileEntitiesMap = new HashMap<>(); -// try { -// List> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream() -// .map(tag -> (CompoundTag) tag) -// .map(CompoundTag::getValue) -// .collect(Collectors.toList()); -// -// for (Map tileEntity : tileEntityTags) { -// int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); -// tileEntitiesMap.put(BlockVector3.at(pos[0], pos[1], pos[2]), tileEntity); -//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching } }); streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() { @@ -395,7 +191,6 @@ public class SpongeSchematicReader extends NBTSchematicReader { int z = pos[2]; fc.setTile(x, y, z, value); } -//<<<<<<< HEAD }); streamer.addReader("Schematic.Entities.#", new BiConsumer() { @Override @@ -421,6 +216,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { }); streamer.readFully(); if (fc == null) setupClipboard(length * width * height, uuid); + else fc.setDimensions(BlockVector3.at(width, height, length)); BlockVector3 origin = min; CuboidRegion region; if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) { @@ -436,32 +232,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { for (int index = 0; index < volume; index++) { BlockState state = BlockTypes.states[palette[fis.read()]]; fc.setBlock(index, state); -//======= -// // index = (y * length + z) * width + x -// int y = index / (width * length); -// int z = (index % (width * length)) / width; -// int x = (index % (width * length)) % width; -// BlockState state = palette.get(value); -// BlockVector3 pt = BlockVector3.at(x, y, z); -// try { -// if (tileEntitiesMap.containsKey(pt)) { -// Map values = Maps.newHashMap(tileEntitiesMap.get(pt)); -// for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { -// if (handler.isAffectedBlock(state)) { -// handler.updateNBT(state, values); -// } -//>>>>>>> 2c8b2fe0... Move vectors to static creators, for caching } -//<<<<<<< HEAD -//======= -// values.put("x", new IntTag(pt.getBlockX())); -// values.put("y", new IntTag(pt.getBlockY())); -// values.put("z", new IntTag(pt.getBlockZ())); -// values.put("id", values.get("Id")); -// values.remove("Id"); -// values.remove("Pos"); -// clipboard.setBlock(pt, state.toBaseBlock(new CompoundTag(values))); -//>>>>>>> f54d6afb... Make BaseBlock more memory efficient, and make it clear in the API that it's not intended to be used for every single block. } else { for (int index = 0; index < volume; index++) { BlockState state = BlockTypes.states[palette[fis.readVarInt()]]; @@ -478,7 +249,6 @@ public class SpongeSchematicReader extends NBTSchematicReader { } } } - fc.setDimensions(BlockVector3.at(width, height, length)); clipboard.init(region, fc); clipboard.setOrigin(origin); return clipboard;