From aa008dff0f9bedbe88e1fe79831776b0a52eb90a Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2016 08:32:46 +1100 Subject: Update to Minecraft 1.9 --- nms-patches/EntityHorse.patch | 103 ++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 64 deletions(-) (limited to 'nms-patches/EntityHorse.patch') diff --git a/nms-patches/EntityHorse.patch b/nms-patches/EntityHorse.patch index 06eece5e..db8f0aad 100644 --- a/nms-patches/EntityHorse.patch +++ b/nms-patches/EntityHorse.patch @@ -1,39 +1,32 @@ --- a/net/minecraft/server/EntityHorse.java +++ b/net/minecraft/server/EntityHorse.java -@@ -4,6 +4,8 @@ - import java.util.Iterator; +@@ -6,6 +6,8 @@ import java.util.List; + import java.util.UUID; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit + - public class EntityHorse extends EntityAnimal implements IInventoryListener { + public class EntityHorse extends EntityAnimal implements IInventoryListener, IJumpable { - private static final Predicate bs = new Predicate() { -@@ -44,6 +46,7 @@ - private String bO; - private String[] bP = new String[3]; - private boolean bQ = false; + private static final Predicate bB = new Predicate() { +@@ -52,6 +54,7 @@ + private String cd; + private String[] ce = new String[3]; + private boolean cf = false; + public int maxDomestication = 100; // CraftBukkit - store max domestication value public EntityHorse(World world) { super(world); -@@ -320,13 +323,13 @@ - private int cZ() { - int i = this.getType(); - -- return this.hasChest() && (i == 1 || i == 2) ? 17 : 2; -+ return this.hasChest() /* && (i == 1 || i == 2) */ ? 17 : 2; // CraftBukkit - Remove type check - } - +@@ -318,7 +321,7 @@ public void loadChest() { InventoryHorseChest inventoryhorsechest = this.inventoryChest; -- this.inventoryChest = new InventoryHorseChest("HorseChest", this.cZ()); -+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.cZ(), this); // CraftBukkit - add this horse +- this.inventoryChest = new InventoryHorseChest("HorseChest", this.dI()); ++ this.inventoryChest = new InventoryHorseChest("HorseChest", this.dI(), this); // CraftBukkit this.inventoryChest.a(this.getName()); if (inventoryhorsechest != null) { inventoryhorsechest.b(this); -@@ -491,7 +494,7 @@ +@@ -470,7 +473,7 @@ } public int getMaxDomestication() { @@ -41,8 +34,8 @@ + return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100 } - protected float bB() { -@@ -591,7 +594,7 @@ + protected float cd() { +@@ -560,7 +563,7 @@ } if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { @@ -51,7 +44,7 @@ flag = true; } -@@ -698,11 +701,24 @@ +@@ -652,11 +655,24 @@ public void die(DamageSource damagesource) { super.die(damagesource); @@ -61,12 +54,12 @@ } + // CraftBukkit end */ + } - ++ + // CraftBukkit start - Add method + @Override + protected void dropDeathLoot(boolean flag, int i) { + super.dropDeathLoot(flag, i); -+ + + // Moved from die method above + if (!this.world.isClientSide) { + this.dropChest(); @@ -74,27 +67,27 @@ } + // CraftBukkit end - public void m() { + public void n() { if (this.random.nextInt(200) == 0) { -@@ -712,7 +728,7 @@ - super.m(); +@@ -666,7 +682,7 @@ + super.n(); if (!this.world.isClientSide) { if (this.random.nextInt(900) == 0 && this.deathTicks == 0) { - this.heal(1.0F); + this.heal(1.0F, RegainReason.REGEN); // CraftBukkit } - if (!this.cy() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ))).getBlock() == Blocks.GRASS) { -@@ -955,6 +971,7 @@ - nbttagcompound.setInt("Temper", this.getTemper()); - nbttagcompound.setBoolean("Tame", this.isTame()); - nbttagcompound.setString("OwnerUUID", this.getOwnerUUID()); + if (!this.dm() && !this.isVehicle() && this.random.nextInt(300) == 0 && this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ))).getBlock() == Blocks.GRASS) { +@@ -919,6 +935,7 @@ + if (this.getOwnerUUID() != null) { + nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString()); + } + nbttagcompound.setInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit + if (this.hasChest()) { NBTTagList nbttaglist = new NBTTagList(); - -@@ -1007,6 +1024,12 @@ - this.setOwnerUUID(s); +@@ -974,6 +991,12 @@ + this.setOwnerUUID(UUID.fromString(s)); } + // CraftBukkit start @@ -106,34 +99,16 @@ AttributeInstance attributeinstance = this.getAttributeMap().a("Speed"); if (attributeinstance != null) { -@@ -1172,18 +1195,25 @@ - - public void v(int i) { - if (this.cG()) { -+ // CraftBukkit start - fire HorseJumpEvent, use event power - if (i < 0) { - i = 0; -- } else { -- this.bG = true; -- this.dh(); - } - -+ float power; - if (i >= 90) { -- this.br = 1.0F; -+ power = 1.0F; - } else { -- this.br = 0.4F + 0.4F * (float) i / 90.0F; -+ power = 0.4F + 0.4F * (float) i / 90.0F; -+ } -+ -+ org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callHorseJumpEvent(this, power); -+ if (!event.isCancelled()) { -+ this.bG = true; -+ this.dh(); -+ this.br = power; - } -+ // CraftBukkit end - } +@@ -1145,6 +1168,12 @@ + } + public void b(int i) { ++ // CraftBukkit start ++ org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callHorseJumpEvent(this, this.jumpPower); ++ if (event.isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + this.canSlide = true; + this.setStanding(); } -- cgit v1.2.3