mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 19:06:41 +00:00
Added support for non-128 worldheights
This commit is contained in:
@ -226,14 +226,14 @@ public class BukkitWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean regenerate(Region region, EditSession editSession) {
|
||||
BaseBlock[] history = new BaseBlock[16 * 16 * 128];
|
||||
BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)];
|
||||
|
||||
for (Vector2D chunk : region.getChunks()) {
|
||||
Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
||||
|
||||
// First save all the blocks inside
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
for (int y = 0; y < 128; ++y) {
|
||||
for (int y = 0; y < (getMaxY() + 1); ++y) {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
Vector pt = min.add(x, y, z);
|
||||
int index = y * 16 * 16 + z * 16 + x;
|
||||
@ -250,7 +250,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
|
||||
// Then restore
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
for (int y = 0; y < 128; ++y) {
|
||||
for (int y = 0; y < (getMaxY() + 1); ++y) {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
Vector pt = min.add(x, y, z);
|
||||
int index = y * 16 * 16 + z * 16 + x;
|
||||
@ -761,7 +761,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
public int getMaxY() {
|
||||
return world.getMaxHeight() - 1;
|
||||
}
|
||||
|
||||
@ -775,7 +775,6 @@ public class BukkitWorld extends LocalWorld {
|
||||
}
|
||||
|
||||
private static final int chunkSizeX = 16;
|
||||
private static final int chunkSizeY = 128;
|
||||
private static final int chunkSizeZ = 16;
|
||||
|
||||
@Override
|
||||
@ -810,8 +809,8 @@ public class BukkitWorld extends LocalWorld {
|
||||
boolean xBorder = x == 0 || x == chunkSizeX - 1;
|
||||
for (int z = 0; z < chunkSizeZ; ++z) {
|
||||
boolean zBorder = z == 0 || z == chunkSizeZ - 1;
|
||||
for (int y = 0; y < chunkSizeY; ++y) {
|
||||
final int index = y + z * chunkSizeY + x * chunkSizeY * chunkSizeZ;
|
||||
for (int y = 0; y < world.getMaxHeight(); ++y) {
|
||||
final int index = y + z * world.getMaxHeight() + x * world.getMaxHeight() * chunkSizeZ;
|
||||
byte blockID = blocks[index];
|
||||
if (!BlockType.emitsLight(blockID)) {
|
||||
if (xBorder || zBorder && BlockType.isTranslucent(blockID)) {
|
||||
|
@ -58,6 +58,6 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return editSession.getWorld().getHeight();
|
||||
return editSession.getWorld().getMaxY();
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
LocalSession session = controller.getSession(wrapPlayer(player));
|
||||
RegionSelector selector = session.getRegionSelector();
|
||||
RegionSelector selector = session.getRegionSelector(BukkitUtil.getLocalWorld(player.getWorld()));
|
||||
|
||||
try {
|
||||
Region region = selector.getRegion();
|
||||
|
@ -44,8 +44,8 @@ public class CuboidSelection extends RegionSelection {
|
||||
if (pt2 == null) {
|
||||
throw new IllegalArgumentException("Null point 2 not permitted");
|
||||
}
|
||||
|
||||
CuboidRegionSelector sel = new CuboidRegionSelector();
|
||||
|
||||
CuboidRegionSelector sel = new CuboidRegionSelector(BukkitUtil.getLocalWorld(world));
|
||||
sel.selectPrimary(pt1);
|
||||
sel.selectSecondary(pt2);
|
||||
|
||||
|
@ -21,8 +21,11 @@ package com.sk89q.worldedit.bukkit.selections;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import org.bukkit.World;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.bukkit.BukkitUtil;
|
||||
import com.sk89q.worldedit.regions.*;
|
||||
|
||||
public class Polygonal2DSelection extends RegionSelection {
|
||||
@ -36,13 +39,13 @@ public class Polygonal2DSelection extends RegionSelection {
|
||||
|
||||
public Polygonal2DSelection(World world, List<BlockVector2D> points, int minY, int maxY) {
|
||||
super(world);
|
||||
LocalWorld lWorld = BukkitUtil.getLocalWorld(world);
|
||||
|
||||
minY = Math.min(Math.max(0, minY), 127);
|
||||
maxY = Math.min(Math.max(0, maxY), 127);
|
||||
|
||||
Polygonal2DRegionSelector sel = new Polygonal2DRegionSelector();
|
||||
poly2d = new Polygonal2DRegion(points, minY, maxY);
|
||||
minY = Math.min(Math.max(0, minY), world.getMaxHeight());
|
||||
maxY = Math.min(Math.max(0, maxY), world.getMaxHeight());
|
||||
|
||||
Polygonal2DRegionSelector sel = new Polygonal2DRegionSelector(BukkitUtil.getLocalWorld(world));
|
||||
poly2d = new Polygonal2DRegion(lWorld, points, minY, maxY);
|
||||
sel.learnChanges();
|
||||
|
||||
setRegionSelector(sel);
|
||||
|
Reference in New Issue
Block a user