diff options
author | Andrew Ardill <andrew.ardill@gmail.com> | 2011-01-17 07:03:15 +0800 |
---|---|---|
committer | Dinner Bone <dinnerbone@dinnerbone.com> | 2011-01-18 00:13:31 +0800 |
commit | 2de3e2e7e406baaaddd5c71fa283d81dacabf815 (patch) | |
tree | 64899352c4cd210a5d2edb9dec1de4c4cc4dbe79 /src/main/java/net/minecraft | |
parent | 95cb03b50e5ee99710f2a58c29ff0d140ae51f85 (diff) | |
download | craftbukkit-2de3e2e7e406baaaddd5c71fa283d81dacabf815.tar craftbukkit-2de3e2e7e406baaaddd5c71fa283d81dacabf815.tar.gz craftbukkit-2de3e2e7e406baaaddd5c71fa283d81dacabf815.tar.lz craftbukkit-2de3e2e7e406baaaddd5c71fa283d81dacabf815.tar.xz craftbukkit-2de3e2e7e406baaaddd5c71fa283d81dacabf815.zip |
created getBukkitEntity() in minecraft.server.Entity
This returns a protected field that is set in the constructor of each
minecraft.server.Entity to a new CraftEntity of some specific type.
Diffstat (limited to 'src/main/java/net/minecraft')
13 files changed, 72 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 7f8aa434..f39c29e7 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -77,6 +77,8 @@ public abstract class Entity { public int ah; public int ai; public int aj; + + protected org.bukkit.entity.Entity bukkitEntity; //CraftBukkit public Entity(World world) { g = a++; @@ -116,6 +118,8 @@ public abstract class Entity { a(0.0D, 0.0D, 0.0D); af.a(0, ((Byte.valueOf((byte) 0)))); a(); + + bukkitEntity = null; //CraftBukkit } protected abstract void a(); @@ -952,4 +956,10 @@ public abstract class Entity { af.b(0, ((Byte.valueOf((byte) (byte0 & ~(1 << i1)))))); } } + + //CraftBukkit start + public org.bukkit.entity.Entity getBukkitEntity(){ + return this.bukkitEntity; + } + //CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index e02cc6be..38260d00 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -7,9 +7,7 @@ import java.util.Random; import org.bukkit.craftbukkit.entity.CraftArrow; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; //CraftBukkit end @@ -25,7 +23,7 @@ public class EntityArrow extends Entity { public EntityLiving b; private int al; private int am; - + public EntityArrow(World world) { super(world); c = -1; @@ -36,6 +34,11 @@ public class EntityArrow extends Entity { a = 0; am = 0; a(0.5F, 0.5F); + + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftArrow(server, this); + //CraftBukkit end } public EntityArrow(World world, double d1, double d2, double d3) { diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 3c01822d..24ae4606 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -5,6 +5,7 @@ import java.util.Random; // CraftBukkit start import org.bukkit.Location; +import org.bukkit.craftbukkit.entity.CraftArrow; import org.bukkit.craftbukkit.entity.CraftBoat; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.CraftMappable; @@ -48,6 +49,10 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit M = false; handleCreation(world); // CraftBukkit + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftBoat(server, this); + //CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index ed244d26..75ebe9bb 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -5,6 +5,7 @@ import java.util.Random; // CraftBukkit start import org.bukkit.entity.MobType; +import org.bukkit.craftbukkit.entity.CraftArrow; import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity; @@ -38,6 +39,10 @@ public class EntityEgg extends Entity { a = 0; am = 0; a(0.25F, 0.25F); + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftEgg(server, this); + //CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 6623f1e1..d2b9007c 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Random; //CraftBukkit start +import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftFireball; import org.bukkit.craftbukkit.entity.CraftLivingEntity; @@ -37,6 +38,10 @@ public class EntityFireball extends Entity { a = 0; ap = 0; a(1.0F, 1.0F); + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftFireball(server, this); + //CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java index ed566928..c0aabe6d 100644 --- a/src/main/java/net/minecraft/server/EntityFish.java +++ b/src/main/java/net/minecraft/server/EntityFish.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Random; // CraftBukkit start +import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftFireball; import org.bukkit.craftbukkit.entity.CraftFish; @@ -45,6 +46,10 @@ public class EntityFish extends Entity { ao = 0; c = null; a(0.25F, 0.25F); + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftFish(server, this); + //CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 98b08dea..59cf2d51 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -5,6 +5,7 @@ import java.util.Random; // CraftBukkit start import org.bukkit.Location; +import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.CraftMappable; import org.bukkit.craftbukkit.entity.CraftMinecart; @@ -104,7 +105,6 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable private double flyingX = 0.94999998807907104; private double flyingY = 0.94999998807907104; private double flyingZ = 0.94999998807907104; - public CraftEntity getCraftEntity() { return minecart; } @@ -127,6 +127,11 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable M = false; handleCreation(world); // CraftBukkit + //CraftBukkit start + //TODO need to handle powered and storage minecarts + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftMinecart(server, this); + //CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityMobs.java b/src/main/java/net/minecraft/server/EntityMobs.java index 633339a0..ee3e84f4 100644 --- a/src/main/java/net/minecraft/server/EntityMobs.java +++ b/src/main/java/net/minecraft/server/EntityMobs.java @@ -5,6 +5,7 @@ import java.util.Random; //CraftBukkit start import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.entity.CraftMinecart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; @@ -19,6 +20,10 @@ public class EntityMobs extends EntityCreature implements IMobs { super(world); c = 2; aZ = 20; + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftLivingEntity(server, this); + //CraftBukkit end } public void o() { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index f971219d..3314d431 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -51,6 +51,10 @@ public abstract class EntityPlayer extends EntityLiving { aR = 180F; Y = 20; aP = "/mob/char.png"; + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftLivingEntity(server, this); + //CraftBukkit end } public void b_() { diff --git a/src/main/java/net/minecraft/server/EntityPlayerMP.java b/src/main/java/net/minecraft/server/EntityPlayerMP.java index adb2f6fe..5f1b184b 100644 --- a/src/main/java/net/minecraft/server/EntityPlayerMP.java +++ b/src/main/java/net/minecraft/server/EntityPlayerMP.java @@ -2,6 +2,11 @@ package net.minecraft.server; import java.util.*; +//CraftBukkit start +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.entity.CraftPlayer; +//CraftBukkit end + public class EntityPlayerMP extends EntityPlayer implements ICrafting { public NetServerHandler a; @@ -43,6 +48,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { aw = s; c = iteminworldmanager; H = 0.0F; + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftPlayer(server, this); + //CraftBukkit end } public void l() { diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 1ff4c479..9c548db4 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -16,6 +16,10 @@ public class EntitySkeleton extends EntityMobs { public EntitySkeleton(World world) { super(world); aP = "/mob/skeleton.png"; + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftLivingEntity(server, this); + //CraftBukkit end } protected String e() { diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index 4e479d53..700cac8b 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -34,6 +34,10 @@ public class EntitySnowball extends Entity { a = 0; am = 0; a(0.25F, 0.25F); + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftSnowball(server, this); + //CraftBukkit end } protected void a() {} diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 96dd4270..870700bf 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -16,6 +16,10 @@ public class EntityZombie extends EntityMobs { aP = "/mob/zombie.png"; bC = 0.5F; c = 5; + //CraftBukkit start + CraftServer server = ((WorldServer) this.l).getServer(); + this.bukkitEntity = new CraftLivingEntity(server, this); + //CraftBukkit end } public void o() { |