Yeeting Fastreset
Dieser Commit ist enthalten in:
Ursprung
df3de51a94
Commit
4f9afd0db0
@ -77,42 +77,4 @@ class Region_15 {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
static void fastpaste(File file, int x, int y, int z, boolean rotate) {
|
||||
Clipboard clipboard;
|
||||
try {
|
||||
clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read();
|
||||
} catch (NullPointerException | IOException e) {
|
||||
throw new SecurityException("Bausystem schematic not found", e);
|
||||
}
|
||||
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
BlockVector3 v = BlockVector3.at(x, y, z);
|
||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
if (rotate) {
|
||||
v = v.add(dimensions.getX() / 2 + dimensions.getX() % 2, 0, dimensions.getZ() / 2 + dimensions.getZ() % 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
||||
} else {
|
||||
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
||||
}
|
||||
|
||||
WorldServer world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
|
||||
v = v.add(offset);
|
||||
|
||||
for (int X = v.getBlockX(); X < v.getBlockX() + dimensions.getBlockX(); X++) {
|
||||
for (int Y = v.getBlockY(); Y < v.getBlockY() + dimensions.getBlockY(); Y++) {
|
||||
for (int Z = v.getBlockZ(); Z < v.getBlockZ() + dimensions.getBlockZ(); Z++) {
|
||||
BlockPosition blockPos = new BlockPosition(X, Y, Z);
|
||||
BaseBlock fullBlock = clipboard.getFullBlock(BlockVector3.at(X, Y, Z).subtract(v).add(clipboard.getRegion().getMinimumPoint()));
|
||||
BlockData replaceTo = BukkitAdapter.adapt(fullBlock);
|
||||
world.removeTileEntity(blockPos);
|
||||
if (replaceTo == null)
|
||||
world.setTypeAndData(blockPos, ((CraftBlockData) Material.AIR.createBlockData()).getState(), 1042);
|
||||
else
|
||||
world.setTypeAndData(new BlockPosition(X, Y, Z), ((CraftBlockData) replaceTo).getState(), 1042);
|
||||
|
||||
world.getChunkProvider().flagDirty(blockPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren