mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 18:22:08 -07:00
@@ -23,10 +23,10 @@
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
@@ -81,6 +97,14 @@
|
||||
protected int bo;
|
||||
protected int bp;
|
||||
private BlockPosition bD;
|
||||
@@ -83,6 +99,14 @@
|
||||
private BlockPosition bE;
|
||||
private DamageSource bF;
|
||||
private long bG;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public int maxAirTicks = 300;
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
public void Q() {
|
||||
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
|
||||
@@ -89,7 +113,8 @@
|
||||
@@ -91,7 +115,8 @@
|
||||
public EntityLiving(World world) {
|
||||
super(world);
|
||||
this.initAttributes();
|
||||
@@ -46,9 +46,9 @@
|
||||
+ // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
|
||||
+ this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.maxHealth).getValue());
|
||||
this.i = true;
|
||||
this.aM = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.aN = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
@@ -127,7 +152,13 @@
|
||||
@@ -129,7 +154,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +220,11 @@
|
||||
@@ -191,7 +222,11 @@
|
||||
this.stopRiding();
|
||||
}
|
||||
} else {
|
||||
@@ -76,7 +76,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
@@ -246,6 +281,18 @@
|
||||
@@ -248,6 +283,18 @@
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@
|
||||
protected void b(BlockPosition blockposition) {
|
||||
int i = EnchantmentManager.a(Enchantments.j, this);
|
||||
|
||||
@@ -261,19 +308,19 @@
|
||||
@@ -263,19 +310,19 @@
|
||||
|
||||
protected void bD() {
|
||||
protected void bF() {
|
||||
++this.deathTicks;
|
||||
- if (this.deathTicks == 20) {
|
||||
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
this.die();
|
||||
|
||||
@@ -427,6 +474,17 @@
|
||||
@@ -430,6 +477,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +132,9 @@
|
||||
+ if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
|
||||
+ NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
|
||||
+ if (nbtbase.getTypeId() == 5) {
|
||||
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) ((NBTTagFloat) nbtbase).c());
|
||||
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(((NBTTagFloat) nbtbase).h()); // PAIL: rename
|
||||
+ } else if (nbtbase.getTypeId() == 3) {
|
||||
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) ((NBTTagInt) nbtbase).d());
|
||||
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(((NBTTagInt) nbtbase).h()); // PAIL: rename
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -142,7 +142,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -442,9 +500,15 @@
|
||||
@@ -449,9 +507,15 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
MobEffect mobeffect = (MobEffect) this.effects.get(mobeffectlist);
|
||||
@@ -458,6 +522,16 @@
|
||||
@@ -465,6 +529,16 @@
|
||||
this.a(mobeffect, false);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
if (this.updateEffects) {
|
||||
if (!this.world.isClientSide) {
|
||||
@@ -555,6 +629,12 @@
|
||||
@@ -562,6 +636,12 @@
|
||||
}
|
||||
|
||||
public void addEffect(MobEffect mobeffect) {
|
||||
@@ -188,7 +188,7 @@
|
||||
if (this.d(mobeffect)) {
|
||||
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
|
||||
|
||||
@@ -587,6 +667,12 @@
|
||||
@@ -594,6 +674,12 @@
|
||||
|
||||
@Nullable
|
||||
public MobEffect c(@Nullable MobEffectList mobeffectlist) {
|
||||
@@ -201,7 +201,7 @@
|
||||
return (MobEffect) this.effects.remove(mobeffectlist);
|
||||
}
|
||||
|
||||
@@ -626,20 +712,52 @@
|
||||
@@ -633,20 +719,52 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
|
||||
}
|
||||
|
||||
@@ -655,14 +773,16 @@
|
||||
@@ -662,14 +780,16 @@
|
||||
} else if (damagesource.o() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -275,7 +275,7 @@
|
||||
this.k(f);
|
||||
if (damagesource.a()) {
|
||||
f = 0.0F;
|
||||
@@ -681,19 +801,38 @@
|
||||
@@ -688,20 +808,39 @@
|
||||
|
||||
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
|
||||
if (f <= this.lastDamage) {
|
||||
@@ -301,7 +301,8 @@
|
||||
- this.damageEntity0(damagesource, f);
|
||||
+ // this.damageEntity0(damagesource, f);
|
||||
+ // CraftBukkit end
|
||||
this.hurtTicks = this.az = 10;
|
||||
this.aA = 10;
|
||||
this.hurtTicks = this.aA;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -313,10 +314,10 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.aA = 0.0F;
|
||||
this.aB = 0.0F;
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
@@ -833,6 +972,12 @@
|
||||
@@ -855,6 +994,12 @@
|
||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||
|
||||
this.a(flag, i, damagesource);
|
||||
@@ -329,7 +330,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -922,8 +1067,13 @@
|
||||
@@ -944,8 +1089,13 @@
|
||||
int i = MathHelper.f((f - 3.0F - f2) * f1);
|
||||
|
||||
if (i > 0) {
|
||||
@@ -344,7 +345,7 @@
|
||||
int j = MathHelper.floor(this.locX);
|
||||
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
|
||||
int l = MathHelper.floor(this.locZ);
|
||||
@@ -950,8 +1100,8 @@
|
||||
@@ -972,8 +1122,8 @@
|
||||
|
||||
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
||||
if (!damagesource.ignoresArmor()) {
|
||||
@@ -355,7 +356,7 @@
|
||||
}
|
||||
|
||||
return f;
|
||||
@@ -963,7 +1113,8 @@
|
||||
@@ -985,7 +1135,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
@@ -365,7 +366,7 @@
|
||||
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -984,22 +1135,127 @@
|
||||
@@ -1006,22 +1157,127 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,15 +504,15 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1065,6 +1321,7 @@
|
||||
@@ -1088,6 +1344,7 @@
|
||||
public AttributeMapBase getAttributeMap() {
|
||||
if (this.bq == null) {
|
||||
this.bq = new AttributeMapServer();
|
||||
+ this.craftAttributes = new CraftAttributeMap(bq); // CraftBukkit
|
||||
if (this.br == null) {
|
||||
this.br = new AttributeMapServer();
|
||||
+ this.craftAttributes = new CraftAttributeMap(br); // CraftBukkit // PAIL: rename
|
||||
}
|
||||
|
||||
return this.bq;
|
||||
@@ -1343,6 +1600,7 @@
|
||||
return this.br;
|
||||
@@ -1376,6 +1633,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.world.isClientSide) {
|
||||
@@ -519,7 +520,7 @@
|
||||
this.setFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -1703,6 +1961,7 @@
|
||||
@@ -1736,6 +1994,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
@@ -527,7 +528,7 @@
|
||||
this.setFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -1716,6 +1975,13 @@
|
||||
@@ -1749,6 +2008,13 @@
|
||||
if (!list.isEmpty()) {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
@@ -541,7 +542,7 @@
|
||||
|
||||
this.C(entity);
|
||||
}
|
||||
@@ -1791,11 +2057,11 @@
|
||||
@@ -1824,11 +2090,11 @@
|
||||
}
|
||||
|
||||
public boolean isInteractable() {
|
||||
@@ -554,14 +555,14 @@
|
||||
+ return !this.dead && this.collides; // CraftBukkit
|
||||
}
|
||||
|
||||
protected void ao() {
|
||||
@@ -1932,7 +2198,22 @@
|
||||
protected void ap() {
|
||||
@@ -1965,7 +2231,22 @@
|
||||
protected void v() {
|
||||
if (this.bn != null && this.ct()) {
|
||||
this.a(this.bn, 16);
|
||||
- ItemStack itemstack = this.bn.a(this.world, this);
|
||||
if (this.bo != null && this.cx()) {
|
||||
this.a(this.bo, 16);
|
||||
- ItemStack itemstack = this.bo.a(this.world, this);
|
||||
+ // CraftBukkit start - fire PlayerItemConsumeEvent
|
||||
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.bn); // PAIL: rename
|
||||
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.bo); // PAIL: rename
|
||||
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
@@ -574,12 +575,12 @@
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ItemStack itemstack = (craftItem.equals(event.getItem())) ? this.bn.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
|
||||
+ ItemStack itemstack = (craftItem.equals(event.getItem())) ? this.bo.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack != null && itemstack.count == 0) {
|
||||
itemstack = null;
|
||||
@@ -2017,7 +2298,17 @@
|
||||
@@ -2051,7 +2332,17 @@
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
|
Reference in New Issue
Block a user