MC-264285, SPIGOT-7439, #1237: Fix unbreakable flint and steel is completely consumed while igniting creeper

By: Miles Holder <mwholder2005@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2023-12-17 09:29:44 +11:00
parent 3c241dbb64
commit 6f023adfe9

View file

@ -34,6 +34,15 @@
@Override
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -231,7 +248,7 @@
this.level().playSound(entityhuman, 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()) {
+ if (itemstack.getItem().getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
itemstack.shrink(1);
} else {
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -250,10 +267,19 @@
if (!this.level().isClientSide) {
float f = this.isPowered() ? 2.0F : 1.0F;