Archiviert
13
0

Fix Craft Entity constructors and toStrings.

Also, standardise getHandle and clean up in general.
getHandle is now using the 'entity' member variable instead of
super.getHandle, as this reduces the number of chained calls needed.
Dieser Commit ist enthalten in:
Andrew Ardill 2011-11-29 21:22:35 +11:00
Ursprung a51eb9c3ca
Commit 2759809ecb
57 geänderte Dateien mit 588 neuen und 305 gelöschten Zeilen

Datei anzeigen

@ -12,6 +12,7 @@ import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent;
import org.bukkit.event.vehicle.VehicleUpdateEvent;
import org.bukkit.util.Vector;
// CraftBukkit end
public class EntityMinecart extends Entity implements IInventory {
@ -32,12 +33,12 @@ public class EntityMinecart extends Entity implements IInventory {
// CraftBukkit start
public boolean slowWhenEmpty = true;
public double derailedX = 0.5;
public double derailedY = 0.5;
public double derailedZ = 0.5;
public double flyingX = 0.95;
public double flyingY = 0.95;
public double flyingZ = 0.95;
private double derailedX = 0.5;
private double derailedY = 0.5;
private double derailedZ = 0.5;
private double flyingX = 0.95;
private double flyingY = 0.95;
private double flyingZ = 0.95;
public double maxSpeed = 0.4D;
public ItemStack[] getContents() {
@ -934,4 +935,26 @@ public class EntityMinecart extends Entity implements IInventory {
public int m() {
return this.datawatcher.getInt(18);
}
// CraftBukkit start - methods for getting and setting flying and derailed velocity modifiers
public Vector getFlyingVelocityMod() {
return new Vector(flyingX, flyingY, flyingZ);
}
public void setFlyingVelocityMod(Vector flying) {
flyingX = flying.getX();
flyingY = flying.getY();
flyingZ = flying.getZ();
}
public Vector getDerailedVelocityMod() {
return new Vector(derailedX, derailedY, derailedZ);
}
public void setDerailedVelocityMod(Vector derailed) {
derailedX = derailed.getX();
derailedY = derailed.getY();
derailedZ = derailed.getZ();
}
// CraftBukkit end
}

Datei anzeigen

@ -0,0 +1,87 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
public class EntityPotion extends EntityProjectile {
private int d;
public EntityPotion(World world) {
super(world);
}
public EntityPotion(World world, EntityLiving entityliving, int i) {
super(world, entityliving);
this.d = i;
}
public EntityPotion(World world, double d0, double d1, double d2, int i) {
super(world, d0, d1, d2);
this.d = i;
}
protected float e() {
return 0.05F;
}
protected float c() {
return 0.5F;
}
protected float d() {
return -20.0F;
}
public int f() {
return this.d;
}
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
List list = Item.POTION.b(this.d);
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.b(4.0D, 2.0D, 4.0D);
List list1 = this.world.a(EntityLiving.class, axisalignedbb);
if (list1 != null && !list1.isEmpty()) {
Iterator iterator = list1.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
double d0 = this.i(entity);
if (d0 < 16.0D) {
double d1 = 1.0D - Math.sqrt(d0) / 4.0D;
if (entity == movingobjectposition.entity) {
d1 = 1.0D;
}
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator1.next();
int i = mobeffect.getEffectId();
if (MobEffectList.byId[i].b()) {
MobEffectList.byId[i].a(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1);
} else {
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
if (j > 20) {
((EntityLiving) entity).addEffect(new MobEffect(i, j, mobeffect.getAmplifier()));
}
}
}
}
}
}
}
this.world.f(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), this.d);
this.die();
}
}
}

Datei anzeigen

@ -10,16 +10,6 @@ public class CraftAnimals extends CraftCreature implements Animals {
super(server, entity);
}
@Override
public String toString() {
return "CraftAnimals";
}
@Override
public EntityAnimal getHandle() {
return (EntityAnimal) entity;
}
public int getAge() {
return getHandle().getAge();
}
@ -27,4 +17,14 @@ public class CraftAnimals extends CraftCreature implements Animals {
public void setAge(int age) {
getHandle().setAge(age);
}
@Override
public EntityAnimal getHandle() {
return (EntityAnimal) entity;
}
@Override
public String toString() {
return "CraftAnimals";
}
}

Datei anzeigen

@ -7,29 +7,35 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import javax.swing.text.html.parser.Entity;
public class CraftArrow extends AbstractProjectile implements Arrow {
public CraftArrow(CraftServer server, EntityArrow entity) {
super(server, entity);
}
@Override
public String toString() {
return "CraftArrow";
}
public LivingEntity getShooter() {
if (((EntityArrow) getHandle()).shooter != null) {
return (LivingEntity) ((EntityArrow) getHandle()).shooter.getBukkitEntity();
if (getHandle().shooter != null) {
return (LivingEntity) getHandle().shooter.getBukkitEntity();
}
return null;
}
public void setShooter(LivingEntity shooter) {
if (shooter instanceof CraftLivingEntity) {
((EntityArrow) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
}
}
@Override
public EntityArrow getHandle(){
return (EntityArrow) entity;
}
@Override
public String toString() {
return "CraftArrow";
}
}

Datei anzeigen

@ -1,11 +1,22 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityBlaze;
import net.minecraft.server.EntityMonster;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Blaze;
public class CraftBlaze extends CraftMonster implements Blaze {
public CraftBlaze(CraftServer server, EntityMonster entity) {
public CraftBlaze(CraftServer server, EntityBlaze entity) {
super(server, entity);
}
@Override
public EntityBlaze getHandle() {
return (EntityBlaze) entity;
}
@Override
public String toString() {
return "CraftBlaze";
}
}

Datei anzeigen

@ -5,47 +5,50 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Boat;
public class CraftBoat extends CraftVehicle implements Boat {
protected EntityBoat boat;
public CraftBoat(CraftServer server, EntityBoat entity) {
super(server, entity);
boat = entity;
}
public double getMaxSpeed() {
return boat.maxSpeed;
return getHandle().maxSpeed;
}
public void setMaxSpeed(double speed) {
if (speed >= 0D) {
boat.maxSpeed = speed;
getHandle().maxSpeed = speed;
}
}
public double getOccupiedDeceleration() {
return boat.occupiedDeceleration;
return getHandle().occupiedDeceleration;
}
public void setOccupiedDeceleration(double speed) {
if (speed >= 0D) {
boat.occupiedDeceleration = speed;
getHandle().occupiedDeceleration = speed;
}
}
public double getUnoccupiedDeceleration() {
return boat.unoccupiedDeceleration;
return getHandle().unoccupiedDeceleration;
}
public void setUnoccupiedDeceleration(double speed) {
boat.unoccupiedDeceleration = speed;
getHandle().unoccupiedDeceleration = speed;
}
public boolean getWorkOnLand() {
return boat.landBoats;
return getHandle().landBoats;
}
public void setWorkOnLand(boolean workOnLand) {
boat.landBoats = workOnLand;
getHandle().landBoats = workOnLand;
}
@Override
public EntityBoat getHandle() {
return (EntityBoat) entity;
}
@Override

Datei anzeigen

@ -11,7 +11,7 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider {
@Override
public EntityCaveSpider getHandle() {
return (EntityCaveSpider) super.getHandle();
return (EntityCaveSpider) entity;
}
@Override

Datei anzeigen

@ -10,6 +10,11 @@ public class CraftChicken extends CraftAnimals implements Chicken {
super(server, entity);
}
@Override
public EntityChicken getHandle() {
return (EntityChicken) entity;
}
@Override
public String toString() {
return "CraftChicken";

Datei anzeigen

@ -6,12 +6,17 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ComplexLivingEntity;
public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity {
public CraftComplexLivingEntity(CraftServer server, EntityLiving entity) {
public CraftComplexLivingEntity(CraftServer server, EntityComplex entity) {
super(server, entity);
}
@Override
public EntityComplex getHandle() {
return (EntityComplex)super.getHandle();
return (EntityComplex) entity;
}
@Override
public String toString() {
return "CraftComplexLivingEntity";
}
}

Datei anzeigen

@ -7,16 +7,21 @@ import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.ComplexLivingEntity;
public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
public CraftComplexPart(CraftServer server, Entity entity) {
public CraftComplexPart(CraftServer server, EntityComplexPart entity) {
super(server, entity);
}
public ComplexLivingEntity getParent() {
return (ComplexLivingEntity)getHandle().a.getBukkitEntity();
return (ComplexLivingEntity) getHandle().a.getBukkitEntity();
}
@Override
public EntityComplexPart getHandle() {
return (EntityComplexPart)super.getHandle();
return (EntityComplexPart) entity;
}
@Override
public String toString() {
return "CraftComplexPart";
}
}

Datei anzeigen

@ -10,6 +10,11 @@ public class CraftCow extends CraftAnimals implements Cow {
super(server, entity);
}
@Override
public EntityCow getHandle() {
return (EntityCow) entity;
}
@Override
public String toString() {
return "CraftCow";

Datei anzeigen

@ -12,16 +12,6 @@ public class CraftCreeper extends CraftMonster implements Creeper {
super(server, entity);
}
@Override
public EntityCreeper getHandle() {
return (EntityCreeper) super.getHandle();
}
@Override
public String toString() {
return "CraftCreeper";
}
public boolean isPowered() {
return getHandle().isPowered();
}
@ -51,4 +41,13 @@ public class CraftCreeper extends CraftMonster implements Creeper {
}
@Override
public EntityCreeper getHandle() {
return (EntityCreeper) entity;
}
@Override
public String toString() {
return "CraftCreeper";
}
}

Datei anzeigen

@ -9,6 +9,11 @@ public class CraftEgg extends CraftProjectile implements Egg {
super(server, entity);
}
@Override
public EntityEgg getHandle() {
return (EntityEgg) entity;
}
@Override
public String toString() {
return "CraftEgg";

Datei anzeigen

@ -1,16 +1,21 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityEnderCrystal;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderSignal;
public class CraftEnderCrystal extends CraftEntity implements EnderSignal {
public CraftEnderCrystal(CraftServer server, Entity entity) {
public CraftEnderCrystal(CraftServer server, EntityEnderCrystal entity) {
super(server, entity);
}
@Override
public EntityEnderCrystal getHandle() {
return (EntityEnderCrystal) entity;
}
@Override
public String toString() {
return "CraftEnderSignal";
return "CraftEnderCrystal";
}
}

Datei anzeigen

@ -11,22 +11,27 @@ import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.EnderDragon;
public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderDragon {
public CraftEnderDragon(CraftServer server, EntityLiving entity) {
public CraftEnderDragon(CraftServer server, EntityEnderDragon entity) {
super(server, entity);
}
public Set<ComplexEntityPart> getParts() {
Builder<ComplexEntityPart> builder = ImmutableSet.builder();
for (EntityComplexPart part : getHandle().f) {
builder.add((ComplexEntityPart)part.getBukkitEntity());
builder.add((ComplexEntityPart) part.getBukkitEntity());
}
return builder.build();
}
@Override
public EntityEnderDragon getHandle() {
return (EntityEnderDragon)super.getHandle();
return (EntityEnderDragon) entity;
}
@Override
public String toString() {
return "CraftEnderDragon";
}
}

Datei anzeigen

@ -1,17 +1,27 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityComplexPart;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.EnderDragonPart;
public class CraftEnderDragonPart extends CraftComplexPart implements EnderDragonPart {
public CraftEnderDragonPart(CraftServer server, Entity entity) {
public CraftEnderDragonPart(CraftServer server, EntityComplexPart entity) {
super(server, entity);
}
@Override
public EnderDragon getParent() {
return (EnderDragon)super.getParent();
return (EnderDragon) super.getParent();
}
@Override
public EntityComplexPart getHandle() {
return (EntityComplexPart) entity;
}
@Override
public String toString() {
return "CraftEnderDragonPart";
}
}

Datei anzeigen

@ -1,14 +1,19 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityEnderPearl;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderPearl;
public class CraftEnderPearl extends CraftProjectile implements EnderPearl {
public CraftEnderPearl(CraftServer server, Entity entity) {
public CraftEnderPearl(CraftServer server, EntityEnderPearl entity) {
super(server, entity);
}
@Override
public EntityEnderPearl getHandle() {
return (EntityEnderPearl) entity;
}
@Override
public String toString() {
return "CraftEnderPearl";

Datei anzeigen

@ -1,14 +1,19 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityEnderSignal;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderSignal;
public class CraftEnderSignal extends CraftEntity implements EnderSignal {
public CraftEnderSignal(CraftServer server, Entity entity) {
public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) {
super(server, entity);
}
@Override
public EntityEnderSignal getHandle() {
return (EntityEnderSignal) entity;
}
@Override
public String toString() {
return "CraftEnderSignal";

Datei anzeigen

@ -12,16 +12,6 @@ public class CraftEnderman extends CraftMonster implements Enderman {
super(server, entity);
}
@Override
public EntityEnderman getHandle() {
return (EntityEnderman) super.getHandle();
}
@Override
public String toString() {
return "CraftEnderman";
}
public MaterialData getCarriedMaterial() {
return Material.getMaterial(getHandle().getCarriedId()).getNewData((byte) getHandle().getCarriedData());
}
@ -30,4 +20,14 @@ public class CraftEnderman extends CraftMonster implements Enderman {
getHandle().setCarriedId(data.getItemTypeId());
getHandle().setCarriedData(data.getData());
}
@Override
public EntityEnderman getHandle() {
return (EntityEnderman) entity;
}
@Override
public String toString() {
return "CraftEnderman";
}
}

Datei anzeigen

@ -35,7 +35,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (entity instanceof EntityLiving) {
// Players
if (entity instanceof EntityHuman) {
if (entity instanceof EntityPlayer) { return getPlayer((EntityPlayer)entity); }
if (entity instanceof EntityPlayer) { return getPlayer((EntityPlayer) entity); }
else { return new CraftHumanEntity(server, (EntityHuman) entity); }
}
else if (entity instanceof EntityCreature) {
@ -75,7 +75,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (entity instanceof EntitySquid) { return new CraftSquid(server, (EntitySquid) entity); }
else { return new CraftWaterMob(server, (EntityWaterAnimal) entity); }
}
else if (entity instanceof EntitySnowman) { return new CraftSnowman(server, (EntityCreature) entity); }
else if (entity instanceof EntitySnowman) { return new CraftSnowman(server, (EntitySnowman) entity); }
else if (entity instanceof EntityVillager) { return new CraftVillager(server, (EntityVillager) entity); }
else { return new CraftCreature(server, (EntityCreature) entity); }
}
@ -95,8 +95,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else { return new CraftLivingEntity(server, (EntityLiving) entity); }
}
else if (entity instanceof EntityComplexPart) {
EntityComplexPart part = (EntityComplexPart)entity;
if (part.a instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart)entity); }
EntityComplexPart part = (EntityComplexPart) entity;
if (part.a instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart) entity); }
else { return new CraftComplexPart(server, (EntityComplexPart) entity); }
}
else if (entity instanceof EntityExperienceOrb) { return new CraftExperienceOrb(server, (EntityExperienceOrb) entity); }
@ -118,21 +118,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityFishingHook) { return new CraftFish(server, (EntityFishingHook) entity); }
else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); }
else if (entity instanceof EntityWeather) {
if (entity instanceof EntityWeatherStorm) {
return new CraftLightningStrike(server, (EntityWeatherStorm)entity);
} else {
return new CraftWeather(server, (EntityWeather)entity);
}
if (entity instanceof EntityWeatherStorm) { return new CraftLightningStrike(server, (EntityWeatherStorm) entity); }
else { return new CraftWeather(server, (EntityWeather) entity); }
}
else if (entity instanceof EntityMinecart) {
EntityMinecart mc = (EntityMinecart) entity;
if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) {
return new CraftStorageMinecart(server, mc);
} else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) {
return new CraftPoweredMinecart(server, mc);
} else {
return new CraftMinecart(server, mc);
}
if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) { return new CraftStorageMinecart(server, mc); }
else if (mc.type == 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 EntityTNTPrimed) { return new CraftTNTPrimed(server, (EntityTNTPrimed) entity); }
@ -205,14 +198,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !entity.aj();
}
public Entity getHandle() {
return entity;
}
public void setHandle(final Entity entity) {
this.entity = entity;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@ -231,19 +216,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + (this.server != null ? this.server.hashCode() : 0);
hash = 89 * hash + (this.entity != null ? this.entity.hashCode() : 0);
return hash;
}
@Override
public String toString() {
return "CraftEntity{" + "id=" + getEntityId() + '}';
}
public Server getServer() {
return server;
}
@ -314,15 +286,36 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return result;
}
public int getTicksLived() {
return getHandle().ticksLived;
}
public void setTicksLived(int value) {
if (value <= 0) {
throw new IllegalArgumentException("Age must be at least 1 tick");
}
getHandle().ticksLived = value;
}
public Entity getHandle() {
return entity;
}
public void setHandle(final Entity entity) {
this.entity = entity;
}
@Override
public String toString() {
return "CraftEntity{" + "id=" + getEntityId() + '}';
}
@Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + (this.server != null ? this.server.hashCode() : 0);
hash = 89 * hash + (this.entity != null ? this.entity.hashCode() : 0);
return hash;
}
}

Datei anzeigen

@ -10,11 +10,6 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
super(server, entity);
}
@Override
public EntityExperienceOrb getHandle() {
return (EntityExperienceOrb) super.getHandle();
}
public int getExperience() {
return getHandle().value;
}
@ -22,4 +17,14 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
public void setExperience(int value) {
getHandle().value = value;
}
@Override
public EntityExperienceOrb getHandle() {
return (EntityExperienceOrb) entity;
}
@Override
public String toString() {
return "CraftExperienceOrb";
}
}

Datei anzeigen

@ -12,6 +12,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
super(server, entity);
}
@Override
public EntityFallingSand getHandle() {
return (EntityFallingSand) entity;
}
@Override
public String toString() {
return "CraftFallingSand";

Datei anzeigen

@ -13,47 +13,51 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
super(server, entity);
}
@Override
public String toString() {
return "CraftFireball";
}
public float getYield() {
return ((EntityFireball) getHandle()).yield;
return getHandle().yield;
}
public boolean isIncendiary() {
return ((EntityFireball) getHandle()).isIncendiary;
return getHandle().isIncendiary;
}
public void setIsIncendiary(boolean isIncendiary) {
((EntityFireball) getHandle()).isIncendiary = isIncendiary;
getHandle().isIncendiary = isIncendiary;
}
public void setYield(float yield) {
((EntityFireball) getHandle()).yield = yield;
getHandle().yield = yield;
}
public LivingEntity getShooter() {
if (((EntityFireball) getHandle()).shooter != null) {
return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
if (getHandle().shooter != null) {
return (LivingEntity) getHandle().shooter.getBukkitEntity();
}
return null;
}
public void setShooter(LivingEntity shooter) {
if (shooter instanceof CraftLivingEntity) {
((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
}
}
public Vector getDirection() {
return new Vector(((EntityFireball) getHandle()).dirX, ((EntityFireball) getHandle()).dirY, ((EntityFireball) getHandle()).dirZ);
return new Vector(getHandle().dirX, getHandle().dirY, getHandle().dirZ);
}
public void setDirection(Vector direction) {
((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
getHandle().setDirection(direction.getX(), direction.getY(), direction.getZ());
}
@Override
public EntityFireball getHandle() {
return (EntityFireball) entity;
}
@Override
public String toString() {
return "CraftFireball";
}
}

Datei anzeigen

@ -12,24 +12,27 @@ public class CraftFish extends AbstractProjectile implements Fish {
super(server, entity);
}
@Override
public String toString() {
return "CraftFish";
}
public LivingEntity getShooter() {
if (((EntityFishingHook) getHandle()).owner != null) {
return (LivingEntity) ((EntityFishingHook) getHandle()).owner.getBukkitEntity();
if (getHandle().owner != null) {
return (LivingEntity) getHandle().owner.getBukkitEntity();
}
return null;
}
public void setShooter(LivingEntity shooter) {
if (shooter instanceof CraftHumanEntity) {
((EntityFishingHook) getHandle()).owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
}
}
@Override
public EntityFishingHook getHandle() {
return (EntityFishingHook) entity;
}
@Override
public String toString() {
return "CraftFish";
}
}

Datei anzeigen

@ -10,9 +10,13 @@ public class CraftFlying extends CraftLivingEntity implements Flying {
super(server, entity);
}
@Override
public EntityFlying getHandle() {
return (EntityFlying) entity;
}
@Override
public String toString() {
return "CraftFlying";
}
}

Datei anzeigen

@ -10,9 +10,13 @@ public class CraftGhast extends CraftFlying implements Ghast {
super(server, entity);
}
@Override
public EntityGhast getHandle() {
return (EntityGhast) entity;
}
@Override
public String toString() {
return "CraftGhast";
}
}

Datei anzeigen

@ -11,9 +11,13 @@ public class CraftGiant extends CraftMonster implements Giant {
super(server, entity);
}
@Override
public EntityGiantZombie getHandle() {
return (EntityGiantZombie) entity;
}
@Override
public String toString() {
return "CraftGiant";
}
}

Datei anzeigen

@ -31,17 +31,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return getHandle().name;
}
@Override
public EntityHuman getHandle() {
return (EntityHuman) entity;
}
public void setHandle(final EntityHuman entity) {
super.setHandle((EntityHuman) entity);
this.entity = entity;
this.inventory = new CraftInventoryPlayer(entity.inventory);
}
public PlayerInventory getInventory() {
return inventory;
}
@ -54,11 +43,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
getInventory().setItemInHand(item);
}
@Override
public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';
}
public boolean isSleeping() {
return getHandle().sleeping;
}
@ -131,4 +115,19 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
this.mode = mode;
}
@Override
public EntityHuman getHandle() {
return (EntityHuman) entity;
}
public void setHandle(final EntityHuman entity) {
super.setHandle(entity);
this.inventory = new CraftInventoryPlayer(entity.inventory);
}
@Override
public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';
}
}

Datei anzeigen

@ -30,6 +30,11 @@ public class CraftItem extends CraftEntity implements Item {
item.pickupDelay = delay;
}
@Override
public EntityItem getHandle() {
return (EntityItem) entity;
}
@Override
public String toString() {
return "CraftItem";

Datei anzeigen

@ -9,12 +9,17 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
super(server, entity);
}
@Override
public EntityWeatherStorm getHandle() {
return (EntityWeatherStorm) super.getHandle();
}
public boolean isEffect() {
return ((EntityWeatherStorm) super.getHandle()).isEffect;
}
@Override
public EntityWeatherStorm getHandle() {
return (EntityWeatherStorm) entity;
}
@Override
public String toString() {
return "CraftLightningStrik";
}
}

Datei anzeigen

@ -51,21 +51,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().getMaxHealth();
}
@Override
public EntityLiving getHandle() {
return (EntityLiving) entity;
}
public void setHandle(final EntityLiving entity) {
super.setHandle((Entity) entity);
this.entity = entity;
}
@Override
public String toString() {
return "CraftLivingEntity{" + "id=" + getEntityId() + '}';
}
public Egg throwEgg() {
net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle();
EntityEgg egg = new EntityEgg(world, getHandle());
@ -224,4 +209,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setNoDamageTicks(int ticks) {
getHandle().noDamageTicks = ticks;
}
@Override
public EntityLiving getHandle() {
return (EntityLiving) entity;
}
public void setHandle(final EntityLiving entity) {
super.setHandle(entity);
}
@Override
public String toString() {
return "CraftLivingEntity{" + "id=" + getEntityId() + '}';
}
}

Datei anzeigen

@ -11,12 +11,12 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube {
super(server, entity);
}
public EntityLavaSlime getHandle() {
return (EntityLavaSlime) entity;
}
@Override
public String toString() {
return "CraftMagmaCube";
}
public EntityLavaSlime getHandle() {
return (EntityLavaSlime) super.getHandle();
}
}

Datei anzeigen

@ -26,62 +26,59 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
}
}
protected EntityMinecart minecart;
public CraftMinecart(CraftServer server, EntityMinecart entity) {
super(server, entity);
minecart = entity;
}
public void setDamage(int damage) {
minecart.setDamage(damage);
getHandle().setDamage(damage);
}
public int getDamage() {
return minecart.getDamage();
return getHandle().getDamage();
}
public double getMaxSpeed() {
return minecart.maxSpeed;
return getHandle().maxSpeed;
}
public void setMaxSpeed(double speed) {
if (speed >= 0D) {
minecart.maxSpeed = speed;
getHandle().maxSpeed = speed;
}
}
public boolean isSlowWhenEmpty() {
return minecart.slowWhenEmpty;
return getHandle().slowWhenEmpty;
}
public void setSlowWhenEmpty(boolean slow) {
minecart.slowWhenEmpty = slow;
getHandle().slowWhenEmpty = slow;
}
public Vector getFlyingVelocityMod() {
return new Vector(minecart.flyingX, minecart.flyingY, minecart.flyingZ);
return getHandle().getFlyingVelocityMod();
}
public void setFlyingVelocityMod(Vector flying) {
minecart.flyingX = flying.getX();
minecart.flyingY = flying.getY();
minecart.flyingZ = flying.getZ();
getHandle().setFlyingVelocityMod(flying);
}
public Vector getDerailedVelocityMod() {
return new Vector(minecart.derailedX, minecart.derailedY, minecart.derailedZ);
return getHandle().getDerailedVelocityMod();
}
public void setDerailedVelocityMod(Vector derailed) {
minecart.derailedX = derailed.getX();
minecart.derailedY = derailed.getY();
minecart.derailedZ = derailed.getZ();
getHandle().setDerailedVelocityMod(derailed);
}
@Override
public EntityMinecart getHandle() {
return (EntityMinecart) entity;
}
@Override
public String toString() {
return "CraftMinecart";
}
}

Datei anzeigen

@ -11,13 +11,13 @@ public class CraftMonster extends CraftCreature implements Monster {
super(server, entity);
}
@Override
public String toString() {
return "CraftMonster";
}
@Override
public EntityMonster getHandle() {
return (EntityMonster) entity;
}
@Override
public String toString() {
return "CraftMonster";
}
}

Datei anzeigen

@ -1,11 +1,21 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityCow;
import net.minecraft.server.EntityMushroomCow;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.MushroomCow;
public class CraftMushroomCow extends CraftCow implements MushroomCow {
public CraftMushroomCow(CraftServer server, EntityCow entity) {
public CraftMushroomCow(CraftServer server, EntityMushroomCow entity) {
super(server, entity);
}
@Override
public EntityMushroomCow getHandle() {
return (EntityMushroomCow) entity;
}
@Override
public String toString() {
return "CraftMushroomCow";
}
}

Datei anzeigen

@ -20,16 +20,6 @@ public class CraftPainting extends CraftEntity implements Painting {
super(server, entity);
}
@Override
public EntityPainting getHandle() {
return (EntityPainting) super.getHandle();
}
@Override
public String toString() {
return "CraftPainting[art=" + getArt() + "]";
}
public Art getArt() {
EnumArt art = getHandle().e;
return CraftArt.NotchToBukkit(art);
@ -124,4 +114,14 @@ public class CraftPainting extends CraftEntity implements Painting {
world.addEntity(painting);
this.entity = painting;
}
@Override
public EntityPainting getHandle() {
return (EntityPainting) entity;
}
@Override
public String toString() {
return "CraftPainting{art=" + getArt() + "}";
}
}

Datei anzeigen

@ -18,7 +18,7 @@ public class CraftPig extends CraftAnimals implements Pig {
}
public EntityPig getHandle() {
return (EntityPig) super.getHandle();
return (EntityPig) entity;
}
@Override

Datei anzeigen

@ -11,16 +11,6 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
super(server, entity);
}
@Override
public EntityPigZombie getHandle() {
return (EntityPigZombie) super.getHandle();
}
@Override
public String toString() {
return "CraftPigZombie";
}
public int getAnger() {
return getHandle().angerLevel;
}
@ -37,4 +27,13 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
return getAnger() > 0;
}
@Override
public EntityPigZombie getHandle() {
return (EntityPigZombie) entity;
}
@Override
public String toString() {
return "CraftPigZombie";
}
}

Datei anzeigen

@ -86,11 +86,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
@Override
public EntityPlayer getHandle() {
return (EntityPlayer) entity;
}
public double getEyeHeight() {
return getEyeHeight(false);
}
@ -107,11 +102,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
public void setHandle(final EntityPlayer entity) {
super.setHandle((EntityHuman) entity);
this.entity = entity;
}
public void sendRawMessage(String message) {
if (getHandle().netServerHandler == null) return;
@ -163,11 +153,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
server.getHandle().sendAll(new Packet201PlayerInfo(name, true, getHandle().i));
}
@Override
public String toString() {
return "CraftPlayer{" + "name=" + getName() + '}';
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@ -183,13 +168,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0);
return hash;
}
public void kickPlayer(String message) {
if (getHandle().netServerHandler == null) return;
@ -543,13 +521,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public Map<String, Object> serialize() {
Map<String, Object> result = new LinkedHashMap<String, Object>();
result.put("name", getName());
return result;
}
public Player getPlayer() {
return this;
}
@Override
public EntityPlayer getHandle() {
return (EntityPlayer) entity;
}
public void setHandle(final EntityPlayer entity) {
super.setHandle(entity);
}
@Override
public String toString() {
return "CraftPlayer{" + "name=" + getName() + '}';
}
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0);
return hash;
}
}

Datei anzeigen

@ -14,5 +14,4 @@ public class CraftPoweredMinecart extends CraftMinecart implements PoweredMineca
public String toString() {
return "CraftPoweredMinecart";
}
}

Datei anzeigen

@ -27,6 +27,11 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj
@Override
public EntityProjectile getHandle() {
return (EntityProjectile)entity;
return (EntityProjectile) entity;
}
@Override
public String toString() {
return "CraftProjectile";
}
}

Datei anzeigen

@ -11,16 +11,6 @@ public class CraftSheep extends CraftAnimals implements Sheep {
super(server, entity);
}
@Override
public EntitySheep getHandle() {
return (EntitySheep) entity;
}
@Override
public String toString() {
return "CraftSheep";
}
public DyeColor getColor() {
return DyeColor.getByData((byte) getHandle().getColor());
}
@ -37,4 +27,14 @@ public class CraftSheep extends CraftAnimals implements Sheep {
getHandle().setSheared(flag);
}
@Override
public EntitySheep getHandle() {
return (EntitySheep) entity;
}
@Override
public String toString() {
return "CraftSheep";
}
}

Datei anzeigen

@ -11,7 +11,7 @@ public class CraftSilverfish extends CraftMonster implements Silverfish {
@Override
public EntitySilverfish getHandle() {
return (EntitySilverfish) super.getHandle();
return (EntitySilverfish) entity;
}
@Override

Datei anzeigen

@ -11,9 +11,13 @@ public class CraftSkeleton extends CraftMonster implements Skeleton {
super(server, entity);
}
@Override
public EntitySkeleton getHandle() {
return (EntitySkeleton) entity;
}
@Override
public String toString() {
return "CraftSkeleton";
}
}

Datei anzeigen

@ -11,15 +11,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
super(server, entity);
}
@Override
public String toString() {
return "CraftSlime";
}
public EntitySlime getHandle() {
return (EntitySlime) super.getHandle();
}
public int getSize() {
return getHandle().getSize();
}
@ -27,4 +18,14 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
public void setSize(int size) {
getHandle().setSize(size);
}
@Override
public EntitySlime getHandle() {
return (EntitySlime) entity;
}
@Override
public String toString() {
return "CraftSlime";
}
}

Datei anzeigen

@ -1,12 +1,21 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityFireball;
import net.minecraft.server.EntitySmallFireball;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.SmallFireball;
public class CraftSmallFireball extends CraftFireball implements SmallFireball {
public CraftSmallFireball(CraftServer server, EntityFireball entity) {
public CraftSmallFireball(CraftServer server, EntitySmallFireball entity) {
super(server, entity);
}
@Override
public EntitySmallFireball getHandle() {
return (EntitySmallFireball) entity;
}
@Override
public String toString() {
return "CraftSmallFireball";
}
}

Datei anzeigen

@ -9,6 +9,11 @@ public class CraftSnowball extends CraftProjectile implements Snowball {
super(server, entity);
}
@Override
public EntitySnowball getHandle() {
return (EntitySnowball) entity;
}
@Override
public String toString() {
return "CraftSnowball";

Datei anzeigen

@ -1,11 +1,21 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityCreature;
import net.minecraft.server.EntitySnowman;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Snowman;
public class CraftSnowman extends CraftCreature implements Snowman {
public CraftSnowman(CraftServer server, EntityCreature entity) {
public CraftSnowman(CraftServer server, EntitySnowman entity) {
super(server, entity);
}
@Override
public EntitySnowman getHandle() {
return (EntitySnowman) entity;
}
@Override
public String toString() {
return "CraftSnowman";
}
}

Datei anzeigen

@ -11,9 +11,13 @@ public class CraftSpider extends CraftMonster implements Spider {
super(server, entity);
}
@Override
public EntitySpider getHandle() {
return (EntitySpider) entity;
}
@Override
public String toString() {
return "CraftSpider";
}
}

Datei anzeigen

@ -11,9 +11,13 @@ public class CraftSquid extends CraftWaterMob implements Squid {
super(server, entity);
}
@Override
public EntitySquid getHandle() {
return (EntitySquid) entity;
}
@Override
public String toString() {
return "CraftSquid";
}
}

Datei anzeigen

@ -11,16 +11,6 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
super(server, entity);
}
@Override
public String toString() {
return "CraftTNTPrimed";
}
@Override
public EntityTNTPrimed getHandle() {
return (EntityTNTPrimed) super.getHandle();
}
public float getYield() {
return getHandle().yield;
}
@ -45,4 +35,14 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
getHandle().fuseTicks = fuseTicks;
}
@Override
public EntityTNTPrimed getHandle() {
return (EntityTNTPrimed) entity;
}
@Override
public String toString() {
return "CraftTNTPrimed";
}
}

Datei anzeigen

@ -1,14 +1,19 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityPotion;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ThrownPotion;
public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
public CraftThrownPotion(CraftServer server, Entity entity) {
public CraftThrownPotion(CraftServer server, EntityPotion entity) {
super(server, entity);
}
@Override
public EntityPotion getHandle() {
return (EntityPotion) entity;
}
@Override
public String toString() {
return "CraftThrownPotion";

Datei anzeigen

@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityCreature;
import net.minecraft.server.EntityVillager;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Villager;
@ -12,6 +11,11 @@ public class CraftVillager extends CraftCreature implements Villager {
@Override
public EntityVillager getHandle() {
return (EntityVillager)super.getHandle();
return (EntityVillager) entity;
}
@Override
public String toString() {
return "CraftVillager";
}
}

Datei anzeigen

@ -11,9 +11,13 @@ public class CraftWaterMob extends CraftCreature implements WaterMob {
super(server, entity);
}
@Override
public EntityWaterAnimal getHandle() {
return (EntityWaterAnimal) entity;
}
@Override
public String toString() {
return "CraftWaterMob";
}
}

Datei anzeigen

@ -12,6 +12,11 @@ public class CraftWeather extends CraftEntity implements Weather {
@Override
public EntityWeather getHandle() {
return (EntityWeather) super.getHandle();
return (EntityWeather) entity;
}
@Override
public String toString() {
return "CraftWeather";
}
}

Datei anzeigen

@ -110,6 +110,6 @@ public class CraftWolf extends CraftAnimals implements Wolf {
@Override
public String toString() {
return "CraftWolf[anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTamed() + ",sitting=" + isSitting() + "]";
return "CraftWolf{anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTamed() + ",sitting=" + isSitting() + "}";
}
}

Datei anzeigen

@ -11,6 +11,11 @@ public class CraftZombie extends CraftMonster implements Zombie {
super(server, entity);
}
@Override
public EntityZombie getHandle() {
return (EntityZombie) entity;
}
@Override
public String toString() {
return "CraftZombie";