Changed Location to use Extents rather than worlds and overhauled the new Entity code a bit.

This commit is contained in:
sk89q
2014-06-29 15:36:41 -07:00
parent c9612c05a7
commit eee2c5d9f4
24 changed files with 312 additions and 158 deletions

View File

@ -25,6 +25,7 @@ import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.world.World;
/**
* A super pickaxe mode that will remove blocks in an area.
@ -48,7 +49,7 @@ public class AreaPickaxe implements BlockTool {
int ox = clicked.getBlockX();
int oy = clicked.getBlockY();
int oz = clicked.getBlockZ();
int initialType = clicked.getWorld().getBlockType(clicked.toVector());
int initialType = ((World) clicked.getExtent()).getBlockType(clicked.toVector());
if (initialType == 0) {
return true;
@ -70,7 +71,7 @@ public class AreaPickaxe implements BlockTool {
continue;
}
clicked.getWorld().queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos));
((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos));
editSession.setBlock(pos, air);
}

View File

@ -41,7 +41,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
private boolean handleCycle(Platform server, LocalConfiguration config,
Player player, LocalSession session, Location clicked, boolean forward) {
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
int type = world.getBlockType(clicked.toVector());
int data = world.getBlockData(clicked.toVector());

View File

@ -48,7 +48,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
BlockBag bag = session.getBlockBag(player);
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, bag, player);
try {
@ -67,7 +67,7 @@ BlockBag bag = session.getBlockBag(player);
@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, player);
targetBlock = (editSession).getBlock(clicked.toVector());
BlockType type = BlockType.fromID(targetBlock.getType());

View File

@ -53,7 +53,7 @@ public class FloatingTreeRemover implements BlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config,
Player player, LocalSession session, Location clicked) {
final World world = clicked.getWorld();
final World world = (World) clicked.getExtent();
switch (world.getBlockType(clicked.toVector())) {
case BlockID.LOG:

View File

@ -51,7 +51,7 @@ public class FloodFillTool implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
int initialType = world.getBlockType(clicked.toVector());

View File

@ -42,7 +42,7 @@ public class QueryTool implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, 0, player);
BaseBlock block = (editSession).rawGetBlock(clicked.toVector());
BlockType type = BlockType.fromID(block.getType());

View File

@ -50,7 +50,7 @@ public class RecursivePickaxe implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
int initialType = world.getBlockType(clicked.toVector());

View File

@ -42,7 +42,7 @@ public class SinglePickaxe implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = clicked.getWorld();
World world = (World) clicked.getExtent();
final int blockType = world.getBlockType(clicked.toVector());
if (blockType == BlockID.BEDROCK
&& !player.canDestroyBedrock()) {