summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorTahg <tahgtahv@gmail.com>2011-12-10 17:07:32 -0500
committerTahg <tahgtahv@gmail.com>2011-12-10 17:07:32 -0500
commit77c07095bd86c30bb28ab8783e073c8dbd542f54 (patch)
treecad54221f7dcd29ddad638c90dd63e3b6d7b9a37 /src/main/java/net
parentde1a32bb1630146498373f5fc569435b6e3971af (diff)
downloadcraftbukkit-77c07095bd86c30bb28ab8783e073c8dbd542f54.tar
craftbukkit-77c07095bd86c30bb28ab8783e073c8dbd542f54.tar.gz
craftbukkit-77c07095bd86c30bb28ab8783e073c8dbd542f54.tar.lz
craftbukkit-77c07095bd86c30bb28ab8783e073c8dbd542f54.tar.xz
craftbukkit-77c07095bd86c30bb28ab8783e073c8dbd542f54.zip
removed changes to MobSpawner behavior
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/Block.java1
-rw-r--r--src/main/java/net/minecraft/server/BlockMobSpawner.java46
-rw-r--r--src/main/java/net/minecraft/server/EntityTypes.java127
-rw-r--r--src/main/java/net/minecraft/server/ItemMobSpawner.java34
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java23
5 files changed, 3 insertions, 228 deletions
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 96c897e3..99a483df 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 e70125ae..00000000
--- 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 ddf5d034..00000000
--- 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<? extends Entity> getClassFromId(int id) {
- return (Class<? extends Entity>) c.get(id);
- }
-
- public static int getIdFromClass(Class<? extends Entity> oClass) {
- return (Integer) d.get(oClass);
- }
-
- public static Class<? extends Entity> getClassFromName(String name) {
- return (Class<? extends Entity>) a.get(name);
- }
-
- public static String getNameFromClass(Class<? extends Entity> 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 ca6c1e83..00000000
--- 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 94a99e74..7b499ebc 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();
}
}