Added 1.3 block support.

This commit is contained in:
sk89q 2011-02-26 02:48:07 -08:00
parent c58f8f4155
commit 6aa2c15652
4 changed files with 37 additions and 2 deletions

View File

@ -233,6 +233,25 @@ public BaseBlock getBlock(LocalPlayer player, String arg, boolean allAllowed)
} else {
throw new InvalidItemException(arg, "Unknown cloth color '" + args1[1] + "'");
}
} else if (blockType == BlockType.STEP
|| blockType == BlockType.DOUBLE_STEP) {
BlockType dataType = BlockType.lookup(args1[1]);
if (dataType != null) {
if (dataType == BlockType.STONE) {
data = 0;
} else if (dataType == BlockType.SANDSTONE) {
data = 1;
} else if (dataType == BlockType.WOOD) {
data = 2;
} else if (dataType == BlockType.COBBLESTONE) {
data = 3;
} else {
throw new InvalidItemException(arg, "Invalid step type '" + args1[1] + "'");
}
} else {
throw new InvalidItemException(arg, "Unknown step type '" + args1[1] + "'");
}
} else {
throw new InvalidItemException(arg, "Unknown data value '" + args1[1] + "'");
}

View File

@ -51,6 +51,7 @@ public final class BlockID {
public static final int DISPENSER = 23;
public static final int SANDSTONE = 24;
public static final int NOTE_BLOCK = 25;
public static final int BED = 26;
public static final int CLOTH = 35;
public static final int YELLOW_FLOWER = 37;
public static final int RED_FLOWER = 38;
@ -109,4 +110,6 @@ public final class BlockID {
public static final int PORTAL = 90;
public static final int JACKOLANTERN = 91;
public static final int CAKE_BLOCK = 92;
public static final int REDSTONE_REPEATER_OFF = 93;
public static final int REDSTONE_REPEATER_ON = 94;
}

View File

@ -55,6 +55,7 @@ public enum BlockType {
DISPENSER(23, "Dispenser", "dispenser"),
SANDSTONE(24, "Sandstone", "sandstone"),
NOTE_BLOCK(25, "Note block", new String[] {"musicblock", "noteblock", "note", "music", "instrument"}),
BED(26, "Bed", "bed"),
CLOTH(35, "Wool", new String[] {"cloth", "wool"}),
YELLOW_FLOWER(37, "Yellow flower", new String[] {"yellowflower", "flower"}),
RED_FLOWER(38, "Red rose", new String[] {"redflower", "redrose", "rose"}),
@ -124,7 +125,9 @@ public enum BlockType {
PORTAL(90, "Portal", "portal"),
JACK_O_LANTERN(91, "Pumpkin (on)",
new String[] {"pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"}),
CAKE(92, "Cake", new String[] {"cake", "cakeblock"});
CAKE(92, "Cake", new String[] {"cake", "cakeblock"}),
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", new String[] {"diode", "redstonerepeater", "repeater", "delayer"}),
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", new String[] {"diodeon", "redstonerepeateron", "repeateron", "delayeron"});
/**
* Stores a list of dropped blocks for blocks.
@ -385,7 +388,10 @@ public static boolean usesData(int id) {
|| id == 17 // Wood
|| id == 18 // Leaves
|| id == 23 // Dispenser
|| id == 26 // Bed
|| id == 35 // Wool
|| id == 43 // Double slab
|| id == 44 // Slab
|| id == 50 // Torch
|| id == 53 // Wooden stairs
|| id == 55 // Redstone wire
@ -409,7 +415,9 @@ public static boolean usesData(int id) {
|| id == 81 // Cactus
|| id == 86 // Pumpkin
|| id == 91 // Jack-o-lantern
|| id == 92; // Cake
|| id == 92 // Cake
|| id == 93 // Redstone repeater (off)
|| id == 94; // Redstone repeater (on)
}
/**

View File

@ -55,6 +55,7 @@ public enum ItemType {
DISPENSER(23, "Dispenser", "dispenser"),
SANDSTONE(24, "Sandstone", "sandstone"),
NOTE_BLOCK(25, "Note block", new String[] {"musicblock", "noteblock", "note", "music", "instrument"}),
BED(26, "Bed", "bed"),
CLOTH(35, "Wool", new String[] {"cloth", "wool"}),
YELLOW_FLOWER(37, "Yellow flower", new String[] {"yellowflower", "flower"}),
RED_FLOWER(38, "Red rose", new String[] {"redflower", "redrose", "rose"}),
@ -125,6 +126,8 @@ public enum ItemType {
JACK_O_LANTERN(91, "Pumpkin (on)",
new String[] {"pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"}),
CAKE(92, "Cake", new String[] {"cake", "cakeblock"}),
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", new String[] {"diode", "redstonerepeater", "repeater", "delayer"}),
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", new String[] {"diodeon", "redstonerepeateron", "repeateron", "delayeron"}),
IRON_SHOVEL(256, "Iron shovel", "ironshovel"),
IRON_PICK(257, "Iron pick", new String[] {"ironpick", "ironpickaxe"}),
@ -231,6 +234,8 @@ public enum ItemType {
BONE(352, "Bone", "bone"),
SUGAR(353, "Sugar", "sugar"),
CAKE_ITEM(354, "Cake", "cake"),
BED_ITEM(355, "Bed", "bed"),
REDSTONE_REPEATER(356, "Redstone repeater", new String[] {"redstonerepeater", "diode", "delayer"}),
GOLD_RECORD(2256, "Gold Record", new String[] {"goldrecord", "golddisc"}),
GREEN_RECORD(2257, "Green Record", new String[] {"greenrecord", "greenddisc"});