Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 12:00:07 +01:00
Update to working PlotSquared repo; Update to PlotSquared C>Captions class rename; Cleaning and minor modifications to SpongeSchematicReader
Dieser Commit ist enthalten in:
Ursprung
0fa9d7a4a7
Commit
c98a311146
@ -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/"}
|
||||
|
@ -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 {
|
||||
|
@ -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'
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> 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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> 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<RegionWrapper> regions = plot.getRegions();
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
List<BaseBiome> 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();
|
||||
|
@ -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<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> 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<Object> fp = FawePlayer.wrap(player.getName());
|
||||
C.TASK_START.send(player);
|
||||
Captions.TASK_START.send(player);
|
||||
TaskManager.IMP.async(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -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<String, Tag> 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<Integer, Short>) (i, v) -> width = v);
|
||||
// streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
|
||||
// streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
|
||||
// streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
|
||||
// streamer.addReader("Schematic.Palette", (BiConsumer<Integer, HashMap<String, Tag>>) (i, v) -> {
|
||||
// palette = new char[v.size()];
|
||||
// for (Map.Entry<String, Tag> 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<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
// try {
|
||||
// List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
|
||||
// .map(tag -> (CompoundTag) tag)
|
||||
// .map(CompoundTag::getValue)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (Map<String, Tag> 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<Integer, CompoundTag>() {
|
||||
// @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<Integer, CompoundTag>() {
|
||||
// @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<String, Tag> 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<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
// try {
|
||||
// List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
|
||||
// .map(tag -> (CompoundTag) tag)
|
||||
// .map(CompoundTag::getValue)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (Map<String, Tag> 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<Integer, CompoundTag>() {
|
||||
@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<String, Tag> 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;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren