diff options
Diffstat (limited to 'src/main/java')
32 files changed, 85 insertions, 1797 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 74a2ac9c..2eab3c43 100644..100755 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -115,12 +115,7 @@ public abstract class Entity { this.a(0.0D, 0.0D, 0.0D); this.datawatcher.a(0, Byte.valueOf((byte) 0)); this.a(); - - // CraftBukkit start - bukkitEntity = null; } - protected org.bukkit.entity.Entity bukkitEntity; - // CraftBukkit end protected abstract void a(); @@ -954,8 +949,13 @@ public abstract class Entity { setPassengerOf(entity); } + protected org.bukkit.entity.Entity bukkitEntity; + public org.bukkit.entity.Entity getBukkitEntity(){ - return this.bukkitEntity; + if (bukkitEntity == null) { + bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(((WorldServer) this.world).getServer(), this); + } + return bukkitEntity; } public void setPassengerOf(Entity entity) { diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java deleted file mode 100644 index 103440e8..00000000 --- a/src/main/java/net/minecraft/server/EntityAnimal.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftAnimals; -// CraftBukkit end - -public abstract class EntityAnimal extends EntityCreature implements IAnimal { - - public EntityAnimal(World world) { - super(world); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftAnimals(server, this); - // CraftBukkit end - } - - protected float a(int i, int j, int k) { - return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id ? 10.0F : this.world.l(i, j, k) - 0.5F; - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - } - - public boolean b() { - int i = MathHelper.b(this.locX); - int j = MathHelper.b(this.boundingBox.b); - int k = MathHelper.b(this.locZ); - - return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id && this.world.j(i, j, k) > 8 && super.b(); - } - - public int c() { - return 120; - } -} diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index d2164c65..fa85935b 100644..100755 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -25,24 +25,17 @@ public class EntityArrow extends Entity { public EntityArrow(World world) { super(world); this.a(0.5F, 0.5F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftArrow(server, this); - // CraftBukkit end } public EntityArrow(World world, double d0, double d1, double d2) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.a(0.5F, 0.5F); this.a(d0, d1, d2); this.height = 0.0F; } public EntityArrow(World world, EntityLiving entityliving) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.b = entityliving; this.a(0.5F, 0.5F); this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 7511397a..67923166 100644..100755 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -6,7 +6,6 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.craftbukkit.entity.CraftBoat; import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Vehicle; @@ -65,12 +64,6 @@ public class EntityBoat extends Entity { this.a(1.5F, 0.6F); this.height = this.width / 2.0F; this.M = false; - - // CraftBukkit start - handleCreation(world); - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftBoat(server, this); - // CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java deleted file mode 100644 index d99c9c2d..00000000 --- a/src/main/java/net/minecraft/server/EntityChicken.java +++ /dev/null @@ -1,86 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftChicken; -// CraftBukkit end - -public class EntityChicken extends EntityAnimal { - - public boolean a = false; - public float b = 0.0F; - public float c = 0.0F; - public float f; - public float ak; - public float al = 1.0F; - public int am; - - public EntityChicken(World world) { - super(world); - this.texture = "/mob/chicken.png"; - this.a(0.3F, 0.4F); - this.health = 4; - this.am = this.random.nextInt(6000) + 6000; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftChicken(server, this); - // CraftBukkit end - } - - public void o() { - super.o(); - this.ak = this.b; - this.f = this.c; - this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D); - if (this.c < 0.0F) { - this.c = 0.0F; - } - - if (this.c > 1.0F) { - this.c = 1.0F; - } - - if (!this.onGround && this.al < 1.0F) { - this.al = 1.0F; - } - - this.al = (float) ((double) this.al * 0.9D); - if (!this.onGround && this.motY < 0.0D) { - this.motY *= 0.6D; - } - - this.b += this.al * 2.0F; - if (!this.world.isStatic && --this.am <= 0) { - this.world.a(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - this.a(Item.EGG.id, 1); - this.am = this.random.nextInt(6000) + 6000; - } - } - - protected void a(float f) {} - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - } - - protected String e() { - return "mob.chicken"; - } - - protected String f() { - return "mob.chickenhurt"; - } - - protected String g() { - return "mob.chickenhurt"; - } - - protected int h() { - return Item.FEATHER.id; - } -} diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java deleted file mode 100644 index 6a672695..00000000 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftCow; -// CraftBukkit end - -public class EntityCow extends EntityAnimal { - - public EntityCow(World world) { - super(world); - this.texture = "/mob/cow.png"; - this.a(0.9F, 1.3F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftCow(server, this); - // CraftBukkit end - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - } - - protected String e() { - return "mob.cow"; - } - - protected String f() { - return "mob.cowhurt"; - } - - protected String g() { - return "mob.cowhurt"; - } - - protected float i() { - return 0.4F; - } - - protected int h() { - return Item.LEATHER.id; - } - - public boolean a(EntityHuman entityhuman) { - ItemStack itemstack = entityhuman.inventory.e(); - - if (itemstack != null && itemstack.id == Item.BUCKET.id) { - entityhuman.inventory.a(entityhuman.inventory.c, new ItemStack(Item.MILK_BUCKET)); - return true; - } else { - return false; - } - } -} diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java deleted file mode 100644 index fed190f9..00000000 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ /dev/null @@ -1,110 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftCreeper; -// CraftBukkit end - - -public class EntityCreeper extends EntityMonster { - - int a; - int b; - - public EntityCreeper(World world) { - super(world); - this.texture = "/mob/creeper.png"; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftCreeper(server, this); - // CraftBukkit end - } - - protected void a() { - super.a(); - this.datawatcher.a(16, Byte.valueOf((byte) -1)); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - } - - public void b_() { - this.b = this.a; - if (this.world.isStatic) { - int i = this.K(); - - if (i > 0 && this.a == 0) { - this.world.a(this, "random.fuse", 1.0F, 0.5F); - } - - this.a += i; - if (this.a < 0) { - this.a = 0; - } - - if (this.a >= 30) { - this.a = 30; - } - } - - super.b_(); - } - - protected String f() { - return "mob.creeper"; - } - - protected String g() { - return "mob.creeperdeath"; - } - - public void f(Entity entity) { - super.f(entity); - if (entity instanceof EntitySkeleton) { - this.a(Item.GOLD_RECORD.id + this.random.nextInt(2), 1); - } - } - - protected void a(Entity entity, float f) { - int i = this.K(); - - if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { - this.a(-1); - --this.a; - if (this.a < 0) { - this.a = 0; - } - } else { - if (this.a == 0) { - this.world.a(this, "random.fuse", 1.0F, 0.5F); - } - - this.a(1); - ++this.a; - if (this.a >= 30) { - this.world.a(this, this.locX, this.locY, this.locZ, 3.0F); - this.q(); - } - - this.e = true; - } - } - - protected int h() { - return Item.SULPHUR.id; - } - - private int K() { - return this.datawatcher.a(16); - } - - private void a(int i) { - this.datawatcher.b(16, Byte.valueOf((byte) i)); - } -} diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 5927a36f..e7f542af 100644..100755 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -6,7 +6,6 @@ import java.util.List; import org.bukkit.entity.Egg; import org.bukkit.entity.MobType; import org.bukkit.entity.Player; -import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.entity.EntityDamageByProjectileEvent; @@ -30,18 +29,12 @@ public class EntityEgg extends Entity { public EntityEgg(World world) { super(world); this.a(0.25F, 0.25F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftEgg(server, this); - // CraftBukkit end } protected void a() {} public EntityEgg(World world, EntityLiving entityliving) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.ak = entityliving; this.a(0.25F, 0.25F); this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); @@ -59,8 +52,7 @@ public class EntityEgg extends Entity { } public EntityEgg(World world, double d0, double d1, double d2) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.al = 0; this.a(0.25F, 0.25F); this.a(d0, d1, d2); diff --git a/src/main/java/net/minecraft/server/EntityFallingSand.java b/src/main/java/net/minecraft/server/EntityFallingSand.java deleted file mode 100644 index 250dcf5e..00000000 --- a/src/main/java/net/minecraft/server/EntityFallingSand.java +++ /dev/null @@ -1,88 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftFallingSand; -// CraftBukkit end - -public class EntityFallingSand extends Entity { - - public int a; - public int b = 0; - - public EntityFallingSand(World world) { - super(world); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftFallingSand(server, this); - // CraftBukkit end - } - - public EntityFallingSand(World world, double d0, double d1, double d2, int i) { - this(world); // CraftBukkit super->this so we assign the entity - - this.a = i; - this.i = true; - this.a(0.98F, 0.98F); - this.height = this.width / 2.0F; - this.a(d0, d1, d2); - this.motX = 0.0D; - this.motY = 0.0D; - this.motZ = 0.0D; - this.M = false; - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; - } - - protected void a() {} - - public boolean c_() { - return !this.dead; - } - - public void b_() { - if (this.a == 0) { - this.q(); - } else { - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; - ++this.b; - this.motY -= 0.03999999910593033D; - this.c(this.motX, this.motY, this.motZ); - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; - int i = MathHelper.b(this.locX); - int j = MathHelper.b(this.locY); - int k = MathHelper.b(this.locZ); - - if (this.world.getTypeId(i, j, k) == this.a) { - this.world.e(i, j, k, 0); - } - - if (this.onGround) { - this.motX *= 0.699999988079071D; - this.motZ *= 0.699999988079071D; - this.motY *= -0.5D; - this.q(); - if ((!this.world.a(this.a, i, j, k, true) || !this.world.e(i, j, k, this.a)) && !this.world.isStatic) { - this.a(this.a, 1); - } - } else if (this.b > 100 && !this.world.isStatic) { - this.a(this.a, 1); - this.q(); - } - } - } - - protected void a(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Tile", (byte) this.a); - } - - protected void b(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.b("Tile") & 255; - } -} diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 4785270b..029a0a95 100644..100755 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -3,7 +3,6 @@ package net.minecraft.server; import java.util.List; // CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftFireball; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -28,18 +27,12 @@ public class EntityFireball extends Entity { public EntityFireball(World world) { super(world); this.a(1.0F, 1.0F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftFireball(server, this); - // CraftBukkit end } protected void a() {} public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.an = entityliving; this.a(1.0F, 1.0F); this.c(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java index a654b0a5..d69e50ed 100644..100755 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -3,7 +3,6 @@ package net.minecraft.server; import java.util.List; // CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftFish; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -33,18 +32,12 @@ public class EntityFish extends Entity { public EntityFish(World world) { super(world); this.a(0.25F, 0.25F); - - //CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftFish(server, this); - //CraftBukkit end } protected void a() {} public EntityFish(World world, EntityHuman entityhuman) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.b = entityhuman; this.b.hookedFish = this; this.a(0.25F, 0.25F); diff --git a/src/main/java/net/minecraft/server/EntityFlying.java b/src/main/java/net/minecraft/server/EntityFlying.java deleted file mode 100644 index faa58552..00000000 --- a/src/main/java/net/minecraft/server/EntityFlying.java +++ /dev/null @@ -1,81 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftFlying; -// CraftBukkit end - -public class EntityFlying extends EntityLiving { - - public EntityFlying(World world) { - super(world); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftFlying(server, this); - // CraftBukkit end - } - - protected void a(float f) {} - - public void c(float f, float f1) { - if (this.v()) { - this.a(f, f1, 0.02F); - this.c(this.motX, this.motY, this.motZ); - this.motX *= 0.800000011920929D; - this.motY *= 0.800000011920929D; - this.motZ *= 0.800000011920929D; - } else if (this.x()) { - this.a(f, f1, 0.02F); - this.c(this.motX, this.motY, this.motZ); - this.motX *= 0.5D; - this.motY *= 0.5D; - this.motZ *= 0.5D; - } else { - float f2 = 0.91F; - - if (this.onGround) { - f2 = 0.54600006F; - int i = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ)); - - if (i > 0) { - f2 = Block.byId[i].frictionFactor * 0.91F; - } - } - - float f3 = 0.16277136F / (f2 * f2 * f2); - - this.a(f, f1, this.onGround ? 0.1F * f3 : 0.02F); - f2 = 0.91F; - if (this.onGround) { - f2 = 0.54600006F; - int j = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ)); - - if (j > 0) { - f2 = Block.byId[j].frictionFactor * 0.91F; - } - } - - this.c(this.motX, this.motY, this.motZ); - this.motX *= (double) f2; - this.motY *= (double) f2; - this.motZ *= (double) f2; - } - - this.bl = this.bm; - double d0 = this.locX - this.lastX; - double d1 = this.locZ - this.lastZ; - float f4 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F; - - if (f4 > 1.0F) { - f4 = 1.0F; - } - - this.bm += (f4 - this.bm) * 0.4F; - this.bn += this.bm; - } - - public boolean m() { - return false; - } -} diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java deleted file mode 100644 index e62bcab3..00000000 --- a/src/main/java/net/minecraft/server/EntityGhast.java +++ /dev/null @@ -1,154 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftGhast; -// CraftBukkit end - -public class EntityGhast extends EntityFlying implements IMonster { - - public int a = 0; - public double b; - public double c; - public double d; - private Entity ak = null; - private int al = 0; - public int e = 0; - public int f = 0; - - public EntityGhast(World world) { - super(world); - this.texture = "/mob/ghast.png"; - this.a(4.0F, 4.0F); - this.ae = true; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftGhast(server, this); - // CraftBukkit end - } - - protected void d() { - if (this.world.k == 0) { - this.q(); - } - - this.e = this.f; - double d0 = this.b - this.locX; - double d1 = this.c - this.locY; - double d2 = this.d - this.locZ; - double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); - - if (d3 < 1.0D || d3 > 60.0D) { - this.b = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.c = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.d = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); - } - - if (this.a-- <= 0) { - this.a += this.random.nextInt(5) + 2; - if (this.a(this.b, this.c, this.d, d3)) { - this.motX += d0 / d3 * 0.1D; - this.motY += d1 / d3 * 0.1D; - this.motZ += d2 / d3 * 0.1D; - } else { - this.b = this.locX; - this.c = this.locY; - this.d = this.locZ; - } - } - - if (this.ak != null && this.ak.dead) { - this.ak = null; - } - - if (this.ak == null || this.al-- <= 0) { - this.ak = this.world.a(this, 100.0D); - if (this.ak != null) { - this.al = 20; - } - } - - double d4 = 64.0D; - - if (this.ak != null && this.ak.b((Entity) this) < d4 * d4) { - double d5 = this.ak.locX - this.locX; - double d6 = this.ak.boundingBox.b + (double) (this.ak.width / 2.0F) - (this.locY + (double) (this.width / 2.0F)); - double d7 = this.ak.locZ - this.locZ; - - this.aI = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; - if (this.i(this.ak)) { - if (this.f == 10) { - this.world.a(this, "mob.ghast.charge", this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - } - - ++this.f; - if (this.f == 20) { - this.world.a(this, "mob.ghast.fireball", this.i(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7); - double d8 = 4.0D; - Vec3D vec3d = this.c(1.0F); - - entityfireball.locX = this.locX + vec3d.a * d8; - entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D; - entityfireball.locZ = this.locZ + vec3d.c * d8; - this.world.a((Entity) entityfireball); - this.f = -40; - } - } else if (this.f > 0) { - --this.f; - } - } else { - this.aI = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F; - if (this.f > 0) { - --this.f; - } - } - - this.texture = this.f > 10 ? "/mob/ghast_fire.png" : "/mob/ghast.png"; - } - - private boolean a(double d0, double d1, double d2, double d3) { - double d4 = (this.b - this.locX) / d3; - double d5 = (this.c - this.locY) / d3; - double d6 = (this.d - this.locZ) / d3; - AxisAlignedBB axisalignedbb = this.boundingBox.b(); - - for (int i = 1; (double) i < d3; ++i) { - axisalignedbb.d(d4, d5, d6); - if (this.world.a((Entity) this, axisalignedbb).size() > 0) { - return false; - } - } - - return true; - } - - protected String e() { - return "mob.ghast.moan"; - } - - protected String f() { - return "mob.ghast.scream"; - } - - protected String g() { - return "mob.ghast.death"; - } - - protected int h() { - return Item.SULPHUR.id; - } - - protected float i() { - return 10.0F; - } - - public boolean b() { - return this.random.nextInt(20) == 0 && super.b() && this.world.k > 0; - } - - public int j() { - return 1; - } -} diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java deleted file mode 100644 index 5eaf8730..00000000 --- a/src/main/java/net/minecraft/server/EntityGiantZombie.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftGiant; -// CraftBukkit stop - -public class EntityGiantZombie extends EntityMonster { - - public EntityGiantZombie(World world) { - super(world); - this.texture = "/mob/zombie.png"; - this.bC = 0.5F; - this.c = 50; - this.health *= 10; - this.height *= 6.0F; - this.a(this.length * 6.0F, this.width * 6.0F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftGiant(server, this); - // CraftBukkit end - } - - protected float a(int i, int j, int k) { - return this.world.l(i, j, k) - 0.5F; - } -} diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 7988a32b..a72c046f 100644..100755 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -3,7 +3,6 @@ package net.minecraft.server; import java.util.List; // CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftHumanEntity; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -43,11 +42,6 @@ public abstract class EntityHuman extends EntityLiving { this.aR = 180.0F; this.maxFireTicks = 20; this.texture = "/mob/char.png"; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftHumanEntity(server, this); - // CraftBukkit end } public void b_() { diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java deleted file mode 100644 index 47f33ee2..00000000 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ /dev/null @@ -1,208 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftItem; -// CraftBukkit end - -public class EntityItem extends Entity { - - public ItemStack a; - private int e; - public int b = 0; - public int c; - private int f = 5; - public float d = (float) (Math.random() * 3.141592653589793D * 2.0D); - - public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) { - super(world); - this.a(0.25F, 0.25F); - this.height = this.width / 2.0F; - this.a(d0, d1, d2); - this.a = itemstack; - this.yaw = (float) (Math.random() * 360.0D); - this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); - this.motY = 0.20000000298023224D; - this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); - this.M = false; - } - - public EntityItem(World world) { - super(world); - this.a(0.25F, 0.25F); - this.height = this.width / 2.0F; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftItem(server, this); - // CraftBukkit end - } - - protected void a() {} - - public void b_() { - super.b_(); - if (this.c > 0) { - --this.c; - } - - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; - this.motY -= 0.03999999910593033D; - if (this.world.getMaterial(MathHelper.b(this.locX), MathHelper.b(this.locY), MathHelper.b(this.locZ)) == Material.LAVA) { - this.motY = 0.20000000298023224D; - this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F); - this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F); - this.world.a(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F); - } - - this.g(this.locX, this.locY, this.locZ); - this.c(this.motX, this.motY, this.motZ); - float f = 0.98F; - - if (this.onGround) { - f = 0.58800006F; - int i = this.world.getTypeId(MathHelper.b(this.locX), MathHelper.b(this.boundingBox.b) - 1, MathHelper.b(this.locZ)); - - if (i > 0) { - f = Block.byId[i].frictionFactor * 0.98F; - } - } - - this.motX *= (double) f; - this.motY *= 0.9800000190734863D; - this.motZ *= (double) f; - if (this.onGround) { - this.motY *= -0.5D; - } - - ++this.e; - ++this.b; - if (this.b >= 6000) { - this.q(); - } - } - - public boolean v() { - return this.world.a(this.boundingBox, Material.WATER, this); - } - - private boolean g(double d0, double d1, double d2) { - int i = MathHelper.b(d0); - int j = MathHelper.b(d1); - int k = MathHelper.b(d2); - double d3 = d0 - (double) i; - double d4 = d1 - (double) j; - double d5 = d2 - (double) k; - - if (Block.o[this.world.getTypeId(i, j, k)]) { - boolean flag = !Block.o[this.world.getTypeId(i - 1, j, k)]; - boolean flag1 = !Block.o[this.world.getTypeId(i + 1, j, k)]; - boolean flag2 = !Block.o[this.world.getTypeId(i, j - 1, k)]; - boolean flag3 = !Block.o[this.world.getTypeId(i, j + 1, k)]; - boolean flag4 = !Block.o[this.world.getTypeId(i, j, k - 1)]; - boolean flag5 = !Block.o[this.world.getTypeId(i, j, k + 1)]; - byte b0 = -1; - double d6 = 9999.0D; - - if (flag && d3 < d6) { - d6 = d3; - b0 = 0; - } - - if (flag1 && 1.0D - d3 < d6) { - d6 = 1.0D - d3; - b0 = 1; - } - - if (flag2 && d4 < d6) { - d6 = d4; - b0 = 2; - } - - if (flag3 && 1.0D - d4 < d6) { - d6 = 1.0D - d4; - b0 = 3; - } - - if (flag4 && d5 < d6) { - d6 = d5; - b0 = 4; - } - - if (flag5 && 1.0D - d5 < d6) { - d6 = 1.0D - d5; - b0 = 5; - } - - float f = this.random.nextFloat() * 0.2F + 0.1F; - - if (b0 == 0) { - this.motX = (double) (-f); - } - - if (b0 == 1) { - this.motX = (double) f; - } - - if (b0 == 2) { - this.motY = (double) (-f); - } - - if (b0 == 3) { - this.motY = (double) f; - } - - if (b0 == 4) { - this.motZ = (double) (-f); - } - - if (b0 == 5) { - this.motZ = (double) f; - } - } - - return false; - } - - protected void b(int i) { - this.a((Entity) null, i); - } - - public boolean a(Entity entity, int i) { - this.y(); - this.f -= i; - if (this.f <= 0) { - this.q(); - } - - return false; - } - - public void a(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Health", (short) ((byte) this.f)); - nbttagcompound.a("Age", (short) this.b); - nbttagcompound.a("Item", this.a.a(new NBTTagCompound())); - } - - public void b(NBTTagCompound nbttagcompound) { - this.f = nbttagcompound.c("Health") & 255; - this.b = nbttagcompound.c("Age"); - NBTTagCompound nbttagcompound1 = nbttagcompound.j("Item"); - - this.a = new ItemStack(nbttagcompound1); - } - - public void b(EntityHuman entityhuman) { - if (!this.world.isStatic) { - int i = this.a.count; - - if (this.c == 0 && entityhuman.inventory.a(this.a)) { - this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); - entityhuman.c(this, i); - this.q(); - } - } - } -} diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 6f344290..e8f7f36d 100644..100755 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -4,7 +4,6 @@ import java.util.List; // CraftBukkit start import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; // CraftBukkit end @@ -73,11 +72,6 @@ public abstract class EntityLiving extends Entity { this.aG = (float) Math.random() * 12398.0F; this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D); this.S = 0.5F; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftLivingEntity(server, this); - // CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index ea511fca..8d22b917 100644..100755 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -1,7 +1,6 @@ package net.minecraft.server; // CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftMonster; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftEntity; @@ -19,11 +18,6 @@ public class EntityMonster extends EntityCreature implements IMonster { public EntityMonster(World world) { super(world); this.health = 20; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftMonster(server, this); - // CraftBukkit end } public void o() { diff --git a/src/main/java/net/minecraft/server/EntityPainting.java b/src/main/java/net/minecraft/server/EntityPainting.java deleted file mode 100644 index 33a78e9c..00000000 --- a/src/main/java/net/minecraft/server/EntityPainting.java +++ /dev/null @@ -1,238 +0,0 @@ -package net.minecraft.server; - -import java.util.ArrayList; -import java.util.List; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftPainting; -// CraftBukkit end - -public class EntityPainting extends Entity { - - private int f; - public int a; - public int b; - public int c; - public int d; - public EnumArt e; - - public EntityPainting(World world) { - super(world); - this.f = 0; - this.a = 0; - this.height = 0.0F; - this.a(0.5F, 0.5F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftPainting(server, this); - // CraftBukkit end - } - - public EntityPainting(World world, int i, int j, int k, int l) { - this(world); - this.b = i; - this.c = j; - this.d = k; - ArrayList arraylist = new ArrayList(); - EnumArt[] aenumart = EnumArt.values(); - int i1 = aenumart.length; - - for (int j1 = 0; j1 < i1; ++j1) { - EnumArt enumart = aenumart[j1]; - - this.e = enumart; - this.a(l); - if (this.d()) { - arraylist.add(enumart); - } - } - - if (arraylist.size() > 0) { - this.e = (EnumArt) arraylist.get(this.random.nextInt(arraylist.size())); - } - - this.a(l); - } - - protected void a() {} - - public void a(int i) { - this.a = i; - this.lastYaw = this.yaw = (float) (i * 90); - float f = (float) this.e.A; - float f1 = (float) this.e.B; - float f2 = (float) this.e.A; - - if (i != 0 && i != 2) { - f = 0.5F; - } else { - f2 = 0.5F; - } - - f /= 32.0F; - f1 /= 32.0F; - f2 /= 32.0F; - float f3 = (float) this.b + 0.5F; - float f4 = (float) this.c + 0.5F; - float f5 = (float) this.d + 0.5F; - float f6 = 0.5625F; - - if (i == 0) { - f5 -= f6; - } - - if (i == 1) { - f3 -= f6; - } - - if (i == 2) { - f5 += f6; - } - - if (i == 3) { - f3 += f6; - } - - if (i == 0) { - f3 -= this.d(this.e.A); - } - - if (i == 1) { - f5 += this.d(this.e.A); - } - - if (i == 2) { - f3 += this.d(this.e.A); - } - - if (i == 3) { - f5 -= this.d(this.e.A); - } - - f4 += this.d(this.e.B); - this.a((double) f3, (double) f4, (double) f5); - float f7 = -0.00625F; - - this.boundingBox.c((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7)); - } - - private float d(int i) { - return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F); - } - - public void b_() { - if (this.f++ == 100 && !this.world.isStatic) { - this.f = 0; - if (!this.d()) { - this.q(); - this.world.a((Entity) (new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)))); - } - } - } - - public boolean d() { - if (this.world.a((Entity) this, this.boundingBox).size() > 0) { - return false; - } else { - int i = this.e.A / 16; - int j = this.e.B / 16; - int k = this.b; - int l = this.c; - int i1 = this.d; - - if (this.a == 0) { - k = MathHelper.b(this.locX - (double) ((float) this.e.A / 32.0F)); - } - - if (this.a == 1) { - i1 = MathHelper.b(this.locZ - (double) ((float) this.e.A / 32.0F)); - } - - if (this.a == 2) { - k = MathHelper.b(this.locX - (double) ((float) this.e.A / 32.0F)); - } - - if (this.a == 3) { - i1 = MathHelper.b(this.locZ - (double) ((float) this.e.A / 32.0F)); - } - - l = MathHelper.b(this.locY - (double) ((float) this.e.B / 32.0F)); - - int j1; - - for (int k1 = 0; k1 < i; ++k1) { - for (j1 = 0; j1 < j; ++j1) { - Material material; - - if (this.a != 0 && this.a != 2) { - material = this.world.getMaterial(this.b, l + j1, i1 + k1); - } else { - material = this.world.getMaterial(k + k1, l + j1, this.d); - } - - if (!material.isBuildable()) { - return false; - } - } - } - - List list = this.world.b((Entity) this, this.boundingBox); - - for (j1 = 0; j1 < list.size(); ++j1) { - if (list.get(j1) instanceof EntityPainting) { - return false; - } - } - - return true; - } - } - - public boolean c_() { - return true; - } - - public boolean a(Entity entity, int i) { - if (!this.dead && !this.world.isStatic) { - this.q(); - this.y(); - this.world.a((Entity) (new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)))); - } - - return true; - } - - public void a(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Dir", (byte) this.a); - nbttagcompound.a("Motive", this.e.z); - nbttagcompound.a("TileX", this.b); - nbttagcompound.a("TileY", this.c); - nbttagcompound.a("TileZ", this.d); - } - - public void b(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.b("Dir"); - this.b = nbttagcompound.d("TileX"); - this.c = nbttagcompound.d("TileY"); - this.d = nbttagcompound.d("TileZ"); - String s = nbttagcompound.h("Motive"); - EnumArt[] aenumart = EnumArt.values(); - int i = aenumart.length; - - for (int j = 0; j < i; ++j) { - EnumArt enumart = aenumart[j]; - - if (enumart.z.equals(s)) { - this.e = enumart; - } - } - - if (this.e == null) { - this.e = EnumArt.KEBAB; - } - - this.a(this.a); - } -} diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java deleted file mode 100644 index 5f85d83b..00000000 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftPig; -// CraftBukkit end - -public class EntityPig extends EntityAnimal { - - public EntityPig(World world) { - super(world); - this.texture = "/mob/pig.png"; - this.a(0.9F, 0.9F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftPig(server, this); - // CraftBukkit end - } - - protected void a() { - this.datawatcher.a(16, Byte.valueOf((byte) 0)); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - nbttagcompound.a("Saddle", this.K()); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - this.a(nbttagcompound.l("Saddle")); - } - - protected String e() { - return "mob.pig"; - } - - protected String f() { - return "mob.pig"; - } - - protected String g() { - return "mob.pigdeath"; - } - - public boolean a(EntityHuman entityhuman) { - if (this.K() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) { - entityhuman.e(this); - return true; - } else { - return false; - } - } - - protected int h() { - return Item.PORK.id; - } - - public boolean K() { - return (this.datawatcher.a(16) & 1) != 0; - } - - public void a(boolean flag) { - if (flag) { - this.datawatcher.b(16, Byte.valueOf((byte) 1)); - } else { - this.datawatcher.b(16, Byte.valueOf((byte) 0)); - } - } -} diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 39b80214..e1b17a8e 100644..100755 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -5,7 +5,6 @@ import java.util.List; // CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftPigZombie; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent.TargetReason; // CraftBukkit end @@ -22,11 +21,6 @@ public class EntityPigZombie extends EntityZombie { this.bC = 0.5F; this.c = 5; this.ae = true; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftPigZombie(server, this); - // CraftBukkit end } public void b_() { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index cb259c9a..b0256067 100644..100755 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -5,11 +5,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftPlayer; -// CraftBukkit end - public class EntityPlayer extends EntityHuman implements ICrafting { public NetServerHandler a; @@ -45,11 +40,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.name = s; this.c = iteminworldmanager; this.height = 0.0F; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftPlayer(server, this); - // CraftBukkit end } public void l() { diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java deleted file mode 100644 index 987ed311..00000000 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.minecraft.server; - -import java.util.Random; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftSheep; -// CraftBukkit end - -public class EntitySheep extends EntityAnimal { - - public static final float[][] a = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}}; - - public EntitySheep(World world) { - super(world); - this.texture = "/mob/sheep.png"; - this.a(0.9F, 1.3F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftSheep(server, this); - // CraftBukkit end - } - - protected void a() { - super.a(); - this.datawatcher.a(16, new Byte((byte) 0)); - } - - public boolean a(Entity entity, int i) { - if (!this.world.isStatic && !this.f_() && entity instanceof EntityLiving) { - this.a(true); - int j = 1 + this.random.nextInt(3); - - for (int k = 0; k < j; ++k) { - EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.e_()), 1.0F); - - entityitem.motY += (double) (this.random.nextFloat() * 0.05F); - entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F); - entityitem.motZ += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F); - } - } - - return super.a(entity, i); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - nbttagcompound.a("Sheared", this.f_()); - nbttagcompound.a("Color", (byte) this.e_()); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - this.a(nbttagcompound.l("Sheared")); - this.a(nbttagcompound.b("Color")); - } - - protected String e() { - return "mob.sheep"; - } - - protected String f() { - return "mob.sheep"; - } - - protected String g() { - return "mob.sheep"; - } - - public int e_() { - return this.datawatcher.a(16) & 15; - } - - public void a(int i) { - byte b0 = this.datawatcher.a(16); - - this.datawatcher.b(16, Byte.valueOf((byte) (b0 & 240 | i & 15))); - } - - public boolean f_() { - return (this.datawatcher.a(16) & 16) != 0; - } - - public void a(boolean flag) { - byte b0 = this.datawatcher.a(16); - - if (flag) { - this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 16))); - } else { - this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -17))); - } - } - - public static int a(Random random) { - int i = random.nextInt(100); - - return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : 0)); - } -} diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 6387dc72..827c40c2 100644..100755 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -1,7 +1,6 @@ package net.minecraft.server; // CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftSkeleton; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.entity.EntityCombustEvent; @@ -14,11 +13,6 @@ public class EntitySkeleton extends EntityMonster { public EntitySkeleton(World world) { super(world); this.texture = "/mob/skeleton.png"; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftSkeleton(server, this); - // CraftBukkit end } protected String e() { diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java deleted file mode 100644 index c2ad891b..00000000 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ /dev/null @@ -1,144 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftSlime; -// CraftBukkit stop - -public class EntitySlime extends EntityLiving implements IMonster { - - public float a; - public float b; - private int d = 0; - public int c = 1; - - public EntitySlime(World world) { - super(world); - this.texture = "/mob/slime.png"; - this.c = 1 << this.random.nextInt(3); - this.height = 0.0F; - this.d = this.random.nextInt(20) + 10; - this.a(this.c); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftSlime(server, this); - // CraftBukkit end - } - - public void a(int i) { - this.c = i; - this.a(0.6F * (float) i, 0.6F * (float) i); - this.health = i * i; - this.a(this.locX, this.locY, this.locZ); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - nbttagcompound.a("Size", this.c - 1); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - this.c = nbttagcompound.d("Size") + 1; - } - - public void b_() { - this.b = this.a; - boolean flag = this.onGround; - - super.b_(); - if (this.onGround && !flag) { - for (int i = 0; i < this.c * 8; ++i) { - float f = this.random.nextFloat() * 3.1415927F * 2.0F; - float f1 = this.random.nextFloat() * 0.5F + 0.5F; - float f2 = MathHelper.a(f) * (float) this.c * 0.5F * f1; - float f3 = MathHelper.b(f) * (float) this.c * 0.5F * f1; - - this.world.a("slime", this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D); - } - - if (this.c > 2) { - this.world.a(this, "mob.slime", this.i(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); - } - - this.a = -0.5F; - } - - this.a *= 0.6F; - } - - protected void d() { - EntityHuman entityhuman = this.world.a(this, 16.0D); - - if (entityhuman != null) { - this.b(entityhuman, 10.0F); - } - - if (this.onGround && this.d-- <= 0) { - this.d = this.random.nextInt(20) + 10; - if (entityhuman != null) { - this.d /= 3; - } - - this.bA = true; - if (this.c > 1) { - this.world.a(this, "mob.slime", this.i(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F); - } - - this.a = 1.0F; - this.bx = 1.0F - this.random.nextFloat() * 2.0F; - this.by = (float) (1 * this.c); - } else { - this.bA = false; - if (this.onGround) { - this.bx = this.by = 0.0F; - } - } - } - - public void q() { - if (this.c > 1 && this.health == 0) { - for (int i = 0; i < 4; ++i) { - float f = ((float) (i % 2) - 0.5F) * (float) this.c / 4.0F; - float f1 = ((float) (i / 2) - 0.5F) * (float) this.c / 4.0F; - EntitySlime entityslime = new EntitySlime(this.world); - - entityslime.a(this.c / 2); - entityslime.c(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F); - this.world.a((Entity) entityslime); - } - } - - super.q(); - } - - public void b(EntityHuman entityhuman) { - // CraftBukkit - add cast to Entity VVVVVVVV - if (this.c > 1 && this.i(entityhuman) && (double) this.a((Entity) entityhuman) < 0.6D * (double) this.c && entityhuman.a(this, this.c)) { - this.world.a(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); - } - } - - protected String f() { - return "mob.slime"; - } - - protected String g() { - return "mob.slime"; - } - - protected int h() { - return this.c == 1 ? Item.SLIME_BALL.id : 0; - } - - public boolean b() { - Chunk chunk = this.world.b(MathHelper.b(this.locX), MathHelper.b(this.locZ)); - - return (this.c == 1 || this.world.k > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 16.0D; - } - - protected float i() { - return 0.6F; - } -} diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index 7567fd0e..c47b5981 100644..100755 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -4,7 +4,6 @@ import java.util.List; // CraftBukkit start import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftSnowball; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -25,18 +24,12 @@ public class EntitySnowball extends Entity { public EntitySnowball(World world) { super(world); this.a(0.25F, 0.25F); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftSnowball(server, this); - // CraftBukkit end } protected void a() {} public EntitySnowball(World world, EntityLiving entityliving) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.ak = entityliving; this.a(0.25F, 0.25F); this.c(entityliving.locX, entityliving.locY + (double) entityliving.w(), entityliving.locZ, entityliving.yaw, entityliving.pitch); @@ -54,8 +47,7 @@ public class EntitySnowball extends Entity { } public EntitySnowball(World world, double d0, double d1, double d2) { - this(world); // CraftBukkit super->this so we assign the entity - + super(world); this.al = 0; this.a(0.25F, 0.25F); this.a(d0, d1, d2); diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java index 02c81814..55769857 100644..100755 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -3,7 +3,6 @@ package net.minecraft.server; // CraftBukkit start import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftSpider; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent.TargetReason; // CraftBukkit stop @@ -15,11 +14,6 @@ public class EntitySpider extends EntityMonster { this.texture = "/mob/spider.png"; this.a(1.4F, 0.9F); this.bC = 0.8F; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftSpider(server, this); - // CraftBukkit end } public double k() { diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java deleted file mode 100644 index a13757c6..00000000 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ /dev/null @@ -1,157 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftSquid; -// CraftBukkit stop - -public class EntitySquid extends EntityWaterAnimal { - - public float a = 0.0F; - public float b = 0.0F; - public float c = 0.0F; - public float f = 0.0F; - public float ak = 0.0F; - public float al = 0.0F; - public float am = 0.0F; - public float an = 0.0F; - private float ao = 0.0F; - private float ap = 0.0F; - private float aq = 0.0F; - private float ar = 0.0F; - private float as = 0.0F; - private float at = 0.0F; - - public EntitySquid(World world) { - super(world); - this.texture = "/mob/squid.png"; - this.a(0.95F, 0.95F); - this.ap = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftSquid(server, this); - // CraftBukkit end - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - } - - protected String e() { - return null; - } - - protected String f() { - return null; - } - - protected String g() { - return null; - } - - protected float i() { - return 0.4F; - } - - protected int h() { - return 0; - } - - protected void g_() { - int i = this.random.nextInt(3) + 1; - - for (int j = 0; j < i; ++j) { - this.a(new ItemStack(Item.INK_SACK, 1, 0), 0.0F); - } - } - - public boolean a(EntityHuman entityhuman) { - ItemStack itemstack = entityhuman.inventory.e(); - - if (itemstack != null && itemstack.id == Item.BUCKET.id) { - entityhuman.inventory.a(entityhuman.inventory.c, new ItemStack(Item.MILK_BUCKET)); - return true; - } else { - return false; - } - } - - public boolean v() { - return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this); - } - - public void o() { - super.o(); - this.b = this.a; - this.f = this.c; - this.al = this.ak; - this.an = this.am; - this.ak += this.ap; - if (this.ak > 6.2831855F) { - this.ak -= 6.2831855F; - if (this.random.nextInt(10) == 0) { - this.ap = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; - } - } - - if (this.v()) { - float f; - - if (this.ak < 3.1415927F) { - f = this.ak / 3.1415927F; - this.am = MathHelper.a(f * f * 3.1415927F) * 3.1415927F * 0.25F; - if ((double) f > 0.75D) { - this.ao = 1.0F; - this.aq = 1.0F; - } else { - this.aq *= 0.8F; - } - } else { - this.am = 0.0F; - this.ao *= 0.9F; - this.aq *= 0.99F; - } - - if (!this.aW) { - this.motX = (double) (this.ar * this.ao); - this.motY = (double) (this.as * this.ao); - this.motZ = (double) (this.at * this.ao); - } - - f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); - this.aI += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aI) * 0.1F; - this.yaw = this.aI; - this.c += 3.1415927F * this.aq * 1.5F; - this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F; - } else { - this.am = MathHelper.e(MathHelper.a(this.ak)) * 3.1415927F * 0.25F; - if (!this.aW) { - this.motX = 0.0D; - this.motY -= 0.08D; - this.motY *= 0.9800000190734863D; - this.motZ = 0.0D; - } - - this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D); - } - } - - public void c(float f, float f1) { - this.c(this.motX, this.motY, this.motZ); - } - - protected void d() { - if (this.random.nextInt(50) == 0 || !this.ab || this.ar == 0.0F && this.as == 0.0F && this.at == 0.0F) { - float f = this.random.nextFloat() * 3.1415927F * 2.0F; - - this.ar = MathHelper.b(f) * 0.2F; - this.as = -0.1F + this.random.nextFloat() * 0.2F; - this.at = MathHelper.a(f) * 0.2F; - } - } -} diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java deleted file mode 100644 index fc85674c..00000000 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftTNTPrimed; -// CraftBukkit stop - -public class EntityTNTPrimed extends Entity { - - public int a; - - public EntityTNTPrimed(World world) { - super(world); - this.a = 0; - this.i = true; - this.a(0.98F, 0.98F); - this.height = this.width / 2.0F; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftTNTPrimed(server, this); - // CraftBukkit end - } - - public EntityTNTPrimed(World world, double d0, double d1, double d2) { - this(world); - this.a(d0, d1, d2); - float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); - - this.motX = (double) (-MathHelper.a(f * 3.1415927F / 180.0F) * 0.02F); - this.motY = 0.20000000298023224D; - this.motZ = (double) (-MathHelper.b(f * 3.1415927F / 180.0F) * 0.02F); - this.M = false; - this.a = 80; - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; - } - - protected void a() {} - - public boolean c_() { - return !this.dead; - } - - public void b_() { - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; - this.motY -= 0.03999999910593033D; - this.c(this.motX, this.motY, this.motZ); - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; - if (this.onGround) { - this.motX *= 0.699999988079071D; - this.motZ *= 0.699999988079071D; - this.motY *= -0.5D; - } - - if (this.a-- <= 0) { - this.q(); - this.d(); - } else { - this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); - } - } - - private void d() { - float f = 4.0F; - - this.world.a((Entity) null, this.locX, this.locY, this.locZ, f); - } - - protected void a(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Fuse", (byte) this.a); - } - - protected void b(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.b("Fuse"); - } -} diff --git a/src/main/java/net/minecraft/server/EntityWaterAnimal.java b/src/main/java/net/minecraft/server/EntityWaterAnimal.java deleted file mode 100644 index cf9c3bfa..00000000 --- a/src/main/java/net/minecraft/server/EntityWaterAnimal.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.minecraft.server; - -// CraftBukkit start -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftWaterMob; -// CraftBukkit stop - -public class EntityWaterAnimal extends EntityCreature implements IAnimal { - - public EntityWaterAnimal(World world) { - super(world); - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftWaterMob(server, this); - // CraftBukkit end - } - - public boolean d_() { - return true; - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - } - - public boolean b() { - return this.world.a(this.boundingBox); - } - - public int c() { - return 120; - } -} diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 3a9fad59..0cf3b675 100644..100755 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -1,7 +1,6 @@ package net.minecraft.server; // CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftZombie; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.entity.EntityCombustEvent; @@ -14,11 +13,6 @@ public class EntityZombie extends EntityMonster { this.texture = "/mob/zombie.png"; this.bC = 0.5F; this.c = 5; - - // CraftBukkit start - CraftServer server = ((WorldServer) this.world).getServer(); - this.bukkitEntity = new CraftZombie(server, this); - // CraftBukkit end } public void o() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 47bc40e0..caac43cc 100644..100755 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1,6 +1,6 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; +import net.minecraft.server.*; import net.minecraft.server.WorldServer; import org.bukkit.Location; import org.bukkit.World; @@ -16,6 +16,76 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { this.entity = entity; } + public static CraftEntity getEntity( CraftServer server, Entity entity) { + /** + * Order is *EXTREMELY* important -- keep it right! =D + */ + if (entity instanceof EntityLiving) { + // Players + if (entity instanceof EntityHuman) { + if (entity instanceof EntityPlayer) { return new CraftPlayer( server, (EntityPlayer) entity); } + else { return new CraftHumanEntity( server, (EntityHuman) entity); } + } + else if (entity instanceof EntityCreature) { + // Animals + if (entity instanceof EntityAnimal) { + if (entity instanceof EntityChicken) { return new CraftChicken( server, (EntityChicken) entity); } + else if (entity instanceof EntityCow) { return new CraftCow( server, (EntityCow) entity); } + else if (entity instanceof EntityPig) { return new CraftPig( server, (EntityPig) entity); } + else if (entity instanceof EntitySheep) { return new CraftSheep( server, (EntitySheep) entity); } + else { return new CraftAnimals( server, (EntityAnimal) entity); } + } + // Monsters + else if (entity instanceof EntityMonster) { + if (entity instanceof EntityZombie) { + if (entity instanceof EntityPigZombie) { return new CraftPigZombie( server, (EntityPigZombie) entity); } + else { return new CraftZombie( server, (EntityZombie) entity); } + } + else if (entity instanceof EntityCreeper) { return new CraftCreeper( server, (EntityCreeper) entity); } + else if (entity instanceof EntityGiantZombie) { return new CraftGiant( server, (EntityGiantZombie) entity); } + else if (entity instanceof EntitySkeleton) { return new CraftSkeleton( server, (EntitySkeleton) entity); } + else if (entity instanceof EntitySpider) { return new CraftSpider( server, (EntitySpider) entity); } + else if (entity instanceof EntitySlime) { return new CraftSlime( server, (EntitySlime) entity); } + + else { return new CraftMonster( server, (EntityMonster) entity); } + } + // Water Animals + else if (entity instanceof EntityWaterAnimal) { + if (entity instanceof EntitySquid) { return new CraftSquid( server, (EntitySquid) entity); } + else { return new CraftWaterMob( server, (EntityWaterAnimal) entity); } + } + else { return new CraftCreature( server, (EntityCreature) entity); } + } + // Flying + else if (entity instanceof EntityFlying) { + if (entity instanceof EntityGhast) { return new CraftGhast( server, (EntityGhast) entity); } + else { return new CraftFlying( server, (EntityFlying) entity); } + } + else { return new CraftLivingEntity(server, (EntityLiving) entity); } + } + else if (entity instanceof EntityArrow) { return new CraftArrow( server, (EntityArrow) entity); } + else if (entity instanceof EntityBoat) { return new CraftBoat( server, (EntityBoat) entity); } + else if (entity instanceof EntityEgg) { return new CraftEgg( server, (EntityEgg) entity); } + else if (entity instanceof EntityFallingSand) { return new CraftFallingSand( server, (EntityFallingSand) entity); } + else if (entity instanceof EntityFireball) { return new CraftFireball( server, (EntityFireball) entity); } + else if (entity instanceof EntityFish) { return new CraftFish( server, (EntityFish) entity); } + else if (entity instanceof EntityItem) { return new CraftItem( server, (EntityItem) entity); } + else if (entity instanceof EntityMinecart) { + EntityMinecart mc = (EntityMinecart) entity; + if (mc.d == CraftMinecart.Type.StorageMinecart.getId()) { + return new CraftStorageMinecart(server, mc); + } else if (mc.d == CraftMinecart.Type.PoweredMinecart.getId()) { + return new CraftPoweredMinecart(server, mc); + } else { + return new CraftMinecart(server, mc); + } + } + else if (entity instanceof EntityPainting) { return new CraftPainting( server, (EntityPainting) entity); } + else if (entity instanceof EntitySnowball) { return new CraftSnowball( server, (EntitySnowball) entity); } + else if (entity instanceof EntityTNTPrimed) { return new CraftTNTPrimed( server, (EntityTNTPrimed) entity); } + else throw new IllegalArgumentException( "Unknown entity" ); + } + public Location getLocation() { return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch); } |