Changed WorldEdit to not set block data for blocks that don't require it.

Dieser Commit ist enthalten in:
sk89q 2010-11-16 20:39:48 -08:00
Ursprung 780ccd37ec
Commit 6945ddd258
2 geänderte Dateien mit 44 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -70,6 +70,10 @@ public class EditSession {
* Random number generator.
*/
private static Random prng = new Random();
/**
* Total number of blocks set over time.
*/
private int blockIndex = 0;
/**
* Construct the object with a maximum number of blocks.
@ -98,10 +102,14 @@ public class EditSession {
if (ServerInterface.getBlockType(pt) == 54) {
ServerInterface.clearChest(pt);
}
int id = block.getID();
boolean result = ServerInterface.setBlockType(pt, block.getID());
if (block.getID() != 0) {
ServerInterface.setBlockData(pt, block.getData());
boolean result = ServerInterface.setBlockType(pt, id);
if (id != 0) {
if (BlockType.usesData(id)) {
ServerInterface.setBlockData(pt, block.getData());
}
// Signs
if (block instanceof SignBlock) {

Datei anzeigen

@ -268,4 +268,37 @@ public enum BlockType {
|| id == 83 // Reed
|| id == 90; // Portal
}
/**
* Returns true if the block uses its data value.
*
* @param id
* @return
*/
public static boolean usesData(int id) {
return id == 6 // Saplings
|| id == 8 // Water
|| id == 9 // Water
|| id == 10 // Lava
|| id == 11 // Lava
|| id == 50 // Torch
|| id == 53 // Wooden stairs
|| id == 55 // Redstone wire
|| id == 59 // Crops
|| id == 60 // Soil
|| id == 63 // Sign post
|| id == 64 // Wooden door
|| id == 65 // Ladder
|| id == 66 // Minecart track
|| id == 67 // Cobblestone stairs
|| id == 68 // Wall sign
|| id == 69 // Lever
|| id == 70 // Stone pressure plate
|| id == 71 // Iron door
|| id == 72 // Wooden pressure plate
|| id == 75 // Redstone torch (off)
|| id == 76 // Redstone torch (on)
|| id == 77 // Stone button
|| id == 81; // Cactus
}
}