diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java index 96c897e36f..99a483df48 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -585,7 +585,6 @@ public class Block { Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256); Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, BIG_MUSHROOM_2); // CraftBukkit - Item.byId[MOB_SPAWNER.id] = new ItemMobSpawner(MOB_SPAWNER.id - 256); // CraftBukkit for (int i = 0; i < 256; ++i) { if (byId[i] != null) { diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java deleted file mode 100644 index e70125ae18..0000000000 --- a/src/main/java/net/minecraft/server/BlockMobSpawner.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.minecraft.server; - -import java.util.Random; - -public class BlockMobSpawner extends BlockContainer { - - protected BlockMobSpawner(int i, int j) { - super(i, j, Material.STONE); - } - - public TileEntity a_() { - return new TileEntityMobSpawner(); - } - - public int getDropType(int i, Random random, int j) { - return Block.MOB_SPAWNER.id; // CraftBukkit - } - - public int a(Random random) { - return 0; - } - - // CraftBukkit start - @Override - public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { - TileEntity entity = world.getTileEntity(i, j, k); - if (entity instanceof TileEntityMobSpawner) { - super.dropNaturally(world, i, j, k, ((TileEntityMobSpawner) entity).getId(), f, i1); - } - } - - @Override - public void remove(World world, int i, int j, int k) { - dropNaturally(world, i, j, k, 0, 1.0f, 0); - super.remove(world, i, j, k); - } - - protected int getDropData(int i) { - return i; - } - // CraftBukkit end - - public boolean a() { - return false; - } -} diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java deleted file mode 100644 index ddf5d034f5..0000000000 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ /dev/null @@ -1,127 +0,0 @@ -package net.minecraft.server; - -import java.util.HashMap; -import java.util.Map; - -public class EntityTypes { - - private static Map a = new HashMap(); - private static Map b = new HashMap(); - private static Map c = new HashMap(); - private static Map d = new HashMap(); - - public EntityTypes() {} - - private static void a(Class oclass, String s, int i) { - a.put(s, oclass); - b.put(oclass, s); - c.put(Integer.valueOf(i), oclass); - d.put(oclass, Integer.valueOf(i)); - } - - public static Entity a(String s, World world) { - Entity entity = null; - - try { - Class oclass = (Class) a.get(s); - - if (oclass != null) { - entity = (Entity) oclass.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world}); - } - } catch (Exception exception) { - // CraftBukkit - don't do anything here - } - - return entity; - } - - public static Entity a(NBTTagCompound nbttagcompound, World world) { - Entity entity = null; - - try { - Class oclass = (Class) a.get(nbttagcompound.getString("id")); - - if (oclass != null) { - entity = (Entity) oclass.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world}); - } - } catch (Exception exception) { - // CraftBukkit - don't do anything here - } - - if (entity != null) { - entity.e(nbttagcompound); - } else { - System.out.println("Skipping Entity with id " + nbttagcompound.getString("id")); - } - - return entity; - } - - public static int a(Entity entity) { - return ((Integer) d.get(entity.getClass())).intValue(); - } - - public static String b(Entity entity) { - return (String) b.get(entity.getClass()); - } - - // CraftBukkit start - public static Class getClassFromId(int id) { - return (Class) c.get(id); - } - - public static int getIdFromClass(Class oClass) { - return (Integer) d.get(oClass); - } - - public static Class getClassFromName(String name) { - return (Class) a.get(name); - } - - public static String getNameFromClass(Class oClass) { - return (String) b.get(oClass); - } - // CraftBukkit end - - static { - a(EntityItem.class, "Item", 1); - a(EntityExperienceOrb.class, "XPOrb", 2); - a(EntityPainting.class, "Painting", 9); - a(EntityArrow.class, "Arrow", 10); - a(EntitySnowball.class, "Snowball", 11); - a(EntityFireball.class, "Fireball", 12); - a(EntitySmallFireball.class, "SmallFireball", 13); - a(EntityEnderPearl.class, "ThrownEnderpearl", 14); - a(EntityEnderSignal.class, "EyeOfEnderSignal", 15); - a(EntityTNTPrimed.class, "PrimedTnt", 20); - a(EntityFallingBlock.class, "FallingSand", 21); - a(EntityMinecart.class, "Minecart", 40); - a(EntityBoat.class, "Boat", 41); - a(EntityLiving.class, "Mob", 48); - a(EntityMonster.class, "Monster", 49); - a(EntityCreeper.class, "Creeper", 50); - a(EntitySkeleton.class, "Skeleton", 51); - a(EntitySpider.class, "Spider", 52); - a(EntityGiantZombie.class, "Giant", 53); - a(EntityZombie.class, "Zombie", 54); - a(EntitySlime.class, "Slime", 55); - a(EntityGhast.class, "Ghast", 56); - a(EntityPigZombie.class, "PigZombie", 57); - a(EntityEnderman.class, "Enderman", 58); - a(EntityCaveSpider.class, "CaveSpider", 59); - a(EntitySilverfish.class, "Silverfish", 60); - a(EntityBlaze.class, "Blaze", 61); - a(EntityMagmaCube.class, "LavaSlime", 62); - a(EntityEnderDragon.class, "EnderDragon", 63); - a(EntityPig.class, "Pig", 90); - a(EntitySheep.class, "Sheep", 91); - a(EntityCow.class, "Cow", 92); - a(EntityChicken.class, "Chicken", 93); - a(EntitySquid.class, "Squid", 94); - a(EntityWolf.class, "Wolf", 95); - a(EntityMushroomCow.class, "MushroomCow", 96); - a(EntitySnowman.class, "SnowMan", 97); - a(EntityVillager.class, "Villager", 120); - a(EntityEnderCrystal.class, "EnderCrystal", 200); - } -} diff --git a/src/main/java/net/minecraft/server/ItemMobSpawner.java b/src/main/java/net/minecraft/server/ItemMobSpawner.java deleted file mode 100644 index ca6c1e83b8..0000000000 --- a/src/main/java/net/minecraft/server/ItemMobSpawner.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.minecraft.server; -// CraftBukkit start - the whole file! - -public class ItemMobSpawner extends ItemWithAuxData { - - public ItemMobSpawner(int id) { - super(id, Block.MOB_SPAWNER); - } - - // interact - public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int x, int y, int z, int face) { - - // super.interact (for ItemBlock this normally attempts to place it) - if (!super.a(itemstack, entityhuman, world, x, y, z, face)) return false; - - // 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++; } - - // Set the remembered datavalue for the spawner - TileEntity entity = world.getTileEntity(x, y, z); - if (entity instanceof TileEntityMobSpawner) { - ((TileEntityMobSpawner) entity).setId(itemstack.getData()); - return true; - } - - return false; - } -} -// CraftBukkit end - the whole file! \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index 94a99e741e..7b499ebc3a 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -21,22 +21,6 @@ public class TileEntityMobSpawner extends TileEntity { return this.world.findNearbyPlayer((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null; } - // CraftBukkit start - public int getId() { - return EntityTypes.getIdFromClass(EntityTypes.getClassFromName(mobName)); - } - - public void setId(int id) { - mobName = EntityTypes.getNameFromClass(EntityTypes.getClassFromId(id)); - if (mobName == null || mobName.length() == 0) { - mobName = "Pig"; - } - if (EntityTypes.a(mobName, world) == null) { - mobName = "Pig"; - } - } - // CraftBukkit end - public void l_() { this.c = this.b; if (this.c()) { @@ -64,7 +48,7 @@ public class TileEntityMobSpawner extends TileEntity { byte b0 = 4; for (int i = 0; i < b0; ++i) { - Entity entityliving = EntityTypes.a(this.mobName, this.world); // CraftBukkit + EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.mobName, this.world)); if (entityliving == null) { return; @@ -84,13 +68,12 @@ public class TileEntityMobSpawner extends TileEntity { entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F); // CraftBukkit start - if ((entityliving instanceof EntityLiving && ((EntityLiving) entityliving).g()) || - (!(entityliving instanceof EntityLiving) && entityliving.world.containsEntity(entityliving.boundingBox) && entityliving.world.getEntities(entityliving, entityliving.boundingBox).size() == 0 && !entityliving.world.c(entityliving.boundingBox))) { + if (entityliving.g()) { this.world.addEntity(entityliving, SpawnReason.SPAWNER); // CraftBukkit end this.world.f(2004, this.x, this.y, this.z, 0); - // entityliving.ah(); // CraftBukkit -- only avail on clientside + entityliving.ah(); this.e(); } }