diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-11-06 06:05:28 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-11-13 16:09:52 -0600 |
commit | 7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7 (patch) | |
tree | 843902ff94d82e86f40d7e0af1ac838fee859e75 /src/main/java/net/minecraft/server/EntityHuman.java | |
parent | a0c3b4f9d1b403fa64230f22b5dd3222181ba646 (diff) | |
download | craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar.gz craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar.lz craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.tar.xz craftbukkit-7f7192f8fd8357e664e7e2d6e7c5f65fd0fcd2f7.zip |
Update CraftBukkit to Minecraft 1.4.4.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityHuman.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityHuman.java | 404 |
1 files changed, 226 insertions, 178 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 9665716c..47de470a 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -20,19 +20,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public Container defaultContainer; public Container activeContainer; protected FoodMetaData foodData = new FoodMetaData(); - protected int bO = 0; - public byte bP = 0; - public int bQ = 0; - public float bR; - public float bS; + protected int bM = 0; + public byte bN = 0; + public float bO; + public float bP; public String name; - public int bU = 0; + public int bR = 0; + public double bS; + public double bT; + public double bU; public double bV; public double bW; public double bX; - public double bY; - public double bZ; - public double ca; // CraftBukkit start public boolean sleeping; // protected -> public public boolean fauxSleeping; @@ -43,10 +42,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } // CraftBukkit end - public ChunkCoordinates cc; + public ChunkCoordinates bZ; public int sleepTicks; // CraftBukkit - private -> public - public float cd; - public float ce; + public float ca; + public float cb; private ChunkCoordinates c; private boolean d; private ChunkCoordinates e; @@ -57,8 +56,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public float exp; private ItemStack f; private int g; - protected float cj = 0.1F; - protected float ck = 0.02F; + protected float cg = 0.1F; + protected float ch = 0.02F; private int h = 0; public EntityFishingHook hookedFish = null; @@ -84,21 +83,22 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen super.a(); this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(17, Byte.valueOf((byte) 0)); + this.datawatcher.a(18, Integer.valueOf(0)); } - public boolean bI() { + public boolean bM() { return this.f != null; } - public void bK() { + public void bO() { if (this.f != null) { this.f.b(this.world, this, this.g); } - this.bL(); + this.bP(); } - public void bL() { + public void bP() { this.f = null; this.g = 0; if (!this.world.isStatic) { @@ -106,8 +106,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public boolean be() { - return this.bI() && Item.byId[this.f.id].d_(this.f) == EnumAnimation.d; + public boolean bh() { + return this.bM() && Item.byId[this.f.id].d_(this.f) == EnumAnimation.d; } public void j_() { @@ -123,12 +123,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.n(); } } else { - this.bL(); + this.bP(); } } - if (this.bU > 0) { - --this.bU; + if (this.bR > 0) { + --this.bR; } if (this.isSleeping()) { @@ -140,7 +140,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (!this.world.isStatic) { if (!this.j()) { this.a(true, true, false); - } else if (this.world.t()) { + } else if (this.world.u()) { this.a(false, true, true); } } @@ -152,7 +152,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } super.j_(); - if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.c(this)) { + if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) { this.closeInventory(); this.activeContainer = this.defaultContainer; } @@ -161,41 +161,41 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.extinguish(); } - this.bV = this.bY; - this.bW = this.bZ; - this.bX = this.ca; - double d0 = this.locX - this.bY; - double d1 = this.locY - this.bZ; - double d2 = this.locZ - this.ca; + this.bS = this.bV; + this.bT = this.bW; + this.bU = this.bX; + double d0 = this.locX - this.bV; + double d1 = this.locY - this.bW; + double d2 = this.locZ - this.bX; double d3 = 10.0D; if (d0 > d3) { - this.bV = this.bY = this.locX; + this.bS = this.bV = this.locX; } if (d2 > d3) { - this.bX = this.ca = this.locZ; + this.bU = this.bX = this.locZ; } if (d1 > d3) { - this.bW = this.bZ = this.locY; + this.bT = this.bW = this.locY; } if (d0 < -d3) { - this.bV = this.bY = this.locX; + this.bS = this.bV = this.locX; } if (d2 < -d3) { - this.bX = this.ca = this.locZ; + this.bU = this.bX = this.locZ; } if (d1 < -d3) { - this.bW = this.bZ = this.locY; + this.bT = this.bW = this.locY; } - this.bY += d0 * 0.25D; - this.ca += d2 * 0.25D; - this.bZ += d1 * 0.25D; + this.bV += d0 * 0.25D; + this.bX += d2 * 0.25D; + this.bW += d1 * 0.25D; this.a(StatisticList.k, 1); if (this.vehicle == null) { this.e = null; @@ -214,9 +214,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return 10; } + protected void makeSound(String s, float f, float f1) { + this.world.a(this, s, f, f1); + } + protected void c(ItemStack itemstack, int i) { if (itemstack.n() == EnumAnimation.c) { - this.world.makeSound(this, "random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + this.makeSound("random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); } if (itemstack.n() == EnumAnimation.b) { @@ -233,7 +237,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e); } - this.world.makeSound(this, "random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.makeSound("random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } } @@ -250,11 +254,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - this.bL(); + this.bP(); } } - protected boolean bd() { + protected boolean bg() { return this.getHealth() <= 0 || this.isSleeping(); } @@ -271,8 +275,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen float f1 = this.pitch; super.U(); - this.bR = this.bS; - this.bS = 0.0F; + this.bO = this.bP; + this.bP = 0.0F; this.k(this.locX - d0, this.locY - d1, this.locZ - d2); if (this.vehicle instanceof EntityPig) { this.pitch = f1; @@ -281,13 +285,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - protected void bk() { - this.bl(); + protected void bn() { + this.bo(); } public void c() { - if (this.bO > 0) { - --this.bO; + if (this.bM > 0) { + --this.bM; } if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 * 12 == 0) { @@ -296,13 +300,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } this.inventory.j(); - this.bR = this.bS; + this.bO = this.bP; super.c(); this.aM = this.abilities.b(); - this.aN = this.ck; + this.aN = this.ch; if (this.isSprinting()) { this.aM = (float) ((double) this.aM + (double) this.abilities.b() * 0.3D); - this.aN = (float) ((double) this.aN + (double) this.ck * 0.3D); + this.aN = (float) ((double) this.aN + (double) this.ch * 0.3D); } float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); @@ -321,27 +325,39 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen f1 = 0.0F; } - this.bS += (f - this.bS) * 0.4F; + this.bP += (f - this.bP) * 0.4F; this.ba += (f1 - this.ba) * 0.8F; if (this.getHealth() > 0) { - List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.0D, 1.0D)); + List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.5D, 1.0D)); if (list != null) { - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); if (!entity.dead) { - this.q(entity); + this.r(entity); } } } } } - private void q(Entity entity) { - entity.b_(this); + private void r(Entity entity) { + entity.c_(this); + } + + public int getScore() { + return this.datawatcher.getInt(18); + } + + public void setScore(int i) { + this.datawatcher.watch(18, Integer.valueOf(i)); + } + + public void addScore(int i) { + int j = this.getScore(); + + this.datawatcher.watch(18, Integer.valueOf(j + i)); } public void die(DamageSource damagesource) { @@ -369,7 +385,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public void c(Entity entity, int i) { - this.bQ += i; + this.addScore(i); if (entity instanceof EntityHuman) { this.a(StatisticList.A, 1); } else { @@ -377,7 +393,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public EntityItem bN() { + public EntityItem bR() { return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false); } @@ -479,8 +495,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.exp = nbttagcompound.getFloat("XpP"); this.expLevel = nbttagcompound.getInt("XpLevel"); this.expTotal = nbttagcompound.getInt("XpTotal"); + this.setScore(nbttagcompound.getInt("Score")); if (this.sleeping) { - this.cc = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + this.bZ = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); this.a(true, true, false); } @@ -513,6 +530,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen nbttagcompound.setFloat("XpP", this.exp); nbttagcompound.setInt("XpLevel", this.expLevel); nbttagcompound.setInt("XpTotal", this.expTotal); + nbttagcompound.setInt("Score", this.getScore()); if (this.c != null) { nbttagcompound.setInt("SpawnX", this.c.x); nbttagcompound.setInt("SpawnY", this.c.y); @@ -543,10 +561,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public boolean damageEntity(DamageSource damagesource, int i) { - if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) { + if (this.isInvulnerable()) { + return false; + } else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) { return false; } else { - this.bC = 0; + this.bA = 0; if (this.getHealth() <= 0) { return false; } else { @@ -646,11 +666,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.inventory.g(i); } - public int aU() { + public int aW() { return this.inventory.k(); } - public float bO() { + public float bS() { int i = 0; ItemStack[] aitemstack = this.inventory.armor; int j = aitemstack.length; @@ -667,8 +687,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } protected void d(DamageSource damagesource, int i) { - if (!this.invulnerable) { - if (!damagesource.ignoresArmor() && this.be()) { + if (!this.isInvulnerable()) { + if (!damagesource.ignoresArmor() && this.bh()) { i = 1 + i >> 1; } @@ -693,11 +713,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void d(ItemStack itemstack) {} - public boolean o(Entity entity) { - if (entity.c(this)) { + public boolean p(Entity entity) { + if (entity.a(this)) { return true; } else { - ItemStack itemstack = this.bP(); + ItemStack itemstack = this.bT(); if (itemstack != null && entity instanceof EntityLiving) { if (this.abilities.canInstantlyBuild) { @@ -707,7 +727,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (itemstack.a((EntityLiving) entity)) { // CraftBukkit - bypass infinite items; <= 0 -> == 0 if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) { - this.bQ(); + this.bU(); } return true; @@ -718,11 +738,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public ItemStack bP() { + public ItemStack bT() { return this.inventory.getItemInHand(); } - public void bQ() { + public void bU() { this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null); } @@ -732,98 +752,108 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void attack(Entity entity) { if (entity.aq()) { - int i = this.inventory.a(entity); - - if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) { - i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier(); - } - - if (this.hasEffect(MobEffectList.WEAKNESS)) { - i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier(); - } - - int j = 0; - int k = 0; + if (!entity.j(this)) { + int i = this.inventory.a(entity); - if (entity instanceof EntityLiving) { - k = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity); - j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity); - } + if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) { + i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier(); + } - if (this.isSprinting()) { - ++j; - } + if (this.hasEffect(MobEffectList.WEAKNESS)) { + i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier(); + } - if (i > 0 || k > 0) { - boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; + int j = 0; + int k = 0; - if (flag) { - i += this.random.nextInt(i / 2 + 2); + if (entity instanceof EntityLiving) { + k = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity); + j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity); } - i += k; - boolean flag1 = entity.damageEntity(DamageSource.playerAttack(this), i); - - // CraftBukkit start - Return when the damage fails so that the item will not lose durability - if (!flag1) { - return; + if (this.isSprinting()) { + ++j; } - // CraftBukkit end - - if (flag1) { - if (j > 0) { - entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F)); - this.motX *= 0.6D; - this.motZ *= 0.6D; - this.setSprinting(false); - } + + if (i > 0 || k > 0) { + boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; if (flag) { - this.b(entity); + i += this.random.nextInt(i / 2 + 2); } - if (k > 0) { - this.c(entity); + i += k; + boolean flag1 = false; + int l = EnchantmentManager.getFireAspectEnchantmentLevel(this); + + if (entity instanceof EntityLiving && l > 0 && !entity.isBurning()) { + flag1 = true; + entity.setOnFire(1); } - if (i >= 18) { - this.a((Statistic) AchievementList.E); + boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), i); + + // CraftBukkit start - Return when the damage fails so that the item will not lose durability + if (!flag2) { + return; } + // CraftBukkit end + + if (flag2) { + if (j > 0) { + entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F)); + this.motX *= 0.6D; + this.motZ *= 0.6D; + this.setSprinting(false); + } - this.k(entity); - } + if (flag) { + this.b(entity); + } - ItemStack itemstack = this.bP(); + if (k > 0) { + this.c(entity); + } - if (itemstack != null && entity instanceof EntityLiving) { - itemstack.a((EntityLiving) entity, this); - // CraftBukkit - bypass infinite items; <= 0 -> == 0 - if (itemstack.count == 0) { - this.bQ(); - } - } + if (i >= 18) { + this.a((Statistic) AchievementList.E); + } - if (entity instanceof EntityLiving) { - if (entity.isAlive()) { - this.a((EntityLiving) entity, true); + this.l(entity); } - this.a(StatisticList.w, i); - int l = EnchantmentManager.getFireAspectEnchantmentLevel(this, (EntityLiving) entity); + ItemStack itemstack = this.bT(); - if (l > 0 && flag1) { - // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item - EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4); - org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); + if (itemstack != null && entity instanceof EntityLiving) { + itemstack.a((EntityLiving) entity, this); + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0) { + this.bU(); + } + } - if (!combustEvent.isCancelled()) { - entity.setOnFire(combustEvent.getDuration()); + if (entity instanceof EntityLiving) { + if (entity.isAlive()) { + this.a((EntityLiving) entity, true); + } + + this.a(StatisticList.w, i); + if (l > 0 && flag2) { + // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item + EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4); + org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); + + if (!combustEvent.isCancelled()) { + entity.setOnFire(combustEvent.getDuration()); + } + // CraftBukkit end + } else if (flag1) { + entity.extinguish(); } - // CraftBukkit end } - } - this.j(0.3F); + this.j(0.3F); + } } } } @@ -834,9 +864,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void die() { super.die(); - this.defaultContainer.a(this); + this.defaultContainer.b(this); if (this.activeContainer != null) { - this.activeContainer.a(this); + this.activeContainer.b(this); } } @@ -844,7 +874,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return !this.sleeping && super.inBlock(); } - public boolean bS() { + public boolean bW() { return false; } @@ -858,7 +888,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return EnumBedResult.NOT_POSSIBLE_HERE; } - if (this.world.t()) { + if (this.world.u()) { return EnumBedResult.NOT_POSSIBLE_NOW; } @@ -914,7 +944,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen f = 0.9F; } - this.u(i1); + this.x(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)); @@ -922,7 +952,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.sleeping = true; this.sleepTicks = 0; - this.cc = new ChunkCoordinates(i, j, k); + this.bZ = new ChunkCoordinates(i, j, k); this.motX = this.motZ = this.motY = 0.0D; if (!this.world.isStatic) { this.world.everyoneSleeping(); @@ -931,32 +961,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return EnumBedResult.OK; } - private void u(int i) { - this.cd = 0.0F; - this.ce = 0.0F; + private void x(int i) { + this.ca = 0.0F; + this.cb = 0.0F; switch (i) { case 0: - this.ce = -1.8F; + this.cb = -1.8F; break; case 1: - this.cd = 1.8F; + this.ca = 1.8F; break; case 2: - this.ce = 1.8F; + this.cb = 1.8F; break; case 3: - this.cd = -1.8F; + this.ca = -1.8F; } } public void a(boolean flag, boolean flag1, boolean flag2) { this.a(0.6F, 1.8F); this.e_(); - ChunkCoordinates chunkcoordinates = this.cc; - ChunkCoordinates chunkcoordinates1 = this.cc; + ChunkCoordinates chunkcoordinates = this.bZ; + ChunkCoordinates chunkcoordinates1 = this.bZ; if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false); @@ -996,27 +1026,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } if (flag2) { - this.setRespawnPosition(this.cc, false); + this.setRespawnPosition(this.bZ, false); } } private boolean j() { - return this.world.getTypeId(this.cc.x, this.cc.y, this.cc.z) == Block.BED.id; + return this.world.getTypeId(this.bZ.x, this.bZ.y, this.bZ.z) == Block.BED.id; } public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) { - IChunkProvider ichunkprovider = world.H(); + IChunkProvider ichunkprovider = world.I(); 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) { - return flag && world.isEmpty(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) && world.isEmpty(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z) ? chunkcoordinates : null; - } else { + if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { ChunkCoordinates chunkcoordinates1 = BlockBed.b(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); + boolean flag1 = !material.isBuildable() && !material.isLiquid(); + boolean flag2 = !material1.isBuildable() && !material1.isLiquid(); + + return flag && flag1 && flag2 ? chunkcoordinates : null; } } @@ -1065,8 +1100,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void a(Statistic statistic, int i) {} - protected void bf() { - super.bf(); + protected void bi() { + super.bi(); this.a(StatisticList.u, 1); if (this.isSprinting()) { this.j(0.8F); @@ -1171,16 +1206,22 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } + public void am() { + if (!this.abilities.isFlying) { + super.am(); + } + } + public ItemStack q(int i) { return this.inventory.f(i); } - protected void bB() {} + protected void bE() {} - protected void bC() {} + protected void bF() {} public void giveExp(int i) { - this.bQ += i; + this.addScore(i); int j = Integer.MAX_VALUE - this.expTotal; if (i > j) { @@ -1204,7 +1245,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (i > 0 && this.expLevel % 5 == 0 && (float) this.h < (float) this.ticksLived - 100.0F) { float f = this.expLevel > 30 ? 1.0F : (float) this.expLevel / 30.0F; - this.world.makeSound(this, "random.levelup", f * 0.75F, 1.0F); + this.makeSound("random.levelup", f * 0.75F, 1.0F); this.h = this.ticksLived; } } @@ -1229,7 +1270,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return (flag || this.foodData.c()) && !this.abilities.isInvulnerable; } - public boolean ca() { + public boolean ce() { return this.getHealth() > 0 && this.getHealth() < this.getMaxHealth(); } @@ -1249,13 +1290,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } else { int l = this.world.getTypeId(i, j, k); - if (l > 0 && this.bP() != null) { + if (l > 0) { Block block = Block.byId[l]; - ItemStack itemstack = this.bP(); - if (itemstack.b(block) || itemstack.a(block) > 1.0F) { + if (block.material.q()) { return true; } + + if (this.bT() != null) { + ItemStack itemstack = this.bT(); + + if (itemstack.b(block) || itemstack.a(block) > 1.0F) { + return true; + } + } } return false; @@ -1292,14 +1340,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.expLevel = entityhuman.expLevel; this.expTotal = entityhuman.expTotal; this.exp = entityhuman.exp; - this.bQ = entityhuman.bQ; + this.setScore(entityhuman.getScore()); this.aq = entityhuman.aq; } else if (this.world.getGameRules().getBoolean("keepInventory")) { this.inventory.b(entityhuman.inventory); this.expLevel = entityhuman.expLevel; this.expTotal = entityhuman.expTotal; this.exp = entityhuman.exp; - this.bQ = entityhuman.bQ; + this.setScore(entityhuman.getScore()); } this.enderChest = entityhuman.enderChest; @@ -1333,7 +1381,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1]; } - public ItemStack bA() { + public ItemStack bD() { return this.inventory.getItemInHand(); } |