Changed EditSession.rawSetBlock() to call setBlock() on World.

This commit is contained in:
sk89q 2012-08-24 13:38:00 -07:00
parent 2bc86ea525
commit 39d451438f

View File

@ -37,8 +37,6 @@
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ContainerBlock;
import com.sk89q.worldedit.blocks.TileEntityBlock;
import com.sk89q.worldedit.expression.Expression; import com.sk89q.worldedit.expression.Expression;
import com.sk89q.worldedit.expression.ExpressionException; import com.sk89q.worldedit.expression.ExpressionException;
import com.sk89q.worldedit.expression.runtime.RValue; import com.sk89q.worldedit.expression.runtime.RValue;
@ -222,33 +220,19 @@ public boolean rawSetBlock(Vector pt, BaseBlock block) {
} }
} }
} }
final boolean result; boolean result;
if (world.usesBlockData(type)) { if (type == 0) {
if (fastMode) { if (fastMode) {
result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0); result = world.setBlockTypeFast(pt, 0);
} else { } else {
result = world.setTypeIdAndData(pt, type, block.getData() > -1 ? block.getData() : 0); result = world.setBlockType(pt, 0);
} }
} else { } else {
if (fastMode) { result = world.setBlock(pt, block, fastMode);
result = world.setBlockTypeFast(pt, type);
} else {
result = world.setBlockType(pt, type);
}
}
//System.out.println(pt + "" +result);
if (type != 0) {
if (block instanceof ContainerBlock) {
if (blockBag == null) {
world.copyToWorld(pt, block);
}
} else if (block instanceof TileEntityBlock) {
world.copyToWorld(pt, block);
}
} }
return result; return result;
} }