diff options
Diffstat (limited to 'src/main/java/net/minecraft')
5 files changed, 32 insertions, 42 deletions
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java index a30748cb..cb2bd448 100644 --- a/src/main/java/net/minecraft/server/BlockDispenser.java +++ b/src/main/java/net/minecraft/server/BlockDispenser.java @@ -102,7 +102,7 @@ public class BlockDispenser extends BlockContainer { itemstack = tileentitydispenser.getContents()[dispenseSlot]; // Copy item stack, because we want it to have 1 item - itemstack = new ItemStack(itemstack.id, 1, itemstack.damage); + itemstack = new ItemStack(itemstack.id, 1, itemstack.getData()); } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ItemMobSpawner.java b/src/main/java/net/minecraft/server/ItemMobSpawner.java index e0c0e805..2f0a4186 100644 --- a/src/main/java/net/minecraft/server/ItemMobSpawner.java +++ b/src/main/java/net/minecraft/server/ItemMobSpawner.java @@ -1,44 +1,34 @@ package net.minecraft.server; +// CraftBukkit start - the whole file! -public class ItemMobSpawner extends ItemLog { +public class ItemMobSpawner extends ItemLog { // Actually not ItemLog but 'ItemUsingMetadata' orso. - public ItemMobSpawner(int i) { - super(i, Block.MOB_SPAWNER); + public ItemMobSpawner(int id) { + super(id, Block.MOB_SPAWNER); } - - public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { - if(!super.a(itemstack, entityhuman, world, i, j, k, l)) return false; - System.out.println("Placed the spawner, checking it's entity"); - if (l == 0) { - --j; - } - - if (l == 1) { - ++j; - } - if (l == 2) { - --k; - } + // interact + public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int x, int y, int z, int face) { - if (l == 3) { - ++k; - } + // super.interact (for ItemBlock this normally attempts to place it) + if (!super.a(itemstack, entityhuman, world, x, y, z, face)) return false; - if (l == 4) { - --i; - } + // Adjust the coords for the face clicked. + if (face == 0) { y--; } + else if (face == 1) { y++; } + else if (face == 2) { z--; } + else if (face == 3) { z++; } + else if (face == 4) { x--; } + else if (face == 5) { x++; } - if (l == 5) { - ++i; - } - TileEntity entity = world.getTileEntity(i, j, k); - System.out.println(entity); + // Set the remembered datavalue for the spawner + TileEntity entity = world.getTileEntity(x, y, z); if (entity instanceof TileEntityMobSpawner) { - System.out.println("Got a valid spawner, attempt to set its type"); - ((TileEntityMobSpawner)entity).setId(itemstack.getData()); + ((TileEntityMobSpawner) entity).setId(itemstack.getData()); return true; } - else return false; + + return false; } } +// CraftBukkit end - the whole file!
\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 65747732..a624e7fc 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -35,7 +35,7 @@ public final class ItemStack { this.count = 0; this.id = i; this.count = j; - b(k); // CraftBukkit + this.b(k); // CraftBukkit } public static ItemStack a(NBTTagCompound nbttagcompound) { @@ -122,7 +122,7 @@ public final class ItemStack { } public void b(int i) { - this.damage = (id > 0) && (id < 256) ? Item.byId[id].filterData(i) : i; // CraftBukkit + this.damage = (this.id > 0) && (this.id < 256) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit } public int i() { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 3370aab5..f583e1d7 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -219,7 +219,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory { this.items[2] = itemstack.cloneItemStack(); } else if (this.items[2].id == itemstack.id) { // CraftBukkit - compare damage too - if (this.items[2].damage == itemstack.damage) { + if (this.items[2].getData() == itemstack.getData()) { this.items[2].count += itemstack.count; } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index acb0b64d..3af8e842 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -60,29 +60,29 @@ public class TileEntityMobSpawner extends TileEntity { for (int i = 0; i < b0; ++i) { // CraftBukkit start - Entity entity = EntityTypes.a(this.mobName, this.world); + Entity entityliving = EntityTypes.a(this.mobName, this.world); - if (entity == null) { + if (entityliving == null) { return; } - int j = this.world.a(entity.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size(); + int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size(); if (j >= 6) { this.c(); return; } - if (entity != null) { + if (entityliving != null) { double d3 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D; double d4 = (double) (this.y + this.world.random.nextInt(3) - 1); double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D; - entity.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F); - if (entity.world.containsEntity(entity.boundingBox) && entity.world.getEntities(entity, entity.boundingBox).size() == 0 && !entity.world.c(entity.boundingBox)) { + entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F); + if (entityliving.world.containsEntity(entityliving.boundingBox) && entityliving.world.getEntities(entityliving, entityliving.boundingBox).size() == 0 && !entityliving.world.c(entityliving.boundingBox)) { // CraftBukkit end // CraftBukkit - added a reason for spawning this creature - this.world.addEntity(entity, SpawnReason.SPAWNER); + this.world.addEntity(entityliving, SpawnReason.SPAWNER); for (int k = 0; k < 20; ++k) { d0 = (double) this.x + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D; |