public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.o(nbttagcompound.getBoolean("EatingHaystack")); this.k(nbttagcompound.getBoolean("Bred")); this.setHasChest(nbttagcompound.getBoolean("ChestedHorse")); this.m(nbttagcompound.getBoolean("HasReproduced")); this.setType(nbttagcompound.getInt("Type")); this.setVariant(nbttagcompound.getInt("Variant")); this.setTemper(nbttagcompound.getInt("Temper")); this.setTame(nbttagcompound.getBoolean("Tame")); if (nbttagcompound.hasKeyOfType("OwnerUUID", 8)) { this.setOwnerUUID(nbttagcompound.getString("OwnerUUID")); } // CraftBukkit start if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) { this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication"); } // CraftBukkit end AttributeInstance attributeinstance = this.bb().a("Speed"); if (attributeinstance != null) { this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D); } if (this.hasChest()) { NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.loadChest(); for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.get(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 2 && j < this.inventoryChest.getSize()) { this.inventoryChest.setItem(j, ItemStack.createStack(nbttagcompound1)); } } } ItemStack itemstack; if (nbttagcompound.hasKeyOfType("ArmorItem", 10)) { itemstack = ItemStack.createStack(nbttagcompound.getCompound("ArmorItem")); if (itemstack != null && a(itemstack.getItem())) { this.inventoryChest.setItem(1, itemstack); } } if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) { itemstack = ItemStack.createStack(nbttagcompound.getCompound("SaddleItem")); if (itemstack != null && itemstack.getItem() == Items.SADDLE) { this.inventoryChest.setItem(0, itemstack); } } else if (nbttagcompound.getBoolean("Saddle")) { this.inventoryChest.setItem(0, new ItemStack(Items.SADDLE)); } this.cO(); }
public void setSprinting(boolean flag) { super.setSprinting(flag); AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); if (attributeinstance.a(b) != null) { attributeinstance.b(c); } if (flag) { attributeinstance.a(c); } }
public void e() { if (this.L()) { this.damageEntity(DamageSource.DROWN, 1.0F); } if (this.bu != this.target) { AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); attributeinstance.b(bq); if (this.target != null) { attributeinstance.a(bq); } } this.bu = this.target; int i; if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) { int j; int k; Block block; if (this.getCarried().getMaterial() == Material.AIR) { if (this.random.nextInt(20) == 0) { i = MathHelper.floor(this.locX - 2.0D + this.random.nextDouble() * 4.0D); j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D); k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D); block = this.world.getType(i, j, k); if (br[Block.getId(block)]) { this.setCarried(block); this.setCarriedData(this.world.getData(i, j, k)); this.world.setTypeUpdate(i, j, k, Blocks.AIR); } } } else if (this.random.nextInt(2000) == 0) { i = MathHelper.floor(this.locX - 1.0D + this.random.nextDouble() * 2.0D); j = MathHelper.floor(this.locY + this.random.nextDouble() * 2.0D); k = MathHelper.floor(this.locZ - 1.0D + this.random.nextDouble() * 2.0D); block = this.world.getType(i, j, k); Block block1 = this.world.getType(i, j - 1, k); if (block.getMaterial() == Material.AIR && block1.getMaterial() != Material.AIR && block1.d()) { this.world.setTypeAndData(i, j, k, this.getCarried(), this.getCarriedData(), 3); this.setCarried(Blocks.AIR); } } } for (i = 0; i < 2; ++i) { this.world.addParticle( "portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } if (this.world.w() && !this.world.isStatic) { float f = this.d(1.0F); if (f > 0.5F && this.world.i( MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { this.target = null; this.a(false); this.bv = false; this.bZ(); } } if (this.L() || this.isBurning()) { this.target = null; this.a(false); this.bv = false; this.bZ(); } if (this.cd() && !this.bv && this.random.nextInt(100) == 0) { this.a(false); } this.bc = false; if (this.target != null) { this.a(this.target, 100.0F, 100.0F); } if (!this.world.isStatic && this.isAlive()) { if (this.target != null) { if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) { if (this.target.f((Entity) this) < 16.0D) { this.bZ(); } this.bs = 0; } else if (this.target.f((Entity) this) > 256.0D && this.bs++ >= 30 && this.c(this.target)) { this.bs = 0; } } else { this.a(false); this.bs = 0; } } super.e(); }