From b4a170b265ca0df8b74f9d0c4a79f2ba101107e7 Mon Sep 17 00:00:00 2001 From: zml2008 Date: Sat, 14 Jan 2012 16:56:36 -0800 Subject: [PATCH] Updated for SpoutAPI changes, again. --- .../java/com/sk89q/worldedit/spout/SpoutWorld.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java index e89f43f68..ff68a471b 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java @@ -70,7 +70,8 @@ public class SpoutWorld extends LocalWorld { */ @Override public boolean setBlockType(Vector pt, int type) { - return world.getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).setBlockId((short)type) != type; + world.setBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short)type); + return world.getBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()) != type; } /** @@ -94,8 +95,9 @@ public class SpoutWorld extends LocalWorld { */ @Override public boolean setTypeIdAndData(Vector pt, int type, int data) { - return world.setBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short)type) != type - && world.setBlockData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (byte)data) != data; + int origType = getBlockType(pt), origData = getBlockData(pt); + world.setBlockIdAndData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short) type, (short) data); + return origType != type && origData != data; } /** @@ -109,7 +111,6 @@ public class SpoutWorld extends LocalWorld { @Override public boolean setTypeIdAndDataFast(Vector pt, int type, int data) { return setTypeIdAndData(pt, type, data); - //return world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).setTypeIdAndData(type, (byte) data, false); } /** @@ -131,7 +132,7 @@ public class SpoutWorld extends LocalWorld { */ @Override public void setBlockData(Vector pt, int data) { - world.setBlockData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (byte)data); + setTypeIdAndData(pt, world.getBlockId(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()), data); } /** @@ -690,7 +691,7 @@ public class SpoutWorld extends LocalWorld { */ @Override public boolean isValidBlockType(int type) { - return type <= 255 && MaterialData.getMaterial((short)type) != null; + return MaterialData.getBlock((short)type) != null; } @Override