mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:39:58 +03:00
128 lines
4.8 KiB
Diff
128 lines
4.8 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java
|
|
@@ -60,6 +60,7 @@
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
|
|
|
|
public class EntityHorse extends EntityAnimal implements IInventoryChangedListener, IJumpingMount
|
|
{
|
|
@@ -70,7 +71,7 @@
|
|
return p_apply_1_ instanceof EntityHorse && ((EntityHorse)p_apply_1_).isBreeding();
|
|
}
|
|
};
|
|
- private static final IAttribute JUMP_STRENGTH = (new RangedAttribute((IAttribute)null, "horse.jumpStrength", 0.7D, 0.0D, 2.0D)).setDescription("Jump Strength").setShouldWatch(true);
|
|
+ public static final IAttribute JUMP_STRENGTH = (new RangedAttribute((IAttribute)null, "horse.jumpStrength", 0.7D, 0.0D, 2.0D)).setDescription("Jump Strength").setShouldWatch(true);
|
|
private static final UUID ARMOR_MODIFIER_UUID = UUID.fromString("556E1665-8B10-40C8-8F9D-CF9B1667F295");
|
|
private static final DataParameter<Byte> STATUS = EntityDataManager.<Byte>createKey(EntityHorse.class, DataSerializers.BYTE);
|
|
private static final DataParameter<Integer> HORSE_TYPE = EntityDataManager.<Integer>createKey(EntityHorse.class, DataSerializers.VARINT);
|
|
@@ -88,7 +89,7 @@
|
|
public int tailCounter;
|
|
public int sprintCounter;
|
|
protected boolean horseJumping;
|
|
- private AnimalChest horseChest;
|
|
+ public AnimalChest horseChest;
|
|
private boolean hasReproduced;
|
|
protected int temper;
|
|
protected float jumpPower;
|
|
@@ -104,6 +105,7 @@
|
|
private int gallopTime;
|
|
private String texturePrefix;
|
|
private final String[] horseTexturesArray = new String[3];
|
|
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
|
|
@SideOnly(Side.CLIENT)
|
|
private boolean hasTexture;
|
|
|
|
@@ -417,7 +419,7 @@
|
|
return this.isChested() && horsetype.canBeChested() ? 17 : 2;
|
|
}
|
|
|
|
- private void initHorseChest()
|
|
+ public void initHorseChest()
|
|
{
|
|
AnimalChest animalchest = this.horseChest;
|
|
this.horseChest = new AnimalChest("HorseChest", this.getChestSize());
|
|
@@ -612,7 +614,7 @@
|
|
|
|
public int getMaxTemper()
|
|
{
|
|
- return 100;
|
|
+ return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
|
|
}
|
|
|
|
protected float getSoundVolume()
|
|
@@ -816,7 +818,7 @@
|
|
|
|
if (this.getHealth() < this.getMaxHealth() && f > 0.0F)
|
|
{
|
|
- this.heal(f);
|
|
+ this.heal(f, RegainReason.EATING); // CraftBukkit
|
|
flag = true;
|
|
}
|
|
|
|
@@ -931,12 +933,14 @@
|
|
|
|
public void onDeath(DamageSource cause)
|
|
{
|
|
- super.onDeath(cause);
|
|
+ //super.onDeath(cause); // Moved down
|
|
|
|
if (!this.worldObj.isRemote)
|
|
{
|
|
this.dropChestItems();
|
|
}
|
|
+
|
|
+ super.onDeath(cause);
|
|
}
|
|
|
|
public void onLivingUpdate()
|
|
@@ -952,7 +956,7 @@
|
|
{
|
|
if (this.rand.nextInt(900) == 0 && this.deathTime == 0)
|
|
{
|
|
- this.heal(1.0F);
|
|
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
|
|
}
|
|
|
|
if (!this.isEatingHaystack() && !this.isBeingRidden() && this.rand.nextInt(300) == 0 && this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ))).getBlock() == Blocks.GRASS)
|
|
@@ -1281,6 +1285,7 @@
|
|
{
|
|
compound.setString("OwnerUUID", this.getOwnerUniqueId().toString());
|
|
}
|
|
+ compound.setInteger("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit
|
|
|
|
if (this.isChested())
|
|
{
|
|
@@ -1342,6 +1347,11 @@
|
|
{
|
|
this.setOwnerUniqueId(UUID.fromString(s));
|
|
}
|
|
+ // CraftBukkit start
|
|
+ if (compound.hasKey("Bukkit.MaxDomestication")) {
|
|
+ this.maxDomestication = compound.getInteger("Bukkit.MaxDomestication");
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
IAttributeInstance iattributeinstance = this.getAttributeMap().getAttributeInstanceByName("Speed");
|
|
|
|
@@ -1606,6 +1616,18 @@
|
|
|
|
public void handleStartJump(int p_184775_1_)
|
|
{
|
|
+ // CraftBukkit start
|
|
+ float power;
|
|
+ if (p_184775_1_ >= 90) {
|
|
+ power = 1.0F;
|
|
+ } else {
|
|
+ power = 0.4F + 0.4F * (float) p_184775_1_ / 90.0F;
|
|
+ }
|
|
+ org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callHorseJumpEvent(this, power);
|
|
+ if (event.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
this.allowStandSliding = true;
|
|
this.makeHorseRear();
|
|
}
|