Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-27 03:12:37 +01:00
Cleaned up ForgeWorld, AbstractWorld.
Change block setting method in Forge to a more proper one.
Dieser Commit ist enthalten in:
Ursprung
b6ee2c570a
Commit
4a6614f34f
@ -1236,7 +1236,7 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector pt, BaseBlock block, boolean notifyAdjacent) {
|
public boolean setBlock(Vector pt, BaseBlock block, boolean notifyAdjacent) throws WorldEditException {
|
||||||
if (!skipNmsSafeSet) {
|
if (!skipNmsSafeSet) {
|
||||||
try {
|
try {
|
||||||
return (Boolean) nmsSetSafeMethod.invoke(null, this, pt, block, notifyAdjacent);
|
return (Boolean) nmsSetSafeMethod.invoke(null, this, pt, block, notifyAdjacent);
|
||||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.forge;
|
|||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.worldedit.BiomeTypes;
|
import com.sk89q.worldedit.BiomeTypes;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.ServerInterface;
|
import com.sk89q.worldedit.ServerInterface;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import net.minecraft.command.CommandBase;
|
import net.minecraft.command.CommandBase;
|
||||||
@ -81,9 +80,9 @@ class ForgePlatform extends ServerInterface {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LocalWorld> getWorlds() {
|
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
|
||||||
List<WorldServer> worlds = Arrays.asList(DimensionManager.getWorlds());
|
List<WorldServer> worlds = Arrays.asList(DimensionManager.getWorlds());
|
||||||
List<LocalWorld> ret = new ArrayList<LocalWorld>(worlds.size());
|
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.size());
|
||||||
for (WorldServer world : worlds) {
|
for (WorldServer world : worlds) {
|
||||||
ret.add(new ForgeWorld(world));
|
ret.add(new ForgeWorld(world));
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,12 @@
|
|||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
|
import com.sk89q.worldedit.ServerInterface;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldVector;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
|
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -46,10 +50,10 @@ public class ForgePlayer extends LocalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WorldVector getPosition() {
|
public WorldVector getPosition() {
|
||||||
return new WorldVector(ForgeWorldEdit.inst.getWorld(this.player.worldObj), this.player.posX, this.player.posY, this.player.posZ);
|
return new WorldVector(LocalWorldAdapter.wrap(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalWorld getWorld() {
|
public com.sk89q.worldedit.world.World getWorld() {
|
||||||
return ForgeWorldEdit.inst.getWorld(this.player.worldObj);
|
return ForgeWorldEdit.inst.getWorld(this.player.worldObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,13 @@ package com.sk89q.worldedit.forge;
|
|||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.blocks.*;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.foundation.Block;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
|
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||||
|
import com.sk89q.worldedit.world.AbstractWorld;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityHanging;
|
import net.minecraft.entity.EntityHanging;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
@ -35,7 +39,8 @@ import net.minecraft.entity.passive.EntityAnimal;
|
|||||||
import net.minecraft.entity.passive.EntityTameable;
|
import net.minecraft.entity.passive.EntityTameable;
|
||||||
import net.minecraft.entity.passive.EntityVillager;
|
import net.minecraft.entity.passive.EntityVillager;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.tileentity.*;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.LongHashMap;
|
import net.minecraft.util.LongHashMap;
|
||||||
import net.minecraft.world.ChunkCoordIntPair;
|
import net.minecraft.world.ChunkCoordIntPair;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -45,254 +50,120 @@ import net.minecraft.world.gen.ChunkProviderServer;
|
|||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ForgeWorld extends LocalWorld {
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
private WeakReference<World> world;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An adapter to Minecraft worlds for WorldEdit.
|
||||||
|
*/
|
||||||
|
public class ForgeWorld extends AbstractWorld {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(ForgeWorld.class.getCanonicalName());
|
||||||
|
private final WeakReference<World> worldRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new world.
|
||||||
|
*
|
||||||
|
* @param world the world
|
||||||
|
*/
|
||||||
ForgeWorld(World world) {
|
ForgeWorld(World world) {
|
||||||
this.world = new WeakReference<World>(world);
|
checkNotNull(world);
|
||||||
|
this.worldRef = new WeakReference<World>(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the underlying handle to the world.
|
||||||
|
*
|
||||||
|
* @return the world
|
||||||
|
* @throws WorldEditException thrown if a reference to the world was lost (i.e. world was unloaded)
|
||||||
|
*/
|
||||||
|
public World getWorldChecked() throws WorldEditException {
|
||||||
|
World world = worldRef.get();
|
||||||
|
if (world != null) {
|
||||||
|
return world;
|
||||||
|
} else {
|
||||||
|
throw new WorldReferenceLostException("The reference to the world was lost (i.e. the world may have been unloaded)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the underlying handle to the world.
|
||||||
|
*
|
||||||
|
* @return the world
|
||||||
|
* @throws RuntimeException thrown if a reference to the world was lost (i.e. world was unloaded)
|
||||||
|
*/
|
||||||
|
public World getWorld() {
|
||||||
|
World world = worldRef.get();
|
||||||
|
if (world != null) {
|
||||||
|
return world;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("The reference to the world was lost (i.e. the world may have been unloaded)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.world.get().provider.getDimensionName();
|
return getWorld().provider.getDimensionName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setBlockType(Vector pt, int type) {
|
@Override
|
||||||
return this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), type, 0, 3);
|
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException {
|
||||||
}
|
checkNotNull(position);
|
||||||
|
checkNotNull(block);
|
||||||
|
|
||||||
public boolean setBlockTypeFast(Vector pt, int type) {
|
World world = getWorldChecked();
|
||||||
return this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), type);
|
int x = position.getBlockX();
|
||||||
}
|
int y = position.getBlockY();
|
||||||
|
int z = position.getBlockZ();
|
||||||
|
|
||||||
public boolean setTypeIdAndData(Vector pt, int type, int data) {
|
// First set the block
|
||||||
return this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), type, data, 3);
|
Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
|
||||||
}
|
int previousId = 0;
|
||||||
|
|
||||||
public boolean setTypeIdAndDataFast(Vector pt, int type, int data) {
|
if (notifyAndLight) {
|
||||||
return this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), type, data, 3);
|
previousId = chunk.getBlockID(x & 15, y, z & 15);
|
||||||
}
|
|
||||||
|
|
||||||
public int getBlockType(Vector pt) {
|
|
||||||
return this.world.get().getBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBlockData(Vector pt, int data) {
|
|
||||||
this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), data, 0, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBlockDataFast(Vector pt, int data) {
|
|
||||||
this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), data, 0, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBlockData(Vector pt) {
|
|
||||||
return this.world.get().getBlockMetadata(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBlockLightLevel(Vector pt) {
|
|
||||||
return this.world.get().getBlockLightValue(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidBlockType(int id) {
|
|
||||||
return (id == 0) || (net.minecraft.block.Block.blocksList[id] != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiomeType getBiome(Vector2D pt) {
|
|
||||||
return ForgeBiomeTypes.getFromBaseBiome(this.world.get().getBiomeGenForCoords(pt.getBlockX(), pt.getBlockZ()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBiome(Vector2D pt, BiomeType biome) {
|
|
||||||
if (this.world.get().getChunkProvider().chunkExists(pt.getBlockX(), pt.getBlockZ())) {
|
|
||||||
Chunk chunk = this.world.get().getChunkFromBlockCoords(pt.getBlockX(), pt.getBlockZ());
|
|
||||||
if ((chunk != null) && (chunk.isChunkLoaded)) {
|
|
||||||
byte[] biomevals = chunk.getBiomeArray();
|
|
||||||
biomevals[((pt.getBlockZ() & 0xF) << 4 | pt.getBlockX() & 0xF)] = (byte) ForgeBiomeTypes.getFromBiomeType(biome).biomeID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean regenerate(Region region, EditSession editSession) {
|
|
||||||
BaseBlock[] history = new BaseBlock[256 * (getMaxY() + 1)];
|
|
||||||
|
|
||||||
for (Vector2D chunk : region.getChunks()) {
|
|
||||||
Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++) {
|
|
||||||
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;
|
|
||||||
history[index] = editSession.getBlock(pt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Set<Vector2D> chunks = region.getChunks();
|
|
||||||
IChunkProvider provider = this.world.get().getChunkProvider();
|
|
||||||
if (!(provider instanceof ChunkProviderServer)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
|
||||||
Field u = null;
|
|
||||||
try {
|
|
||||||
u = ChunkProviderServer.class.getDeclaredField("field_73248_b"); // chunksToUnload
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
u = ChunkProviderServer.class.getDeclaredField("chunksToUnload");
|
|
||||||
}
|
|
||||||
u.setAccessible(true);
|
|
||||||
Set<?> unloadQueue = (Set<?>) u.get(chunkServer);
|
|
||||||
Field m = null;
|
|
||||||
try {
|
|
||||||
m = ChunkProviderServer.class.getDeclaredField("field_73244_f"); // loadedChunkHashMap
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
m = ChunkProviderServer.class.getDeclaredField("loadedChunkHashMap");
|
|
||||||
}
|
|
||||||
m.setAccessible(true);
|
|
||||||
LongHashMap loadedMap = (LongHashMap) m.get(chunkServer);
|
|
||||||
Field lc = null;
|
|
||||||
try {
|
|
||||||
lc = ChunkProviderServer.class.getDeclaredField("field_73245_g"); // loadedChunkHashMap
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
lc = ChunkProviderServer.class.getDeclaredField("loadedChunks");
|
|
||||||
}
|
|
||||||
lc.setAccessible(true);
|
|
||||||
List<Chunk> loaded = (List<Chunk>) lc.get(chunkServer);
|
|
||||||
Field p = null;
|
|
||||||
try {
|
|
||||||
p = ChunkProviderServer.class.getDeclaredField("field_73246_d"); // currentChunkProvider
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
p = ChunkProviderServer.class.getDeclaredField("currentChunkProvider");
|
|
||||||
}
|
|
||||||
p.setAccessible(true);
|
|
||||||
IChunkProvider chunkProvider = (IChunkProvider) p.get(chunkServer);
|
|
||||||
|
|
||||||
for (Vector2D coord : chunks) {
|
|
||||||
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
|
||||||
Chunk mcChunk = null;
|
|
||||||
if (chunkServer.chunkExists(coord.getBlockX(), coord.getBlockZ())) {
|
|
||||||
mcChunk = chunkServer.loadChunk(coord.getBlockX(), coord.getBlockZ());
|
|
||||||
mcChunk.onChunkUnload();
|
|
||||||
}
|
|
||||||
unloadQueue.remove(pos);
|
|
||||||
loadedMap.remove(pos);
|
|
||||||
mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ());
|
|
||||||
loadedMap.add(pos, mcChunk);
|
|
||||||
loaded.add(mcChunk);
|
|
||||||
if (mcChunk != null) {
|
|
||||||
mcChunk.onChunkLoad();
|
|
||||||
}
|
|
||||||
mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ());
|
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
|
||||||
t.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++) {
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (!region.contains(pt))
|
|
||||||
editSession.smartSetBlock(pt, history[index]);
|
|
||||||
else {
|
|
||||||
editSession.rememberChange(pt, history[index], editSession.rawGetBlock(pt));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
boolean successful = chunk.setBlockIDWithMetadata(x & 15, y, z & 15, block.getId(), block.getData());
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setBlock(Vector pt, Block block, boolean notify) {
|
|
||||||
if (!(block instanceof BaseBlock)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean successful = this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), block.getId());
|
|
||||||
|
|
||||||
|
// Create the TileEntity
|
||||||
if (successful) {
|
if (successful) {
|
||||||
if (block instanceof TileEntityBlock) {
|
CompoundTag tag = block.getNbtData();
|
||||||
copyToWorld(pt, (BaseBlock) block);
|
if (tag != null) {
|
||||||
|
NBTTagCompound nativeTag = NBTConverter.toNative(tag);
|
||||||
|
nativeTag.setString("id", block.getNbtId());
|
||||||
|
TileEntityUtils.setTileEntity(getWorld(), position, nativeTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.world.get().setBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), block.getId(), block.getData(), 3);
|
|
||||||
|
if (notifyAndLight) {
|
||||||
|
world.updateAllLightTypes(x, y, z);
|
||||||
|
world.markBlockForUpdate(x, y, z);
|
||||||
|
world.notifyBlockChange(x, y, z, previousId);
|
||||||
|
|
||||||
|
Block mcBlock = Block.blocksList[block.getId()];
|
||||||
|
if (mcBlock != null && mcBlock.hasComparatorInputOverride()) {
|
||||||
|
world.func_96440_m(x, y, z, block.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return successful;
|
return successful;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseBlock getBlock(Vector pt) {
|
@Override
|
||||||
int type = getBlockType(pt);
|
public int getBlockLightLevel(Vector position) {
|
||||||
int data = getBlockData(pt);
|
checkNotNull(position);
|
||||||
TileEntity tile = this.world.get().getBlockTileEntity(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
return getWorld().getBlockLightValue(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
if (tile != null) {
|
|
||||||
TileEntityBaseBlock block = new TileEntityBaseBlock(type, data, tile);
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
return new BaseBlock(type, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean copyToWorld(Vector pt, BaseBlock block) {
|
@Override
|
||||||
return copyToWorld(pt, block, true);
|
public boolean clearContainerBlockContents(Vector position) {
|
||||||
}
|
checkNotNull(position);
|
||||||
|
TileEntity tile = getWorld().getBlockTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
public boolean copyToWorld(Vector pt, BaseBlock block, boolean copyData) {
|
|
||||||
if (!(block instanceof TileEntityBlock)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (block instanceof SignBlock) {
|
|
||||||
// Signs
|
|
||||||
TileEntitySign sign = new TileEntitySign();
|
|
||||||
sign.signText = ((SignBlock) block).getText();
|
|
||||||
world.get().setBlockTileEntity(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), sign);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block instanceof MobSpawnerBlock) {
|
|
||||||
// Mob spawners
|
|
||||||
TileEntityMobSpawner spawner = new TileEntityMobSpawner();
|
|
||||||
spawner.getSpawnerLogic().setMobID(((MobSpawnerBlock) block).getMobType());
|
|
||||||
world.get().setBlockTileEntity(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), spawner);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block instanceof NoteBlock) {
|
|
||||||
// Note block
|
|
||||||
TileEntityNote note = new TileEntityNote();
|
|
||||||
note.note = ((NoteBlock) block).getNote();
|
|
||||||
world.get().setBlockTileEntity(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), note);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block instanceof SkullBlock) {
|
|
||||||
// Skull block
|
|
||||||
TileEntitySkull skull = new TileEntitySkull();
|
|
||||||
skull.setSkullType(((SkullBlock) block).getSkullType(), ((SkullBlock) block).getOwner());
|
|
||||||
skull.setSkullRotation(((SkullBlock) block).getRot());
|
|
||||||
world.get().setBlockTileEntity(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), skull);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompoundTag tag = block.getNbtData();
|
|
||||||
if (tag != null) {
|
|
||||||
TileEntityUtils.setTileEntity(this.world.get(), pt, NBTConverter.toNative(tag));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean copyFromWorld(Vector pt, BaseBlock block) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean clearContainerBlockContents(Vector pt) {
|
|
||||||
TileEntity tile = this.world.get().getBlockTileEntity(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
|
||||||
if ((tile instanceof IInventory)) {
|
if ((tile instanceof IInventory)) {
|
||||||
IInventory inv = (IInventory) tile;
|
IInventory inv = (IInventory) tile;
|
||||||
int size = inv.getSizeInventory();
|
int size = inv.getSizeInventory();
|
||||||
@ -304,21 +175,96 @@ public class ForgeWorld extends LocalWorld {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropItem(Vector pt, BaseItemStack item) {
|
@Override
|
||||||
|
public BiomeType getBiome(Vector2D position) {
|
||||||
|
checkNotNull(position);
|
||||||
|
return ForgeBiomeTypes.getFromBaseBiome(getWorld().getBiomeGenForCoords(position.getBlockX(), position.getBlockZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBiome(Vector2D position, BiomeType biome) {
|
||||||
|
checkNotNull(position);
|
||||||
|
checkNotNull(biome);
|
||||||
|
|
||||||
|
if (getWorld().getChunkProvider().chunkExists(position.getBlockX(), position.getBlockZ())) {
|
||||||
|
Chunk chunk = getWorld().getChunkFromBlockCoords(position.getBlockX(), position.getBlockZ());
|
||||||
|
if ((chunk != null) && (chunk.isChunkLoaded)) {
|
||||||
|
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) ForgeBiomeTypes.getFromBiomeType(biome).biomeID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector position, BaseItemStack item) {
|
||||||
|
checkNotNull(position);
|
||||||
|
checkNotNull(item);
|
||||||
|
|
||||||
if ((item == null) || (item.getType() == 0)) {
|
if ((item == null) || (item.getType() == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EntityItem entity = new EntityItem(this.world.get(), pt.getX(), pt.getY(), pt.getZ(), ForgeUtil.toForgeItemStack(item));
|
|
||||||
|
EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeUtil.toForgeItemStack(item));
|
||||||
entity.delayBeforeCanPickup = 10;
|
entity.delayBeforeCanPickup = 10;
|
||||||
this.world.get().spawnEntityInWorld(entity);
|
getWorld().spawnEntityInWorld(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked", "ConstantConditions"})
|
||||||
|
public int killMobs(Vector origin, double radius, int flags) {
|
||||||
|
boolean killPets = (flags & 0x1) != 0;
|
||||||
|
boolean killNPCs = (flags & 0x2) != 0;
|
||||||
|
boolean killAnimals = (flags & 0x4) != 0;
|
||||||
|
|
||||||
|
boolean killGolems = (flags & 0x8) != 0;
|
||||||
|
boolean killAmbient = (flags & 0x10) != 0;
|
||||||
|
|
||||||
|
int num = 0;
|
||||||
|
double radiusSq = radius * radius;
|
||||||
|
|
||||||
|
for (Entity obj : (Iterable<Entity>) getWorld().loadedEntityList) {
|
||||||
|
if ((obj instanceof EntityLiving)) {
|
||||||
|
EntityLiving ent = (EntityLiving) obj;
|
||||||
|
|
||||||
|
if (!killAnimals && ent instanceof EntityAnimal) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!killPets && ent instanceof EntityTameable && ((EntityTameable) ent).isTamed()) {
|
||||||
|
continue; // tamed pet
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!killGolems && ent instanceof EntityGolem) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!killNPCs && ent instanceof EntityVillager) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!killAmbient && ent instanceof EntityAmbientCreature) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((radius < 0.0D) || (origin.distanceSq(new Vector(ent.posX, ent.posY, ent.posZ)) <= radiusSq)) {
|
||||||
|
ent.isDead = true;
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public int removeEntities(EntityType type, Vector origin, int radius) {
|
public int removeEntities(EntityType type, Vector origin, int radius) {
|
||||||
|
checkNotNull(type);
|
||||||
|
checkNotNull(origin);
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
double radiusSq = Math.pow(radius, 2.0D);
|
double radiusSq = Math.pow(radius, 2.0D);
|
||||||
|
|
||||||
for (Iterator<Entity> it = this.world.get().loadedEntityList.iterator(); it.hasNext();) {
|
for (Entity ent : (Iterable<Entity>) getWorld().loadedEntityList) {
|
||||||
Entity ent = it.next();
|
|
||||||
if ((radius != -1) && (origin.distanceSq(new Vector(ent.posX, ent.posY, ent.posZ)) > radiusSq)) {
|
if ((radius != -1) && (origin.distanceSq(new Vector(ent.posX, ent.posY, ent.posZ)) > radiusSq)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -377,66 +323,159 @@ public class ForgeWorld extends LocalWorld {
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int killMobs(Vector origin, double radius, int flags) {
|
@Override
|
||||||
boolean killPets = (flags & 0x1) != 0;
|
public boolean regenerate(Region region, EditSession editSession) {
|
||||||
boolean killNPCs = (flags & 0x2) != 0;
|
BaseBlock[] history = new BaseBlock[256 * (getMaxY() + 1)];
|
||||||
boolean killAnimals = (flags & 0x4) != 0;
|
|
||||||
|
|
||||||
boolean killGolems = (flags & 0x8) != 0;
|
for (Vector2D chunk : region.getChunks()) {
|
||||||
boolean killAmbient = (flags & 0x10) != 0;
|
Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
||||||
|
|
||||||
int num = 0;
|
for (int x = 0; x < 16; x++) {
|
||||||
double radiusSq = radius * radius;
|
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||||
|
for (int z = 0; z < 16; z++) {
|
||||||
for (Iterator<Entity> it = this.world.get().loadedEntityList.iterator(); it.hasNext();) {
|
Vector pt = min.add(x, y, z);
|
||||||
Entity obj = it.next();
|
int index = y * 16 * 16 + z * 16 + x;
|
||||||
if (!(obj instanceof EntityLiving)) {
|
history[index] = editSession.getBlock(pt);
|
||||||
continue;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EntityLiving ent = (EntityLiving) obj;
|
try {
|
||||||
|
Set<Vector2D> chunks = region.getChunks();
|
||||||
|
IChunkProvider provider = getWorld().getChunkProvider();
|
||||||
|
if (!(provider instanceof ChunkProviderServer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
||||||
|
Field u;
|
||||||
|
try {
|
||||||
|
u = ChunkProviderServer.class.getDeclaredField("field_73248_b"); // chunksToUnload
|
||||||
|
} catch(NoSuchFieldException e) {
|
||||||
|
u = ChunkProviderServer.class.getDeclaredField("chunksToUnload");
|
||||||
|
}
|
||||||
|
u.setAccessible(true);
|
||||||
|
Set<?> unloadQueue = (Set<?>) u.get(chunkServer);
|
||||||
|
Field m;
|
||||||
|
try {
|
||||||
|
m = ChunkProviderServer.class.getDeclaredField("field_73244_f"); // loadedChunkHashMap
|
||||||
|
} catch(NoSuchFieldException e) {
|
||||||
|
m = ChunkProviderServer.class.getDeclaredField("loadedChunkHashMap");
|
||||||
|
}
|
||||||
|
m.setAccessible(true);
|
||||||
|
LongHashMap loadedMap = (LongHashMap) m.get(chunkServer);
|
||||||
|
Field lc;
|
||||||
|
try {
|
||||||
|
lc = ChunkProviderServer.class.getDeclaredField("field_73245_g"); // loadedChunkHashMap
|
||||||
|
} catch(NoSuchFieldException e) {
|
||||||
|
lc = ChunkProviderServer.class.getDeclaredField("loadedChunks");
|
||||||
|
}
|
||||||
|
lc.setAccessible(true);
|
||||||
|
@SuppressWarnings("unchecked") List<Chunk> loaded = (List<Chunk>) lc.get(chunkServer);
|
||||||
|
Field p;
|
||||||
|
try {
|
||||||
|
p = ChunkProviderServer.class.getDeclaredField("field_73246_d"); // currentChunkProvider
|
||||||
|
} catch(NoSuchFieldException e) {
|
||||||
|
p = ChunkProviderServer.class.getDeclaredField("currentChunkProvider");
|
||||||
|
}
|
||||||
|
p.setAccessible(true);
|
||||||
|
IChunkProvider chunkProvider = (IChunkProvider) p.get(chunkServer);
|
||||||
|
|
||||||
if (!killAnimals && ent instanceof EntityAnimal) {
|
for (Vector2D coord : chunks) {
|
||||||
continue;
|
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
||||||
|
Chunk mcChunk;
|
||||||
|
if (chunkServer.chunkExists(coord.getBlockX(), coord.getBlockZ())) {
|
||||||
|
mcChunk = chunkServer.loadChunk(coord.getBlockX(), coord.getBlockZ());
|
||||||
|
mcChunk.onChunkUnload();
|
||||||
|
}
|
||||||
|
unloadQueue.remove(pos);
|
||||||
|
loadedMap.remove(pos);
|
||||||
|
mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ());
|
||||||
|
loadedMap.add(pos, mcChunk);
|
||||||
|
loaded.add(mcChunk);
|
||||||
|
if (mcChunk != null) {
|
||||||
|
mcChunk.onChunkLoad();
|
||||||
|
mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
logger.log(Level.WARNING, "Failed to generate chunk", t);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!killPets && ent instanceof EntityTameable && ((EntityTameable) ent).isTamed()) {
|
for (int x = 0; x < 16; x++) {
|
||||||
continue; // tamed pet
|
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;
|
||||||
|
|
||||||
if (!killGolems && ent instanceof EntityGolem) {
|
if (!region.contains(pt))
|
||||||
continue;
|
editSession.smartSetBlock(pt, history[index]);
|
||||||
}
|
else {
|
||||||
|
editSession.rememberChange(pt, history[index], editSession.rawGetBlock(pt));
|
||||||
if (!killNPCs && ent instanceof EntityVillager) {
|
}
|
||||||
continue;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!killAmbient && ent instanceof EntityAmbientCreature) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ((radius < 0.0D) || (origin.distanceSq(new Vector(ent.posX, ent.posY, ent.posZ)) <= radiusSq)) {
|
|
||||||
ent.isDead = true;
|
|
||||||
num++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
public World getWorld() {
|
|
||||||
return world.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
|
||||||
if ((other instanceof ForgeWorld)) {
|
|
||||||
return ((ForgeWorld) other).world.get().equals(this.world.get());
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
@Override
|
||||||
return this.world.get().hashCode();
|
public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidBlockType(int id) {
|
||||||
|
return (id == 0) || (net.minecraft.block.Block.blocksList[id] != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseBlock getBlock(Vector position) {
|
||||||
|
World world = getWorld();
|
||||||
|
int id = world.getBlockId(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
|
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
|
TileEntity tile = getWorld().getBlockTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
|
|
||||||
|
if (tile != null) {
|
||||||
|
return new TileEntityBaseBlock(id, data, tile);
|
||||||
|
} else {
|
||||||
|
return new BaseBlock(id, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseBlock getLazyBlock(Vector position) {
|
||||||
|
World world = getWorld();
|
||||||
|
int id = world.getBlockId(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
|
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
|
return new LazyBlock(id, data, this, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return getWorld().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if ((o instanceof ForgeWorld)) {
|
||||||
|
ForgeWorld other = ((ForgeWorld) o);
|
||||||
|
World otherWorld = other.worldRef.get();
|
||||||
|
World thisWorld = other.worldRef.get();
|
||||||
|
return otherWorld != null && thisWorld != null && otherWorld.equals(thisWorld);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when the reference to the world is lost.
|
||||||
|
*/
|
||||||
|
private static class WorldReferenceLostException extends WorldEditException {
|
||||||
|
private WorldReferenceLostException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -26,6 +26,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.WorldVector;
|
import com.sk89q.worldedit.WorldVector;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extension.platform.PlatformRejectionException;
|
import com.sk89q.worldedit.extension.platform.PlatformRejectionException;
|
||||||
|
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
@ -136,7 +137,7 @@ public class ForgeWorldEdit {
|
|||||||
Action action = event.action;
|
Action action = event.action;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LEFT_CLICK_BLOCK: {
|
case LEFT_CLICK_BLOCK: {
|
||||||
WorldVector pos = new WorldVector(world, event.x, event.y, event.z);
|
WorldVector pos = new WorldVector(LocalWorldAdapter.wrap(world), event.x, event.y, event.z);
|
||||||
|
|
||||||
if (we.handleBlockLeftClick(player, pos)) {
|
if (we.handleBlockLeftClick(player, pos)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
@ -147,7 +148,7 @@ public class ForgeWorldEdit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case RIGHT_CLICK_BLOCK: {
|
case RIGHT_CLICK_BLOCK: {
|
||||||
WorldVector pos = new WorldVector(world, event.x, event.y, event.z);
|
WorldVector pos = new WorldVector(LocalWorldAdapter.wrap(world), event.x, event.y, event.z);
|
||||||
|
|
||||||
if (we.handleBlockRightClick(player, pos)) {
|
if (we.handleBlockRightClick(player, pos)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
|
@ -135,7 +135,7 @@ public abstract class LocalWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector pt, BaseBlock block, boolean notifyAdjacent) {
|
public boolean setBlock(Vector pt, BaseBlock block, boolean notifyAdjacent) throws WorldEditException {
|
||||||
boolean successful;
|
boolean successful;
|
||||||
|
|
||||||
// Default implementation will call the old deprecated methods
|
// 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);
|
public abstract boolean copyToWorld(Vector position, BaseBlock block);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector pt, BaseBlock block) {
|
public boolean setBlock(Vector pt, BaseBlock block) throws WorldEditException {
|
||||||
return setBlock(pt, block, true);
|
return setBlock(pt, block, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.extent;
|
package com.sk89q.worldedit.extent;
|
||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class LocalWorldAdapter extends LocalWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return world.setBlock(position, block, notifyAndLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public abstract class AbstractWorld implements World {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxY() {
|
public int getMaxY() {
|
||||||
return 255;
|
return getMaximumPoint().getBlockY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,6 +67,44 @@ public abstract class AbstractWorld implements World {
|
|||||||
new BaseBlock(BlockID.WATER, -1));
|
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")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlockTypeFast(Vector pt, int type) {
|
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);
|
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
|
@Override
|
||||||
public boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException {
|
public boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException {
|
||||||
return generateTree(TreeType.TREE, editSession, pt);
|
return generateTree(TreeType.TREE, editSession, pt);
|
||||||
@ -212,7 +245,7 @@ public abstract class AbstractWorld implements World {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector getMaximumPoint() {
|
public Vector getMaximumPoint() {
|
||||||
return new Vector(30000000, getMaxY(), 30000000);
|
return new Vector(30000000, 255, 30000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +103,7 @@ public interface World extends Extent {
|
|||||||
* @param notifyAndLight true to to notify and light
|
* @param notifyAndLight true to to notify and light
|
||||||
* @return true if the block was successfully set (return value may not be accurate)
|
* @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)}
|
* @deprecated Use {@link #setBlock(Vector, BaseBlock)}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren