mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 19:06:41 +00:00
Cleaned up ForgeWorld, AbstractWorld.
Change block setting method in Forge to a more proper one.
This commit is contained in:
@ -135,7 +135,7 @@ public abstract class LocalWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector pt, BaseBlock block, boolean notifyAdjacent) {
|
||||
public boolean setBlock(Vector pt, BaseBlock block, boolean notifyAdjacent) throws WorldEditException {
|
||||
boolean successful;
|
||||
|
||||
// Default implementation will call the old deprecated methods
|
||||
@ -164,7 +164,7 @@ public abstract class LocalWorld extends AbstractWorld {
|
||||
public abstract boolean copyToWorld(Vector position, BaseBlock block);
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector pt, BaseBlock block) {
|
||||
public boolean setBlock(Vector pt, BaseBlock block) throws WorldEditException {
|
||||
return setBlock(pt, block, true);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class LocalWorldAdapter extends LocalWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) {
|
||||
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException {
|
||||
return world.setBlock(position, block, notifyAndLight);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return 255;
|
||||
return getMaximumPoint().getBlockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,6 +67,44 @@ public abstract class AbstractWorld implements World {
|
||||
new BaseBlock(BlockID.WATER, -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockType(Vector pt) {
|
||||
return getLazyBlock(pt).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockData(Vector pt) {
|
||||
return getLazyBlock(pt).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException {
|
||||
return setBlock(position, block, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlockType(Vector position, int type) {
|
||||
try {
|
||||
return setBlock(position, new BaseBlock(type));
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockData(Vector position, int data) {
|
||||
try {
|
||||
setBlock(position, new BaseBlock(getLazyBlock(position).getId(), data));
|
||||
} catch (WorldEditException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockDataFast(Vector position, int data) {
|
||||
setBlockData(position, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean setBlockTypeFast(Vector pt, int type) {
|
||||
@ -132,11 +170,6 @@ public abstract class AbstractWorld implements World {
|
||||
return killMobs(origin, radius, killPets ? KillFlags.PETS : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int killMobs(Vector origin, double radius, int flags) {
|
||||
return killMobs(origin, (int) radius, (flags & KillFlags.PETS) != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException {
|
||||
return generateTree(TreeType.TREE, editSession, pt);
|
||||
@ -212,7 +245,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
return new Vector(30000000, getMaxY(), 30000000);
|
||||
return new Vector(30000000, 255, 30000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +103,7 @@ public interface World extends Extent {
|
||||
* @param notifyAndLight true to to notify and light
|
||||
* @return true if the block was successfully set (return value may not be accurate)
|
||||
*/
|
||||
boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight);
|
||||
boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||
|
Reference in New Issue
Block a user