summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityHuman.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityHuman.java')
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java462
1 files changed, 256 insertions, 206 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index e4fe7703..c12a08ff 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -3,6 +3,10 @@ package net.minecraft.server;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
+
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.com.mojang.authlib.GameProfile;
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -22,18 +26,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
private InventoryEnderChest enderChest = new InventoryEnderChest();
public Container defaultContainer;
public Container activeContainer;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected int br;
public float bs;
public float bt;
- protected final String name;
- public int bv;
+ public int bu;
+ public double bv;
public double bw;
public double bx;
public double by;
public double bz;
public double bA;
- public double bB;
// CraftBukkit start
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
@@ -45,10 +48,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- public ChunkCoordinates bD;
+ public ChunkCoordinates bC;
public int sleepTicks; // CraftBukkit - private -> public
+ public float bD;
public float bE;
- public float bF;
private ChunkCoordinates c;
private boolean d;
private ChunkCoordinates e;
@@ -59,14 +62,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float exp;
private ItemStack f;
private int g;
- protected float bK = 0.1F;
- protected float bL = 0.02F;
+ protected float bJ = 0.1F;
+ protected float bK = 0.02F;
private int h;
+ private final GameProfile i;
public EntityFishingHook hookedFish;
- public EntityHuman(World world, String s) {
+ public EntityHuman(World world, GameProfile gameprofile) {
super(world);
- this.name = s;
+ this.uniqueID = a(gameprofile);
+ this.i = gameprofile;
this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic, this);
this.activeContainer = this.defaultContainer;
this.height = 1.62F;
@@ -77,31 +82,31 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.maxFireTicks = 20;
}
- protected void az() {
- super.az();
- this.aX().b(GenericAttributes.e).setValue(1.0D);
+ protected void aD() {
+ super.aD();
+ this.bc().b(GenericAttributes.e).setValue(1.0D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
this.datawatcher.a(17, Float.valueOf(0.0F));
this.datawatcher.a(18, Integer.valueOf(0));
}
- public boolean br() {
+ public boolean bw() {
return this.f != null;
}
- public void bt() {
+ public void by() {
if (this.f != null) {
this.f.b(this.world, this, this.g);
}
- this.bu();
+ this.bz();
}
- public void bu() {
+ public void bz() {
this.f = null;
this.g = 0;
if (!this.world.isStatic) {
@@ -110,10 +115,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public boolean isBlocking() {
- return this.br() && Item.byId[this.f.id].c_(this.f) == EnumAnimation.BLOCK;
+ return this.bw() && this.f.getItem().d(this.f) == EnumAnimation.BLOCK;
}
- public void l_() {
+ public void h() {
if (this.f != null) {
ItemStack itemstack = this.inventory.getItemInHand();
@@ -123,15 +128,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (--this.g == 0 && !this.world.isStatic) {
- this.n();
+ this.p();
}
} else {
- this.bu();
+ this.bz();
}
}
- if (this.bv > 0) {
- --this.bv;
+ if (this.bu > 0) {
+ --this.bu;
}
if (this.isSleeping()) {
@@ -141,7 +146,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (!this.world.isStatic) {
- if (!this.h()) {
+ if (!this.j()) {
this.a(true, true, false);
} else if (this.world.v()) {
this.a(false, true, true);
@@ -154,7 +159,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- super.l_();
+ super.h();
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
@@ -164,56 +169,64 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.extinguish();
}
+ this.bv = this.by;
this.bw = this.bz;
this.bx = this.bA;
- this.by = this.bB;
- double d0 = this.locX - this.bz;
- double d1 = this.locY - this.bA;
- double d2 = this.locZ - this.bB;
+ double d0 = this.locX - this.by;
+ double d1 = this.locY - this.bz;
+ double d2 = this.locZ - this.bA;
double d3 = 10.0D;
if (d0 > d3) {
- this.bw = this.bz = this.locX;
+ this.bv = this.by = this.locX;
}
if (d2 > d3) {
- this.by = this.bB = this.locZ;
+ this.bx = this.bA = this.locZ;
}
if (d1 > d3) {
- this.bx = this.bA = this.locY;
+ this.bw = this.bz = this.locY;
}
if (d0 < -d3) {
- this.bw = this.bz = this.locX;
+ this.bv = this.by = this.locX;
}
if (d2 < -d3) {
- this.by = this.bB = this.locZ;
+ this.bx = this.bA = this.locZ;
}
if (d1 < -d3) {
- this.bx = this.bA = this.locY;
+ this.bw = this.bz = this.locY;
}
- this.bz += d0 * 0.25D;
- this.bB += d2 * 0.25D;
- this.bA += d1 * 0.25D;
- this.a(StatisticList.k, 1);
+ this.by += d0 * 0.25D;
+ this.bA += d2 * 0.25D;
+ this.bz += d1 * 0.25D;
if (this.vehicle == null) {
this.e = null;
}
if (!this.world.isStatic) {
this.foodData.a(this);
+ this.a(StatisticList.g, 1);
}
}
- public int z() {
+ public int D() {
return this.abilities.isInvulnerable ? 0 : 80;
}
- public int ac() {
+ protected String H() {
+ return "game.player.swim";
+ }
+
+ protected String O() {
+ return "game.player.swim.splash";
+ }
+
+ public int ai() {
return 10;
}
@@ -237,14 +250,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
- this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
+ String s = "iconcrack_" + Item.b(itemstack.getItem());
+
+ if (itemstack.usesData()) {
+ s = s + "_" + itemstack.getData();
+ }
+
+ this.world.addParticle(s, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
}
this.makeSound("random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
- protected void n() {
+ protected void p() {
if (this.f != null) {
this.c(this.f, 16);
int i = this.f.count;
@@ -257,7 +276,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (event.isCancelled()) {
// Update client
if (this instanceof EntityPlayer) {
- ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
+ ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
}
return;
}
@@ -268,7 +287,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// Update client
if (this instanceof EntityPlayer) {
- ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
+ ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
}
return;
}
@@ -283,11 +302,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.bu();
+ this.bz();
}
}
- protected boolean bc() {
+ protected boolean bh() {
return this.getHealth() <= 0.0F || this.isSleeping();
}
@@ -328,7 +347,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void V() {
+ public void ab() {
if (!this.world.isStatic && this.isSneaking()) {
this.mount((Entity) null);
this.setSneaking(false);
@@ -339,10 +358,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
float f = this.yaw;
float f1 = this.pitch;
- super.V();
+ super.ab();
this.bs = this.bt;
this.bt = 0.0F;
- this.k(this.locX - d0, this.locY - d1, this.locZ - d2);
+ this.l(this.locX - d0, this.locY - d1, this.locZ - d2);
if (this.vehicle instanceof EntityPig) {
this.pitch = f1;
this.yaw = f;
@@ -351,33 +370,33 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected void bl() {
- super.bl();
- this.aW();
+ protected void bq() {
+ super.bq();
+ this.bb();
}
- public void c() {
+ public void e() {
if (this.br > 0) {
--this.br;
}
- if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) {
+ if (this.world.difficulty == EnumDifficulty.PEACEFUL && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) {
// CraftBukkit - added regain reason of "REGEN" for filtering purposes.
this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
}
this.inventory.k();
this.bs = this.bt;
- super.c();
+ super.e();
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
if (!this.world.isStatic) {
attributeinstance.setValue((double) this.abilities.b());
}
- this.aR = this.bL;
+ this.aR = this.bK;
if (this.isSprinting()) {
- this.aR = (float) ((double) this.aR + (double) this.bL * 0.3D);
+ this.aR = (float) ((double) this.aR + (double) this.bK * 0.3D);
}
this.i((float) attributeinstance.getValue());
@@ -445,8 +464,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(0.2F, 0.2F);
this.setPosition(this.locX, this.locY, this.locZ);
this.motY = 0.10000000149011612D;
- if (this.name.equals("Notch")) {
- this.a(new ItemStack(Item.APPLE, 1), true);
+ if (this.getName().equals("Notch")) {
+ this.a(new ItemStack(Items.APPLE, 1), true, false);
}
if (!this.world.getGameRules().getBoolean("keepInventory")) {
@@ -461,20 +480,28 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
this.height = 0.1F;
- this.a(StatisticList.y, 1);
+ this.a(StatisticList.v, 1);
+ }
+
+ protected String aT() {
+ return "game.player.hurt";
+ }
+
+ protected String aU() {
+ return "game.player.die";
}
public void b(Entity entity, int i) {
this.addScore(i);
// CraftBukkit - Get our scores instead
- Collection<ScoreboardScore> collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getLocalizedName(), new java.util.ArrayList<ScoreboardScore>());
+ Collection<ScoreboardScore> collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getName(), new java.util.ArrayList<ScoreboardScore>());
if (entity instanceof EntityHuman) {
- this.a(StatisticList.A, 1);
+ this.a(StatisticList.y, 1);
// CraftBukkit - Get our scores instead
- this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getLocalizedName(), collection);
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), collection);
} else {
- this.a(StatisticList.z, 1);
+ this.a(StatisticList.w, 1);
}
Iterator iterator = collection.iterator();
@@ -487,14 +514,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public EntityItem a(boolean flag) {
- return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false);
+ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true);
}
- public EntityItem drop(ItemStack itemstack) {
- return this.a(itemstack, false);
+ public EntityItem drop(ItemStack itemstack, boolean flag) {
+ return this.a(itemstack, false, false);
}
- public EntityItem a(ItemStack itemstack, boolean flag) {
+ public EntityItem a(ItemStack itemstack, boolean flag, boolean flag1) {
if (itemstack == null) {
return null;
} else if (itemstack.count == 0) {
@@ -503,6 +530,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack);
entityitem.pickupDelay = 40;
+ if (flag1) {
+ entityitem.b(this.getName());
+ }
+
float f = 0.1F;
float f1;
@@ -540,7 +571,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// CraftBukkit end
this.a(entityitem);
- this.a(StatisticList.v, 1);
+ this.a(StatisticList.s, 1);
return entityitem;
}
}
@@ -592,7 +623,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Inventory");
+ this.uniqueID = a(this.i);
+ NBTTagList nbttaglist = nbttagcompound.getList("Inventory", 10);
this.inventory.b(nbttaglist);
this.inventory.itemInHandIndex = nbttagcompound.getInt("SelectedItemSlot");
@@ -603,7 +635,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = nbttagcompound.getInt("XpTotal");
this.setScore(nbttagcompound.getInt("Score"));
if (this.sleeping) {
- this.bD = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ this.bC = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@@ -614,15 +646,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
+ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.c = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.d = nbttagcompound.getBoolean("SpawnForced");
}
this.foodData.a(nbttagcompound);
this.abilities.b(nbttagcompound);
- if (nbttagcompound.hasKey("EnderItems")) {
- NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems");
+ if (nbttagcompound.hasKeyOfType("EnderItems", 9)) {
+ NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems", 10);
this.enderChest.a(nbttaglist1);
}
@@ -669,7 +701,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return 0.12F;
}
- protected void d_() {
+ protected void e_() {
this.height = 1.62F;
}
@@ -687,16 +719,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(true, true, false);
}
- if (damagesource.p()) {
- if (this.world.difficulty == 0) {
- return false; // CraftBukkit - f = 0 -> return false
+ if (damagesource.r()) {
+ if (this.world.difficulty == EnumDifficulty.PEACEFUL) {
+ return false; // CraftBukkit - f = 0.0f -> return false
}
- if (this.world.difficulty == 1) {
+ if (this.world.difficulty == EnumDifficulty.EASY) {
f = f / 2.0F + 1.0F;
}
- if (this.world.difficulty == 3) {
+ if (this.world.difficulty == EnumDifficulty.HARD) {
f = f * 3.0F / 2.0F;
}
}
@@ -710,7 +742,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
entity = ((EntityArrow) entity).shooter;
}
- this.a(StatisticList.x, Math.round(f * 10.0F));
+ this.a(StatisticList.u, Math.round(f * 10.0F));
return super.damageEntity(damagesource, f);
}
}
@@ -729,7 +761,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
} else {
// This should never be called, but is implemented anyway
- org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.name);
+ org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.getName());
team = entityhuman.world.getServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer);
if (team == null || team.allowFriendlyFire()) {
return true;
@@ -739,7 +771,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this instanceof EntityPlayer) {
return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity());
}
- return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.name));
+ return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.getName()));
// CraftBukkit end
}
@@ -747,11 +779,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.inventory.a(f);
}
- public int aQ() {
+ public int aV() {
return this.inventory.l();
}
- public float bx() {
+ public float bC() {
int i = 0;
ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length;
@@ -777,14 +809,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = this.c(damagesource, f);
float f1 = f;
- f = Math.max(f - this.bn(), 0.0F);
- this.m(this.bn() - (f1 - f));
+ f = Math.max(f - this.bs(), 0.0F);
+ this.m(this.bs() - (f1 - f));
if (f != 0.0F) {
this.a(damagesource.f());
float f2 = this.getHealth();
this.setHealth(this.getHealth() - f);
- this.aR().a(damagesource, f2, f);
+ this.aW().a(damagesource, f2, f);
}
}
}
@@ -795,16 +827,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(TileEntity tileentity) {}
+ public void a(CommandBlockListenerAbstract commandblocklistenerabstract) {}
+
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {}
public void openBeacon(TileEntityBeacon tileentitybeacon) {}
public void openTrade(IMerchant imerchant, String s) {}
- public void c(ItemStack itemstack) {}
+ public void b(ItemStack itemstack) {}
public boolean p(Entity entity) {
- ItemStack itemstack = this.by();
+ ItemStack itemstack = this.bD();
ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null;
if (!entity.c(this)) {
@@ -816,7 +850,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (itemstack.a(this, (EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
- this.bz();
+ this.bE();
}
return true;
@@ -825,9 +859,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return false;
} else {
- if (itemstack != null && itemstack == this.by()) {
+ if (itemstack != null && itemstack == this.bD()) {
if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) {
- this.bz();
+ this.bE();
} else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) {
itemstack.count = itemstack1.count;
}
@@ -837,20 +871,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public ItemStack by() {
+ public ItemStack bD() {
return this.inventory.getItemInHand();
}
- public void bz() {
+ public void bE() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
- public double X() {
+ public double ad() {
return (double) (this.height - 0.5F);
}
public void attack(Entity entity) {
- if (entity.aq()) {
+ if (entity.av()) {
if (!entity.i(this)) {
float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
int i = 0;
@@ -866,7 +900,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (f > 0.0F || f1 > 0.0F) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.e() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.h_() && !this.M() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag && f > 0.0F) {
f *= 1.5F;
@@ -883,15 +917,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f);
- // CraftBukkit start - Return when the damage fails so that the item will not lose durability
- if (!flag2) {
- if (flag1) {
- entity.extinguish();
- }
- return;
- }
- // CraftBukkit end
-
if (flag2) {
if (i > 0) {
entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
@@ -909,51 +934,52 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (f >= 18.0F) {
- this.a((Statistic) AchievementList.E);
+ this.a((Statistic) AchievementList.F);
}
this.k(entity);
if (entity instanceof EntityLiving) {
- EnchantmentThorns.a(this, (EntityLiving) entity, this.random);
+ EnchantmentManager.a((EntityLiving) entity, (Entity) this);
}
- }
- ItemStack itemstack = this.by();
- Object object = entity;
+ EnchantmentManager.b(this, entity);
+ ItemStack itemstack = this.bD();
+ Object object = entity;
- if (entity instanceof EntityComplexPart) {
- IComplex icomplex = ((EntityComplexPart) entity).owner;
+ if (entity instanceof EntityComplexPart) {
+ IComplex icomplex = ((EntityComplexPart) entity).owner;
- if (icomplex != null && icomplex instanceof EntityLiving) {
- object = (EntityLiving) icomplex;
+ if (icomplex != null && icomplex instanceof EntityLiving) {
+ object = (EntityLiving) icomplex;
+ }
}
- }
- if (itemstack != null && object instanceof EntityLiving) {
- itemstack.a((EntityLiving) object, this);
- // CraftBukkit - bypass infinite items; <= 0 -> == 0
- if (itemstack.count == 0) {
- this.bz();
+ if (itemstack != null && object instanceof EntityLiving) {
+ itemstack.a((EntityLiving) object, this);
+ // CraftBukkit - bypass infinite items; <= 0 -> == 0
+ if (itemstack.count == 0) {
+ this.bE();
+ }
}
- }
- if (entity instanceof EntityLiving) {
- this.a(StatisticList.w, Math.round(f * 10.0F));
- if (j > 0 && flag2) {
- // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
- EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
- org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
-
- if (!combustEvent.isCancelled()) {
- entity.setOnFire(combustEvent.getDuration());
+ if (entity instanceof EntityLiving) {
+ this.a(StatisticList.t, Math.round(f * 10.0F));
+ if (j > 0) {
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entity.setOnFire(combustEvent.getDuration());
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
- } else if (flag1) {
- entity.extinguish();
}
- }
- this.a(0.3F);
+ this.a(0.3F);
+ } else if (flag1) {
+ entity.extinguish();
+ }
}
}
}
@@ -975,6 +1001,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return !this.sleeping && super.inBlock();
}
+ public GameProfile getProfile() {
+ return this.i;
+ }
+
public EnumBedResult a(int i, int j, int k) {
if (!this.world.isStatic) {
if (this.isSleeping() || !this.isAlive()) {
@@ -1002,7 +1032,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- if (this.ag()) {
+ if (this.am()) {
this.mount((Entity) null);
}
@@ -1024,7 +1054,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
- int i1 = BlockBed.j(l);
+ int i1 = BlockBed.l(l);
float f = 0.5F;
float f1 = 0.5F;
@@ -1045,7 +1075,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = 0.9F;
}
- this.t(i1);
+ this.w(i1);
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
} else {
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
@@ -1053,7 +1083,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.sleeping = true;
this.sleepTicks = 0;
- this.bD = new ChunkCoordinates(i, j, k);
+ this.bC = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@@ -1062,36 +1092,36 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return EnumBedResult.OK;
}
- private void t(int i) {
+ private void w(int i) {
+ this.bD = 0.0F;
this.bE = 0.0F;
- this.bF = 0.0F;
switch (i) {
case 0:
- this.bF = -1.8F;
+ this.bE = -1.8F;
break;
case 1:
- this.bE = 1.8F;
+ this.bD = 1.8F;
break;
case 2:
- this.bF = 1.8F;
+ this.bE = 1.8F;
break;
case 3:
- this.bE = -1.8F;
+ this.bD = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
this.a(0.6F, 1.8F);
- this.d_();
- ChunkCoordinates chunkcoordinates = this.bD;
- ChunkCoordinates chunkcoordinates1 = this.bD;
+ this.e_();
+ ChunkCoordinates chunkcoordinates = this.bC;
+ ChunkCoordinates chunkcoordinates1 = this.bC;
- if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
+ if (chunkcoordinates != null && this.world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Blocks.BED) {
BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false);
- chunkcoordinates1 = BlockBed.b(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
+ chunkcoordinates1 = BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
if (chunkcoordinates1 == null) {
chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
}
@@ -1127,28 +1157,28 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (flag2) {
- this.setRespawnPosition(this.bD, false);
+ this.setRespawnPosition(this.bC, false);
}
}
- private boolean h() {
- return this.world.getTypeId(this.bD.x, this.bD.y, this.bD.z) == Block.BED.id;
+ private boolean j() {
+ return this.world.getType(this.bC.x, this.bC.y, this.bC.z) == Blocks.BED;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) {
- IChunkProvider ichunkprovider = world.L();
+ IChunkProvider ichunkprovider = world.K();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4);
- if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
- ChunkCoordinates chunkcoordinates1 = BlockBed.b(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
+ if (world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Blocks.BED) {
+ ChunkCoordinates chunkcoordinates1 = BlockBed.a(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
return chunkcoordinates1;
} else {
- Material material = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
- Material material1 = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
+ Material material = world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z).getMaterial();
+ Material material1 = world.getType(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z).getMaterial();
boolean flag1 = !material.isBuildable() && !material.isLiquid();
boolean flag2 = !material1.isBuildable() && !material1.isLiquid();
@@ -1174,7 +1204,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void a(String s) {}
+ public void b(IChatBaseComponent ichatbasecomponent) {}
public ChunkCoordinates getBed() {
return this.c;
@@ -1202,9 +1232,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(Statistic statistic, int i) {}
- protected void be() {
- super.be();
- this.a(StatisticList.u, 1);
+ public void bj() {
+ super.bj();
+ this.a(StatisticList.r, 1);
if (this.isSprinting()) {
this.a(0.8F);
} else {
@@ -1232,7 +1262,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2);
}
- public float bg() {
+ public float bl() {
return (float) this.getAttributeInstance(GenericAttributes.d).getValue();
}
@@ -1243,23 +1273,23 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.a(Material.WATER)) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
- this.a(StatisticList.q, i);
+ this.a(StatisticList.m, i);
this.a(0.015F * (float) i * 0.01F);
}
- } else if (this.H()) {
+ } else if (this.M()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
- this.a(StatisticList.m, i);
+ this.a(StatisticList.i, i);
this.a(0.015F * (float) i * 0.01F);
}
- } else if (this.e()) {
+ } else if (this.h_()) {
if (d1 > 0.0D) {
- this.a(StatisticList.o, (int) Math.round(d1 * 100.0D));
+ this.a(StatisticList.k, (int) Math.round(d1 * 100.0D));
}
} else if (this.onGround) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
- this.a(StatisticList.l, i);
+ this.a(StatisticList.h, i);
if (this.isSprinting()) {
this.a(0.099999994F * (float) i * 0.01F);
} else {
@@ -1269,28 +1299,30 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} else {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 25) {
- this.a(StatisticList.p, i);
+ this.a(StatisticList.l, i);
}
}
}
}
- private void k(double d0, double d1, double d2) {
+ private void l(double d0, double d1, double d2) {
if (this.vehicle != null) {
int i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
if (this.vehicle instanceof EntityMinecartAbstract) {
- this.a(StatisticList.r, i);
+ this.a(StatisticList.n, i);
if (this.e == null) {
this.e = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
} else if ((double) this.e.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000000.0D) {
this.a((Statistic) AchievementList.q, 1);
}
} else if (this.vehicle instanceof EntityBoat) {
- this.a(StatisticList.s, i);
+ this.a(StatisticList.o, i);
} else if (this.vehicle instanceof EntityPig) {
- this.a(StatisticList.t, i);
+ this.a(StatisticList.p, i);
+ } else if (this.vehicle instanceof EntityHorse) {
+ this.a(StatisticList.q, i);
}
}
}
@@ -1299,27 +1331,38 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
protected void b(float f) {
if (!this.abilities.canFly) {
if (f >= 2.0F) {
- this.a(StatisticList.n, (int) Math.round((double) f * 100.0D));
+ this.a(StatisticList.j, (int) Math.round((double) f * 100.0D));
}
super.b(f);
}
}
+ protected String o(int i) {
+ return i > 4 ? "game.player.hurt.fall.big" : "game.player.hurt.fall.small";
+ }
+
public void a(EntityLiving entityliving) {
if (entityliving instanceof IMonster) {
this.a((Statistic) AchievementList.s);
}
+
+ int i = EntityTypes.a(entityliving);
+ MonsterEggInfo monsteregginfo = (MonsterEggInfo) EntityTypes.a.get(Integer.valueOf(i));
+
+ if (monsteregginfo != null) {
+ this.a(monsteregginfo.d, 1);
+ }
}
- public void am() {
+ public void as() {
if (!this.abilities.isFlying) {
- super.am();
+ super.as();
}
}
- public ItemStack o(int i) {
- return this.inventory.f(i);
+ public ItemStack r(int i) {
+ return this.inventory.d(i);
}
public void giveExp(int i) {
@@ -1374,7 +1417,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
- public boolean bJ() {
+ public boolean bP() {
return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth();
}
@@ -1392,17 +1435,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.abilities.mayBuild) {
return true;
} else {
- int l = this.world.getTypeId(i, j, k);
-
- if (l > 0) {
- Block block = Block.byId[l];
+ Block block = this.world.getType(i, j, k);
- if (block.material.q()) {
+ if (block.getMaterial() != Material.AIR) {
+ if (block.getMaterial().q()) {
return true;
}
- if (this.by() != null) {
- ItemStack itemstack = this.by();
+ if (this.bD() != null) {
+ ItemStack itemstack = this.bD();
if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
return true;
@@ -1432,10 +1473,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return true;
}
- public String getLocalizedName() {
- return this.name;
- }
-
public void copyTo(EntityHuman entityhuman, boolean flag) {
if (flag) {
this.inventory.b(entityhuman.inventory);
@@ -1445,7 +1482,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp;
this.setScore(entityhuman.getScore());
- this.as = entityhuman.as;
+ this.ar = entityhuman.ar;
} else if (this.world.getGameRules().getBoolean("keepInventory")) {
this.inventory.b(entityhuman.inventory);
this.expLevel = entityhuman.expLevel;
@@ -1457,7 +1494,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.enderChest = entityhuman.enderChest;
}
- protected boolean e_() {
+ protected boolean g_() {
return !this.abilities.isFlying;
}
@@ -1466,10 +1503,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(EnumGamemode enumgamemode) {}
public String getName() {
- return this.name;
+ return this.i.getName();
}
- public World f_() {
+ public World getWorld() {
return this.world;
}
@@ -1481,7 +1518,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
}
- public ItemStack aZ() {
+ public ItemStack be() {
return this.inventory.getItemInHand();
}
@@ -1493,7 +1530,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.inventory.armor;
}
- public boolean ax() {
+ public boolean aC() {
return !this.abilities.isFlying;
}
@@ -1502,12 +1539,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public ScoreboardTeamBase getScoreboardTeam() {
- return this.getScoreboard().getPlayerTeam(this.name);
+ return this.getScoreboard().getPlayerTeam(this.getName());
}
- public String getScoreboardDisplayName() {
+ public IChatBaseComponent getScoreboardDisplayName() {
// CraftBukkit todo: fun
- return ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.name);
+ ChatComponentText chatcomponenttext = new ChatComponentText(ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.getName()));
+
+ chatcomponenttext.b().a(new ChatClickable(EnumClickAction.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
+ return chatcomponenttext;
}
public void m(float f) {
@@ -1518,7 +1558,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.getDataWatcher().watch(17, Float.valueOf(f));
}
- public float bn() {
+ public float bs() {
return this.getDataWatcher().getFloat(17);
}
+
+ public static UUID a(GameProfile gameprofile) {
+ UUID uuid = UtilUUID.b(gameprofile.getId());
+
+ if (uuid == null) {
+ uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8));
+ }
+
+ return uuid;
+ }
}