SPIGOT-6109: Improve loot handling

This commit is contained in:
md_5 2020-08-27 19:00:36 +10:00
parent bfea455968
commit bf451617f3
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -209,7 +209,15 @@
this.world.getMethodProfiler().enter("sensing"); this.world.getMethodProfiler().enter("sensing");
this.bo.a(); this.bo.a();
this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().exit();
@@ -1023,6 +1106,12 @@ @@ -807,6 +890,7 @@
this.a(itemstack);
}
+ this.setSlot(enumitemslot, ItemStack.b); // CraftBukkit - SPIGOT-6109
}
}
@@ -1023,6 +1107,12 @@
if (!this.isAlive()) { if (!this.isAlive()) {
return EnumInteractionResult.PASS; return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) { } else if (this.getLeashHolder() == entityhuman) {
@ -222,7 +230,7 @@
this.unleash(true, !entityhuman.abilities.canInstantlyBuild); this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
return EnumInteractionResult.a(this.world.isClientSide); return EnumInteractionResult.a(this.world.isClientSide);
} else { } else {
@@ -1041,6 +1130,12 @@ @@ -1041,6 +1131,12 @@
ItemStack itemstack = entityhuman.b(enumhand); ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.LEAD && this.a(entityhuman)) { if (itemstack.getItem() == Items.LEAD && this.a(entityhuman)) {
@ -235,7 +243,7 @@
this.setLeashHolder(entityhuman, true); this.setLeashHolder(entityhuman, true);
itemstack.subtract(1); itemstack.subtract(1);
return EnumInteractionResult.a(this.world.isClientSide); return EnumInteractionResult.a(this.world.isClientSide);
@@ -1056,7 +1151,7 @@ @@ -1056,7 +1152,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) { if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.world instanceof WorldServer) { if (this.world instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem(); ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@ -244,7 +252,7 @@
optional.ifPresent((entityinsentient) -> { optional.ifPresent((entityinsentient) -> {
this.a(entityhuman, entityinsentient); this.a(entityhuman, entityinsentient);
@@ -1102,12 +1197,19 @@ @@ -1102,12 +1198,19 @@
return this.bA != -1.0F; return this.bA != -1.0F;
} }
@ -265,7 +273,7 @@
t0.u(this); t0.u(this);
t0.setBaby(this.isBaby()); t0.setBaby(this.isBaby());
@@ -1139,7 +1241,12 @@ @@ -1139,7 +1242,12 @@
} }
} }
@ -279,7 +287,7 @@
if (this.isPassenger()) { if (this.isPassenger()) {
Entity entity = this.getVehicle(); Entity entity = this.getVehicle();
@@ -1159,6 +1266,7 @@ @@ -1159,6 +1267,7 @@
if (this.leashHolder != null) { if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) { if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -287,7 +295,7 @@
this.unleash(true, true); this.unleash(true, true);
} }
@@ -1175,7 +1283,9 @@ @@ -1175,7 +1284,9 @@
this.leashHolder = null; this.leashHolder = null;
this.by = null; this.by = null;
if (!this.world.isClientSide && flag1) { if (!this.world.isClientSide && flag1) {
@ -297,7 +305,7 @@
} }
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) { if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1225,6 +1335,7 @@ @@ -1225,6 +1336,7 @@
boolean flag1 = super.a(entity, flag); boolean flag1 = super.a(entity, flag);
if (flag1 && this.isLeashed()) { if (flag1 && this.isLeashed()) {
@ -305,7 +313,7 @@
this.unleash(true, true); this.unleash(true, true);
} }
@@ -1357,7 +1468,14 @@ @@ -1357,7 +1469,14 @@
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this); int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (i > 0) { if (i > 0) {
@ -321,7 +329,7 @@
} }
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f); boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
@@ -1419,6 +1537,7 @@ @@ -1419,6 +1538,7 @@
@Override @Override
protected void bM() { protected void bM() {
super.bM(); super.bM();