diff --git a/src/com/sk89q/worldedit/LocalWorld.java b/src/com/sk89q/worldedit/LocalWorld.java index 54a1cc993..c56d2e00a 100644 --- a/src/com/sk89q/worldedit/LocalWorld.java +++ b/src/com/sk89q/worldedit/LocalWorld.java @@ -150,9 +150,9 @@ public abstract void setMobSpawnerType(Vector pt, * @param count * @param times */ - public void dropItem(Vector pt, int type, int count, int times) { + public void dropItem(Vector pt,BaseItemStack item, int times) { for (int i = 0; i < times; i++) { - dropItem(pt, type, count); + dropItem(pt, item); } } @@ -160,22 +160,11 @@ public void dropItem(Vector pt, int type, int count, int times) { * Drop an item. * * @param pt - * @param type + * @param item * @param count * @param times */ - public abstract void dropItem(Vector pt, int type, - int count); - - /** - * Drop an item. - * - * @param pt - * @param type - * @param count - * @param times - */ - public abstract void dropItem(Vector pt, int type); + public abstract void dropItem(Vector pt, BaseItemStack item); /** * Simulate a block being mined. @@ -186,53 +175,54 @@ public void simulateBlockMine(Vector pt) { int type = getBlockType(pt); //setBlockType(pt, 0); - if (type == 1) { dropItem(pt, 4); } // Stone - else if (type == 2) { dropItem(pt, 3); } // Grass + if (type == 1) { dropItem(pt, new BaseItemStack(4)); } // Stone + else if (type == 2) { dropItem(pt, new BaseItemStack(3)); } // Grass else if (type == 7) { } // Bedrock else if (type == 8) { } // Water else if (type == 9) { } // Water else if (type == 10) { } // Lava else if (type == 11) { } // Lava else if (type == 13) { // Gravel - dropItem(pt, type); + dropItem(pt, new BaseItemStack(type)); if (random.nextDouble() >= 0.9) { - dropItem(pt, 318); + dropItem(pt, new BaseItemStack(318)); } } - else if (type == 16) { dropItem(pt, 263); } // Coal ore + else if (type == 16) { dropItem(pt, new BaseItemStack(263)); } // Coal ore else if (type == 18) { // Leaves if (random.nextDouble() > 0.95) { - dropItem(pt, 6); + dropItem(pt, new BaseItemStack(6)); } } else if (type == 20) { } // Glass - else if (type == 43) { dropItem(pt, 44); } // Double step + else if (type == 35) { dropItem(pt, new BaseItemStack(35, 1, (short)getBlockData(pt))); } // Cloth + else if (type == 43) { dropItem(pt, new BaseItemStack(44)); } // Double step else if (type == 47) { } // Bookshelves else if (type == 51) { } // Fire else if (type == 52) { } // Mob spawner - else if (type == 53) { dropItem(pt, 5); } // Wooden stairs - else if (type == 55) { dropItem(pt, 331); } // Redstone wire - else if (type == 56) { dropItem(pt, 264); } // Diamond ore - else if (type == 59) { dropItem(pt, 295); } // Crops - else if (type == 60) { dropItem(pt, 3); } // Soil - else if (type == 62) { dropItem(pt, 61); } // Furnace - else if (type == 63) { dropItem(pt, 323); } // Sign post - else if (type == 64) { dropItem(pt, 324); } // Wood door - else if (type == 67) { dropItem(pt, 4); } // Cobblestone stairs - else if (type == 68) { dropItem(pt, 323); } // Wall sign - else if (type == 71) { dropItem(pt, 330); } // Iron door - else if (type == 73) { dropItem(pt, 331, 1, 4); } // Redstone ore - else if (type == 74) { dropItem(pt, 331, 1, 4); } // Glowing redstone ore - else if (type == 75) { dropItem(pt, 76); } // Redstone torch + else if (type == 53) { dropItem(pt, new BaseItemStack(5)); } // Wooden stairs + else if (type == 55) { dropItem(pt, new BaseItemStack(331)); } // Redstone wire + else if (type == 56) { dropItem(pt, new BaseItemStack(264)); } // Diamond ore + else if (type == 59) { dropItem(pt, new BaseItemStack(295)); } // Crops + else if (type == 60) { dropItem(pt, new BaseItemStack(3)); } // Soil + else if (type == 62) { dropItem(pt, new BaseItemStack(61)); } // Furnace + else if (type == 63) { dropItem(pt, new BaseItemStack(323)); } // Sign post + else if (type == 64) { dropItem(pt, new BaseItemStack(324)); } // Wood door + else if (type == 67) { dropItem(pt, new BaseItemStack(4)); } // Cobblestone stairs + else if (type == 68) { dropItem(pt, new BaseItemStack(323)); } // Wall sign + else if (type == 71) { dropItem(pt, new BaseItemStack(330)); } // Iron door + else if (type == 73) { dropItem(pt, new BaseItemStack(331), 4); } // Redstone ore + else if (type == 74) { dropItem(pt, new BaseItemStack(331), 4); } // Glowing redstone ore + else if (type == 75) { dropItem(pt, new BaseItemStack(76)); } // Redstone torch else if (type == 78) { } // Snow else if (type == 79) { } // Ice - else if (type == 82) { dropItem(pt, 337, 1, 4); } // Clay - else if (type == 83) { dropItem(pt, 338); } // Reed - else if (type == 89) { dropItem(pt, 348); } // Lightstone + else if (type == 82) { dropItem(pt, new BaseItemStack(337), 4); } // Clay + else if (type == 83) { dropItem(pt, new BaseItemStack(338)); } // Reed + else if (type == 89) { dropItem(pt, new BaseItemStack(348)); } // Lightstone else if (type == 90) { } // Portal else if (type != 0) { - dropItem(pt, type); + dropItem(pt, new BaseItemStack(type)); } } diff --git a/src/com/sk89q/worldedit/blocks/BaseItem.java b/src/com/sk89q/worldedit/blocks/BaseItem.java index 20d2abc79..9767f95a6 100644 --- a/src/com/sk89q/worldedit/blocks/BaseItem.java +++ b/src/com/sk89q/worldedit/blocks/BaseItem.java @@ -28,7 +28,7 @@ public class BaseItem { /** * Item ID. */ - private short id; + private int id; /** * Item damage. */ @@ -39,7 +39,7 @@ public class BaseItem { * * @param id */ - public BaseItem(short id) { + public BaseItem(int id) { this.id = id; this.damage = 0; } @@ -49,7 +49,7 @@ public BaseItem(short id) { * * @param id */ - public BaseItem(short id, short damage) { + public BaseItem(int id, short damage) { this.id = id; this.damage = damage; } @@ -57,14 +57,14 @@ public BaseItem(short id, short damage) { /** * @return the id */ - public short getID() { + public int getType() { return id; } /** * @param id the id to set */ - public void setID(short id) { + public void setType(int id) { this.id = id; } diff --git a/src/com/sk89q/worldedit/blocks/BaseItemStack.java b/src/com/sk89q/worldedit/blocks/BaseItemStack.java index a8712303c..e9f047bf1 100644 --- a/src/com/sk89q/worldedit/blocks/BaseItemStack.java +++ b/src/com/sk89q/worldedit/blocks/BaseItemStack.java @@ -35,7 +35,7 @@ public class BaseItemStack extends BaseItem { * * @param id */ - public BaseItemStack(short id) { + public BaseItemStack(int id) { super(id); } @@ -44,7 +44,7 @@ public BaseItemStack(short id) { * * @param id */ - public BaseItemStack(short id, int amount) { + public BaseItemStack(int id, int amount) { super(id); this.amount = amount; } @@ -54,7 +54,7 @@ public BaseItemStack(short id, int amount) { * * @param id */ - public BaseItemStack(short id, int amount, short damage) { + public BaseItemStack(int id, int amount, short damage) { super(id, damage); this.amount = amount; } diff --git a/src/com/sk89q/worldedit/blocks/ChestBlock.java b/src/com/sk89q/worldedit/blocks/ChestBlock.java index 0ebc988c9..5ef9a033f 100644 --- a/src/com/sk89q/worldedit/blocks/ChestBlock.java +++ b/src/com/sk89q/worldedit/blocks/ChestBlock.java @@ -107,7 +107,7 @@ public Map toTileEntityNBT() if (item != null) { Map data = new HashMap(); CompoundTag itemTag = new CompoundTag("Items", data); - data.put("id", new ShortTag("id", item.getID())); + data.put("id", new ShortTag("id", (short)item.getType())); data.put("Damage", new ShortTag("Damage", item.getDamage())); data.put("Count", new ByteTag("Count", (byte)item.getAmount())); data.put("Slot", new ByteTag("Slot", (byte)i)); diff --git a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java index 1cd70bc94..33e073a35 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -157,16 +157,10 @@ public boolean generateBigTree(EditSession editSession, Vector pt) { } @Override - public void dropItem(Vector pt, int type, int count) { - ItemStack item = new ItemStack(type, count); - world.dropItemNaturally(toLocation(pt), item); - - } - - @Override - public void dropItem(Vector pt, int type) { - ItemStack item = new ItemStack(type, 1); - world.dropItemNaturally(toLocation(pt), item); + public void dropItem(Vector pt, BaseItemStack item) { + ItemStack bukkitItem = new ItemStack(item.getType(), item.getAmount(), + (byte)item.getDamage()); + world.dropItemNaturally(toLocation(pt), bukkitItem); }