#772: Add API to set equipment silently
This commit is contained in:
parent
22d7fcc98f
commit
878b43758d
@ -520,7 +520,16 @@
|
|||||||
this.world.getMethodProfiler().exit();
|
this.world.getMethodProfiler().exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1753,6 +2063,13 @@
|
@@ -1690,6 +2000,8 @@
|
||||||
|
|
||||||
|
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {}
|
||||||
|
|
||||||
|
+ public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {} // CraftBukkit
|
||||||
|
+
|
||||||
|
public boolean isBurning() {
|
||||||
|
boolean flag = this.world != null && this.world.isClientSide;
|
||||||
|
|
||||||
|
@@ -1753,6 +2065,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean flag) {
|
public void setSwimming(boolean flag) {
|
||||||
@ -534,7 +543,7 @@
|
|||||||
this.setFlag(4, flag);
|
this.setFlag(4, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1785,8 +2102,12 @@
|
@@ -1785,8 +2104,12 @@
|
||||||
return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false;
|
return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +557,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getFlag(int i) {
|
public boolean getFlag(int i) {
|
||||||
@@ -1813,16 +2134,56 @@
|
@@ -1813,16 +2136,56 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirTicks(int i) {
|
public void setAirTicks(int i) {
|
||||||
@ -608,7 +617,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void k(boolean flag) {
|
public void k(boolean flag) {
|
||||||
@@ -1972,15 +2333,32 @@
|
@@ -1972,15 +2335,32 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Entity b(WorldServer worldserver) {
|
public Entity b(WorldServer worldserver) {
|
||||||
@ -643,7 +652,7 @@
|
|||||||
this.world.getMethodProfiler().exitEnter("reloading");
|
this.world.getMethodProfiler().exitEnter("reloading");
|
||||||
Entity entity = this.getEntityType().a((World) worldserver);
|
Entity entity = this.getEntityType().a((World) worldserver);
|
||||||
|
|
||||||
@@ -1989,9 +2367,17 @@
|
@@ -1989,9 +2369,17 @@
|
||||||
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
|
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
|
||||||
entity.setMot(shapedetectorshape.velocity);
|
entity.setMot(shapedetectorshape.velocity);
|
||||||
worldserver.addEntityTeleport(entity);
|
worldserver.addEntityTeleport(entity);
|
||||||
@ -663,7 +672,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.bN();
|
this.bN();
|
||||||
@@ -2012,13 +2398,18 @@
|
@@ -2012,13 +2400,18 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected ShapeDetectorShape a(WorldServer worldserver) {
|
protected ShapeDetectorShape a(WorldServer worldserver) {
|
||||||
@ -686,7 +695,7 @@
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||||
@@ -2028,8 +2419,16 @@
|
@@ -2028,8 +2421,16 @@
|
||||||
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
|
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
|
||||||
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
||||||
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
||||||
@ -704,7 +713,7 @@
|
|||||||
IBlockData iblockdata = this.world.getType(this.ac);
|
IBlockData iblockdata = this.world.getType(this.ac);
|
||||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||||
Vec3D vec3d;
|
Vec3D vec3d;
|
||||||
@@ -2046,8 +2445,8 @@
|
@@ -2046,8 +2447,8 @@
|
||||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +724,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockPosition blockposition1;
|
BlockPosition blockposition1;
|
||||||
@@ -2057,8 +2456,15 @@
|
@@ -2057,8 +2458,15 @@
|
||||||
} else {
|
} else {
|
||||||
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
|
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
|
||||||
}
|
}
|
||||||
@ -732,7 +741,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2066,8 +2472,23 @@
|
@@ -2066,8 +2474,23 @@
|
||||||
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
|
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +767,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPortal() {
|
public boolean canPortal() {
|
||||||
@@ -2253,7 +2674,26 @@
|
@@ -2253,7 +2676,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(AxisAlignedBB axisalignedbb) {
|
public void a(AxisAlignedBB axisalignedbb) {
|
||||||
|
@ -30,7 +30,30 @@
|
|||||||
@Override
|
@Override
|
||||||
public void updateSize() {
|
public void updateSize() {
|
||||||
double d0 = this.locX();
|
double d0 = this.locX();
|
||||||
@@ -383,6 +399,21 @@
|
@@ -110,13 +126,20 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ this.setSlot(enumitemslot, itemstack, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
switch (enumitemslot.a()) {
|
||||||
|
case HAND:
|
||||||
|
- this.b(itemstack);
|
||||||
|
+ this.b(itemstack, silent); // CraftBukkit
|
||||||
|
this.handItems.set(enumitemslot.b(), itemstack);
|
||||||
|
break;
|
||||||
|
case ARMOR:
|
||||||
|
- this.b(itemstack);
|
||||||
|
+ this.b(itemstack, silent); // CraftBukkit
|
||||||
|
this.armorItems.set(enumitemslot.b(), itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -383,6 +406,21 @@
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
ItemStack itemstack2;
|
ItemStack itemstack2;
|
||||||
@ -52,7 +75,7 @@
|
|||||||
|
|
||||||
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
||||||
itemstack2 = itemstack.cloneItemStack();
|
itemstack2 = itemstack.cloneItemStack();
|
||||||
@@ -411,12 +442,22 @@
|
@@ -411,12 +449,22 @@
|
||||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||||
if (!this.world.isClientSide && !this.dead) {
|
if (!this.world.isClientSide && !this.dead) {
|
||||||
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|
||||||
@ -78,7 +101,7 @@
|
|||||||
return false;
|
return false;
|
||||||
} else if (DamageSource.FIRE.equals(damagesource)) {
|
} else if (DamageSource.FIRE.equals(damagesource)) {
|
||||||
if (this.isBurning()) {
|
if (this.isBurning()) {
|
||||||
@@ -441,7 +482,7 @@
|
@@ -441,7 +489,7 @@
|
||||||
} else if (damagesource.v()) {
|
} else if (damagesource.v()) {
|
||||||
this.F();
|
this.F();
|
||||||
this.D();
|
this.D();
|
||||||
@ -87,7 +110,7 @@
|
|||||||
return flag1;
|
return flag1;
|
||||||
} else {
|
} else {
|
||||||
long i = this.world.getTime();
|
long i = this.world.getTime();
|
||||||
@@ -452,7 +493,7 @@
|
@@ -452,7 +500,7 @@
|
||||||
} else {
|
} else {
|
||||||
this.f(damagesource);
|
this.f(damagesource);
|
||||||
this.D();
|
this.D();
|
||||||
@ -96,7 +119,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -479,7 +520,7 @@
|
@@ -479,7 +527,7 @@
|
||||||
f1 -= f;
|
f1 -= f;
|
||||||
if (f1 <= 0.5F) {
|
if (f1 <= 0.5F) {
|
||||||
this.g(damagesource);
|
this.g(damagesource);
|
||||||
@ -105,7 +128,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.setHealth(f1);
|
this.setHealth(f1);
|
||||||
}
|
}
|
||||||
@@ -487,13 +528,13 @@
|
@@ -487,13 +535,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void f(DamageSource damagesource) {
|
private void f(DamageSource damagesource) {
|
||||||
@ -121,7 +144,7 @@
|
|||||||
|
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
int i;
|
int i;
|
||||||
@@ -501,7 +542,7 @@
|
@@ -501,7 +549,7 @@
|
||||||
for (i = 0; i < this.handItems.size(); ++i) {
|
for (i = 0; i < this.handItems.size(); ++i) {
|
||||||
itemstack = (ItemStack) this.handItems.get(i);
|
itemstack = (ItemStack) this.handItems.get(i);
|
||||||
if (!itemstack.isEmpty()) {
|
if (!itemstack.isEmpty()) {
|
||||||
@ -130,7 +153,7 @@
|
|||||||
this.handItems.set(i, ItemStack.b);
|
this.handItems.set(i, ItemStack.b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,10 +550,11 @@
|
@@ -509,10 +557,11 @@
|
||||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||||
itemstack = (ItemStack) this.armorItems.get(i);
|
itemstack = (ItemStack) this.armorItems.get(i);
|
||||||
if (!itemstack.isEmpty()) {
|
if (!itemstack.isEmpty()) {
|
||||||
@ -143,7 +166,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,8 +655,16 @@
|
@@ -613,8 +662,16 @@
|
||||||
return this.isSmall();
|
return this.isSmall();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1603,26 +1762,31 @@
|
@@ -1555,14 +1714,21 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ this.setSlot(enumitemslot, itemstack, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
if (enumitemslot == EnumItemSlot.MAINHAND) {
|
||||||
|
- this.b(itemstack);
|
||||||
|
+ this.b(itemstack, silent); // CraftBukkit
|
||||||
|
this.inventory.items.set(this.inventory.itemInHandIndex, itemstack);
|
||||||
|
} else if (enumitemslot == EnumItemSlot.OFFHAND) {
|
||||||
|
- this.b(itemstack);
|
||||||
|
+ this.b(itemstack, silent); // CraftBukkit
|
||||||
|
this.inventory.extraSlots.set(0, itemstack);
|
||||||
|
} else if (enumitemslot.a() == EnumItemSlot.Function.ARMOR) {
|
||||||
|
- this.b(itemstack);
|
||||||
|
+ this.b(itemstack, silent); // CraftBukkit
|
||||||
|
this.inventory.armor.set(enumitemslot.b(), itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1603,26 +1769,31 @@
|
||||||
|
|
||||||
protected void releaseShoulderEntities() {
|
protected void releaseShoulderEntities() {
|
||||||
if (this.e + 20L < this.world.getTime()) {
|
if (this.e + 20L < this.world.getTime()) {
|
||||||
|
@ -85,7 +85,22 @@
|
|||||||
this.die();
|
this.die();
|
||||||
|
|
||||||
for (int i = 0; i < 20; ++i) {
|
for (int i = 0; i < 20; ++i) {
|
||||||
@@ -567,6 +611,17 @@
|
@@ -497,7 +541,13 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void b(ItemStack itemstack) {
|
||||||
|
- if (!itemstack.isEmpty()) {
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ this.b(itemstack, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void b(ItemStack itemstack, boolean silent) {
|
||||||
|
+ if (!itemstack.isEmpty() && !silent) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
SoundEffect soundeffect = SoundEffects.ITEM_ARMOR_EQUIP_GENERIC;
|
||||||
|
Item item = itemstack.getItem();
|
||||||
|
|
||||||
|
@@ -567,6 +617,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +118,7 @@
|
|||||||
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
||||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||||
}
|
}
|
||||||
@@ -604,9 +659,32 @@
|
@@ -604,9 +665,32 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +151,7 @@
|
|||||||
try {
|
try {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||||
@@ -616,6 +694,12 @@
|
@@ -616,6 +700,12 @@
|
||||||
this.a(mobeffect, true);
|
this.a(mobeffect, true);
|
||||||
})) {
|
})) {
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@ -149,7 +164,7 @@
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
this.b(mobeffect);
|
this.b(mobeffect);
|
||||||
}
|
}
|
||||||
@@ -626,6 +710,17 @@
|
@@ -626,6 +716,17 @@
|
||||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -167,7 +182,7 @@
|
|||||||
|
|
||||||
if (this.updateEffects) {
|
if (this.updateEffects) {
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@@ -735,7 +830,13 @@
|
@@ -735,7 +836,13 @@
|
||||||
this.datawatcher.set(EntityLiving.f, 0);
|
this.datawatcher.set(EntityLiving.f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +196,7 @@
|
|||||||
if (this.world.isClientSide) {
|
if (this.world.isClientSide) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -744,7 +845,14 @@
|
@@ -744,7 +851,14 @@
|
||||||
boolean flag;
|
boolean flag;
|
||||||
|
|
||||||
for (flag = false; iterator.hasNext(); flag = true) {
|
for (flag = false; iterator.hasNext(); flag = true) {
|
||||||
@ -197,7 +212,7 @@
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,18 +877,44 @@
|
@@ -769,18 +883,44 @@
|
||||||
return (MobEffect) this.effects.get(mobeffectlist);
|
return (MobEffect) this.effects.get(mobeffectlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +258,7 @@
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -804,13 +938,39 @@
|
@@ -804,13 +944,39 @@
|
||||||
return this.getMonsterType() == EnumMonsterType.UNDEAD;
|
return this.getMonsterType() == EnumMonsterType.UNDEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +299,7 @@
|
|||||||
|
|
||||||
if (mobeffect != null) {
|
if (mobeffect != null) {
|
||||||
this.b(mobeffect);
|
this.b(mobeffect);
|
||||||
@@ -847,20 +1007,55 @@
|
@@ -847,20 +1013,55 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +356,7 @@
|
|||||||
this.datawatcher.set(EntityLiving.HEALTH, MathHelper.a(f, 0.0F, this.getMaxHealth()));
|
this.datawatcher.set(EntityLiving.HEALTH, MathHelper.a(f, 0.0F, this.getMaxHealth()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,7 +1069,7 @@
|
@@ -874,7 +1075,7 @@
|
||||||
return false;
|
return false;
|
||||||
} else if (this.world.isClientSide) {
|
} else if (this.world.isClientSide) {
|
||||||
return false;
|
return false;
|
||||||
@ -350,7 +365,7 @@
|
|||||||
return false;
|
return false;
|
||||||
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -886,17 +1081,19 @@
|
@@ -886,17 +1087,19 @@
|
||||||
this.ticksFarFromPlayer = 0;
|
this.ticksFarFromPlayer = 0;
|
||||||
float f1 = f;
|
float f1 = f;
|
||||||
|
|
||||||
@ -373,7 +388,7 @@
|
|||||||
this.damageShield(f);
|
this.damageShield(f);
|
||||||
f2 = f;
|
f2 = f;
|
||||||
f = 0.0F;
|
f = 0.0F;
|
||||||
@@ -916,20 +1113,39 @@
|
@@ -916,20 +1119,39 @@
|
||||||
|
|
||||||
if ((float) this.noDamageTicks > 10.0F) {
|
if ((float) this.noDamageTicks > 10.0F) {
|
||||||
if (f <= this.lastDamage) {
|
if (f <= this.lastDamage) {
|
||||||
@ -415,7 +430,7 @@
|
|||||||
this.ap = 0.0F;
|
this.ap = 0.0F;
|
||||||
Entity entity1 = damagesource.getEntity();
|
Entity entity1 = damagesource.getEntity();
|
||||||
|
|
||||||
@@ -1050,19 +1266,29 @@
|
@@ -1050,19 +1272,29 @@
|
||||||
EnumHand[] aenumhand = EnumHand.values();
|
EnumHand[] aenumhand = EnumHand.values();
|
||||||
int i = aenumhand.length;
|
int i = aenumhand.length;
|
||||||
|
|
||||||
@ -449,7 +464,7 @@
|
|||||||
EntityPlayer entityplayer = (EntityPlayer) this;
|
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||||
|
|
||||||
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
|
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
|
||||||
@@ -1070,14 +1296,16 @@
|
@@ -1070,14 +1302,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setHealth(1.0F);
|
this.setHealth(1.0F);
|
||||||
@ -471,7 +486,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1194,28 +1422,46 @@
|
@@ -1194,28 +1428,46 @@
|
||||||
|
|
||||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||||
|
|
||||||
@ -520,7 +535,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1336,9 +1582,14 @@
|
@@ -1336,9 +1588,14 @@
|
||||||
int i = this.e(f, f1);
|
int i = this.e(f, f1);
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -536,7 +551,7 @@
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return flag;
|
return flag;
|
||||||
@@ -1378,7 +1629,7 @@
|
@@ -1378,7 +1635,7 @@
|
||||||
|
|
||||||
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
||||||
if (!damagesource.ignoresArmor()) {
|
if (!damagesource.ignoresArmor()) {
|
||||||
@ -545,7 +560,7 @@
|
|||||||
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
|
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,7 +1642,8 @@
|
@@ -1391,7 +1648,8 @@
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -555,7 +570,7 @@
|
|||||||
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
||||||
int j = 25 - i;
|
int j = 25 - i;
|
||||||
float f1 = f * (float) j;
|
float f1 = f * (float) j;
|
||||||
@@ -1422,28 +1674,173 @@
|
@@ -1422,28 +1680,173 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +589,10 @@
|
|||||||
+ public Double apply(Double f) {
|
+ public Double apply(Double f) {
|
||||||
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !EntityLiving.this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !EntityLiving.this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||||
+ return -(f - (f * 0.75F));
|
+ return -(f - (f * 0.75F));
|
||||||
+
|
|
||||||
|
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
|
||||||
|
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
|
||||||
|
- float f2 = f1 - f;
|
||||||
+ }
|
+ }
|
||||||
+ return -0.0;
|
+ return -0.0;
|
||||||
+ }
|
+ }
|
||||||
@ -666,21 +684,18 @@
|
|||||||
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
||||||
+ this.damageArmor(damagesource, armorDamage);
|
+ this.damageArmor(damagesource, armorDamage);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ // Apply blocking code // PAIL: steal from above
|
+ // Apply blocking code // PAIL: steal from above
|
||||||
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||||
+ this.world.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
+ this.world.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||||
+ this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
+ this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||||
+ Entity entity = damagesource.j();
|
+ Entity entity = damagesource.j();
|
||||||
|
+
|
||||||
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
|
|
||||||
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
|
|
||||||
- float f2 = f1 - f;
|
|
||||||
+ if (entity instanceof EntityLiving) {
|
+ if (entity instanceof EntityLiving) {
|
||||||
+ this.shieldBlock((EntityLiving) entity);
|
+ this.shieldBlock((EntityLiving) entity);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
|
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
|
||||||
+ this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F));
|
+ this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F));
|
||||||
+ float f2 = absorptionModifier;
|
+ float f2 = absorptionModifier;
|
||||||
@ -739,7 +754,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CombatTracker getCombatTracker() {
|
public CombatTracker getCombatTracker() {
|
||||||
@@ -1464,9 +1861,19 @@
|
@@ -1464,9 +1867,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setArrowCount(int i) {
|
public final void setArrowCount(int i) {
|
||||||
@ -760,7 +775,7 @@
|
|||||||
public final int dz() {
|
public final int dz() {
|
||||||
return (Integer) this.datawatcher.get(EntityLiving.bi);
|
return (Integer) this.datawatcher.get(EntityLiving.bi);
|
||||||
}
|
}
|
||||||
@@ -1816,6 +2223,7 @@
|
@@ -1816,6 +2229,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.onGround && !this.world.isClientSide) {
|
if (this.onGround && !this.world.isClientSide) {
|
||||||
@ -768,7 +783,7 @@
|
|||||||
this.setFlag(7, false);
|
this.setFlag(7, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2321,6 +2729,7 @@
|
@@ -2321,6 +2735,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@ -776,7 +791,7 @@
|
|||||||
this.setFlag(7, flag);
|
this.setFlag(7, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2441,6 +2850,7 @@
|
@@ -2441,6 +2856,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasLineOfSight(Entity entity) {
|
public boolean hasLineOfSight(Entity entity) {
|
||||||
@ -784,7 +799,7 @@
|
|||||||
Vec3D vec3d = new Vec3D(this.locX(), this.getHeadY(), this.locZ());
|
Vec3D vec3d = new Vec3D(this.locX(), this.getHeadY(), this.locZ());
|
||||||
Vec3D vec3d1 = new Vec3D(entity.locX(), entity.getHeadY(), entity.locZ());
|
Vec3D vec3d1 = new Vec3D(entity.locX(), entity.getHeadY(), entity.locZ());
|
||||||
|
|
||||||
@@ -2458,14 +2868,21 @@
|
@@ -2458,14 +2874,21 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInteractable() {
|
public boolean isInteractable() {
|
||||||
@ -808,7 +823,7 @@
|
|||||||
@Override
|
@Override
|
||||||
protected void velocityChanged() {
|
protected void velocityChanged() {
|
||||||
this.velocityChanged = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE);
|
this.velocityChanged = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE);
|
||||||
@@ -2658,7 +3075,25 @@
|
@@ -2658,7 +3081,25 @@
|
||||||
} else {
|
} else {
|
||||||
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
|
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
|
||||||
this.b(this.activeItem, 16);
|
this.b(this.activeItem, 16);
|
||||||
@ -835,7 +850,7 @@
|
|||||||
|
|
||||||
if (itemstack != this.activeItem) {
|
if (itemstack != this.activeItem) {
|
||||||
this.a(enumhand, itemstack);
|
this.a(enumhand, itemstack);
|
||||||
@@ -2750,10 +3185,18 @@
|
@@ -2750,10 +3191,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
@ -857,7 +872,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2850,7 +3293,7 @@
|
@@ -2850,7 +3299,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void entityWakeup() {
|
public void entityWakeup() {
|
||||||
@ -866,7 +881,7 @@
|
|||||||
World world = this.world;
|
World world = this.world;
|
||||||
|
|
||||||
this.world.getClass();
|
this.world.getClass();
|
||||||
@@ -2921,7 +3364,7 @@
|
@@ -2921,7 +3370,7 @@
|
||||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||||
|
|
||||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||||
|
@ -20,9 +20,14 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItem(EquipmentSlot slot, ItemStack item) {
|
public void setItem(EquipmentSlot slot, ItemStack item) {
|
||||||
|
this.setItem(slot, item, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItem(EquipmentSlot slot, ItemStack item, boolean silent) {
|
||||||
Preconditions.checkArgument(slot != null, "slot must not be null");
|
Preconditions.checkArgument(slot != null, "slot must not be null");
|
||||||
EnumItemSlot nmsSlot = CraftEquipmentSlot.getNMS(slot);
|
EnumItemSlot nmsSlot = CraftEquipmentSlot.getNMS(slot);
|
||||||
setEquipment(nmsSlot, item);
|
setEquipment(nmsSlot, item, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,7 +44,12 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItemInMainHand(ItemStack item) {
|
public void setItemInMainHand(ItemStack item) {
|
||||||
setEquipment(EnumItemSlot.MAINHAND, item);
|
this.setItemInMainHand(item, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemInMainHand(ItemStack item, boolean silent) {
|
||||||
|
setEquipment(EnumItemSlot.MAINHAND, item, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +59,12 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItemInOffHand(ItemStack item) {
|
public void setItemInOffHand(ItemStack item) {
|
||||||
setEquipment(EnumItemSlot.OFFHAND, item);
|
this.setItemInOffHand(item, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemInOffHand(ItemStack item, boolean silent) {
|
||||||
|
setEquipment(EnumItemSlot.OFFHAND, item, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,7 +84,12 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHelmet(ItemStack helmet) {
|
public void setHelmet(ItemStack helmet) {
|
||||||
setEquipment(EnumItemSlot.HEAD, helmet);
|
this.setHelmet(helmet, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHelmet(ItemStack helmet, boolean silent) {
|
||||||
|
setEquipment(EnumItemSlot.HEAD, helmet, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -79,7 +99,12 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setChestplate(ItemStack chestplate) {
|
public void setChestplate(ItemStack chestplate) {
|
||||||
setEquipment(EnumItemSlot.CHEST, chestplate);
|
this.setChestplate(chestplate, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChestplate(ItemStack chestplate, boolean silent) {
|
||||||
|
setEquipment(EnumItemSlot.CHEST, chestplate, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -89,7 +114,12 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLeggings(ItemStack leggings) {
|
public void setLeggings(ItemStack leggings) {
|
||||||
setEquipment(EnumItemSlot.LEGS, leggings);
|
this.setLeggings(leggings, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLeggings(ItemStack leggings, boolean silent) {
|
||||||
|
setEquipment(EnumItemSlot.LEGS, leggings, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,7 +129,12 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBoots(ItemStack boots) {
|
public void setBoots(ItemStack boots) {
|
||||||
setEquipment(EnumItemSlot.FEET, boots);
|
this.setBoots(boots, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBoots(ItemStack boots, boolean silent) {
|
||||||
|
setEquipment(EnumItemSlot.FEET, boots, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,24 +150,24 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setArmorContents(ItemStack[] items) {
|
public void setArmorContents(ItemStack[] items) {
|
||||||
setEquipment(EnumItemSlot.FEET, items.length >= 1 ? items[0] : null);
|
setEquipment(EnumItemSlot.FEET, items.length >= 1 ? items[0] : null, false);
|
||||||
setEquipment(EnumItemSlot.LEGS, items.length >= 2 ? items[1] : null);
|
setEquipment(EnumItemSlot.LEGS, items.length >= 2 ? items[1] : null, false);
|
||||||
setEquipment(EnumItemSlot.CHEST, items.length >= 3 ? items[2] : null);
|
setEquipment(EnumItemSlot.CHEST, items.length >= 3 ? items[2] : null, false);
|
||||||
setEquipment(EnumItemSlot.HEAD, items.length >= 4 ? items[3] : null);
|
setEquipment(EnumItemSlot.HEAD, items.length >= 4 ? items[3] : null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getEquipment(EnumItemSlot slot) {
|
private ItemStack getEquipment(EnumItemSlot slot) {
|
||||||
return CraftItemStack.asBukkitCopy(entity.getHandle().getEquipment(slot));
|
return CraftItemStack.asBukkitCopy(entity.getHandle().getEquipment(slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setEquipment(EnumItemSlot slot, ItemStack stack) {
|
private void setEquipment(EnumItemSlot slot, ItemStack stack, boolean silent) {
|
||||||
entity.getHandle().setSlot(slot, CraftItemStack.asNMSCopy(stack));
|
entity.getHandle().setSlot(slot, CraftItemStack.asNMSCopy(stack), silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||||
setEquipment(slot, null);
|
setEquipment(slot, null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,11 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
|||||||
setItem(getHeldItemSlot(), item);
|
setItem(getHeldItemSlot(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemInMainHand(ItemStack item, boolean silent) {
|
||||||
|
setItemInMainHand(item); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemInOffHand() {
|
public ItemStack getItemInOffHand() {
|
||||||
return CraftItemStack.asCraftMirror(getInventory().extraSlots.get(0));
|
return CraftItemStack.asCraftMirror(getInventory().extraSlots.get(0));
|
||||||
@ -49,6 +54,11 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
|||||||
setExtraContents(extra);
|
setExtraContents(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemInOffHand(ItemStack item, boolean silent) {
|
||||||
|
setItemInOffHand(item); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemInHand() {
|
public ItemStack getItemInHand() {
|
||||||
return getItemInMainHand();
|
return getItemInMainHand();
|
||||||
@ -131,6 +141,11 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItem(EquipmentSlot slot, ItemStack item, boolean silent) {
|
||||||
|
setItem(slot, item); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItem(EquipmentSlot slot) {
|
public ItemStack getItem(EquipmentSlot slot) {
|
||||||
Preconditions.checkArgument(slot != null, "slot must not be null");
|
Preconditions.checkArgument(slot != null, "slot must not be null");
|
||||||
@ -190,21 +205,41 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
|||||||
setItem(getSize() - 2, helmet);
|
setItem(getSize() - 2, helmet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHelmet(ItemStack helmet, boolean silent) {
|
||||||
|
setHelmet(helmet); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setChestplate(ItemStack chestplate) {
|
public void setChestplate(ItemStack chestplate) {
|
||||||
setItem(getSize() - 3, chestplate);
|
setItem(getSize() - 3, chestplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChestplate(ItemStack chestplate, boolean silent) {
|
||||||
|
setChestplate(chestplate); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLeggings(ItemStack leggings) {
|
public void setLeggings(ItemStack leggings) {
|
||||||
setItem(getSize() - 4, leggings);
|
setItem(getSize() - 4, leggings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLeggings(ItemStack leggings, boolean silent) {
|
||||||
|
setLeggings(leggings); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBoots(ItemStack boots) {
|
public void setBoots(ItemStack boots) {
|
||||||
setItem(getSize() - 5, boots);
|
setItem(getSize() - 5, boots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBoots(ItemStack boots, boolean silent) {
|
||||||
|
setBoots(boots); // Silence doesn't apply to players
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getArmorContents() {
|
public ItemStack[] getArmorContents() {
|
||||||
return asCraftMirror(getInventory().armor);
|
return asCraftMirror(getInventory().armor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user