2016-11-17 02:41:03 +01:00
|
|
|
--- a/net/minecraft/server/EntityHorseAbstract.java
|
|
|
|
+++ b/net/minecraft/server/EntityHorseAbstract.java
|
|
|
|
@@ -6,6 +6,7 @@
|
|
|
|
import java.util.List;
|
2016-02-29 22:32:46 +01:00
|
|
|
import java.util.UUID;
|
2016-05-10 13:47:39 +02:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
|
2016-11-17 02:41:03 +01:00
|
|
|
|
|
|
|
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable {
|
|
|
|
|
|
|
|
@@ -39,6 +40,7 @@
|
|
|
|
private float bS;
|
|
|
|
protected boolean bE = true;
|
|
|
|
protected int bF;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
public EntityHorseAbstract(World world) {
|
2014-11-25 22:32:16 +01:00
|
|
|
super(world);
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -214,7 +216,7 @@
|
|
|
|
protected void dx() {
|
2014-11-25 22:32:16 +01:00
|
|
|
InventoryHorseChest inventoryhorsechest = this.inventoryChest;
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
- this.inventoryChest = new InventoryHorseChest("HorseChest", this.di());
|
|
|
|
+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.di(), this); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
this.inventoryChest.a(this.getName());
|
|
|
|
if (inventoryhorsechest != null) {
|
|
|
|
inventoryhorsechest.b(this);
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -354,7 +356,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getMaxDomestication() {
|
|
|
|
- return 100;
|
|
|
|
+ return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
|
|
|
|
}
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
protected float ci() {
|
|
|
|
@@ -414,7 +416,7 @@
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
|
|
|
|
- this.heal(f);
|
|
|
|
+ this.heal(f, RegainReason.EATING); // CraftBukkit
|
|
|
|
flag = true;
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -465,7 +467,7 @@
|
2016-04-26 01:26:20 +02:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public void die(DamageSource damagesource) {
|
2016-04-26 01:26:20 +02:00
|
|
|
- super.die(damagesource);
|
|
|
|
+ // super.die(damagesource); // Moved down
|
2016-11-17 02:41:03 +01:00
|
|
|
if (!this.world.isClientSide && this.inventoryChest != null) {
|
|
|
|
for (int i = 0; i < this.inventoryChest.getSize(); ++i) {
|
|
|
|
ItemStack itemstack = this.inventoryChest.getItem(i);
|
|
|
|
@@ -476,6 +478,7 @@
|
|
|
|
}
|
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2016-04-26 01:26:20 +02:00
|
|
|
+ super.die(damagesource); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
public void n() {
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -486,7 +489,7 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
super.n();
|
2015-02-26 23:41:06 +01:00
|
|
|
if (!this.world.isClientSide) {
|
2014-11-25 22:32:16 +01:00
|
|
|
if (this.random.nextInt(900) == 0 && this.deathTicks == 0) {
|
|
|
|
- this.heal(1.0F);
|
|
|
|
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
if (this.dE()) {
|
|
|
|
@@ -719,6 +722,7 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
if (this.getOwnerUUID() != null) {
|
|
|
|
nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
+ nbttagcompound.setInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit
|
2016-02-29 22:32:46 +01:00
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
if (!this.inventoryChest.getItem(0).isEmpty()) {
|
|
|
|
nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound()));
|
|
|
|
@@ -745,6 +749,11 @@
|
|
|
|
if (!s.isEmpty()) {
|
2016-02-29 22:32:46 +01:00
|
|
|
this.setOwnerUUID(UUID.fromString(s));
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) {
|
|
|
|
+ this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication");
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2016-11-17 02:41:03 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
AttributeInstance attributeinstance = this.getAttributeMap().a("Speed");
|
|
|
|
|
2016-11-17 02:41:03 +01:00
|
|
|
@@ -797,6 +806,18 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
public void b(int i) {
|
|
|
|
+ // CraftBukkit start
|
2016-03-01 22:08:40 +01:00
|
|
|
+ float power;
|
|
|
|
+ if (i >= 90) {
|
|
|
|
+ power = 1.0F;
|
|
|
|
+ } else {
|
|
|
|
+ power = 0.4F + 0.4F * (float) i / 90.0F;
|
|
|
|
+ }
|
|
|
|
+ org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callHorseJumpEvent(this, power);
|
2016-02-29 22:32:46 +01:00
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
this.canSlide = true;
|
2016-11-17 02:41:03 +01:00
|
|
|
this.dL();
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|