Fix fire charge not being consumed igniting a creeper (#8652)

This commit is contained in:
Jake Potrebic 2022-12-13 09:23:05 -08:00 committed by GitHub
parent 3822cc891d
commit adb8e499db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,10 @@ https://bugs.mojang.com/browse/MC-121048
clear the CombatTracker if the entity is dead. This fixes death messages
such as the "doomed to fall" messages.
https://bugs.mojang.com/browse/MC-257875
by: Jake Potrebic <jake.m.potrebic@gmail.com>
Fixes server not consuming fire charges when igniting a creeper
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: MelnCat <melncatuwu@gmail.com>
@ -172,6 +176,26 @@ index 821b88d0c32f946af9af1c2e211b38446fab4ecb..72d660cd2ade39335024897cffb8b8a1
if (!player.getAbilities().instabuild) {
stack.shrink(1);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 805e267090285d625dbeb75b06f8c5ad141a75a4..338161d2eb15d9264027961b71678b8d2f020fd8 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -247,9 +247,15 @@ public class Creeper extends Monster implements PowerableMob {
this.level.playSound(player, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
if (!this.level.isClientSide) {
this.ignite();
+ if (itemstack.isDamageableItem()) { // Paper - only call hurtAndBreak for a damageable item - MC-257875
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
entityhuman1.broadcastBreakEvent(hand);
});
+ // Paper start - just consume the item - MC-257875
+ } else if (!player.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ }
+ // Paper end
}
return InteractionResult.sidedSuccess(this.level.isClientSide);
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
index f174094febfdfdc309f1b50877be60bae8a98156..5f407535298a31a34cfe114dd863fd6a9b977707 100644
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java