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

This commit is contained in:
Miles Holder 2023-12-17 09:29:44 +11:00 committed by md_5
parent e37e29ce01
commit 659728d2a7
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -34,6 +34,15 @@
@Override @Override
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) { protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.getItemInHand(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 @@ @@ -250,10 +267,19 @@
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
float f = this.isPowered() ? 2.0F : 1.0F; float f = this.isPowered() ? 2.0F : 1.0F;