mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
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.
This commit is contained in:
parent
95cb03b50e
commit
2de3e2e7e4
@ -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
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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() {
|
||||
|
@ -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_() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {}
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user