call EntityDamageByBlockEvent for campfires (#6244)

This commit is contained in:
Jake Potrebic 2021-08-06 17:20:39 -07:00 committed by GitHub
parent 23e3a0ccb6
commit 00028d57cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 21 Jul 2021 11:46:28 -0700
Subject: [PATCH] call EntityDamageByBlockEvent for campfires
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
index 2519a0f511f0a6065459cd2fe2d9a3e68e55d222..2c334ce3fc3cf86704dee9397166119a3b5f17e2 100644
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
@@ -93,7 +93,9 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
if (!entity.fireImmune() && (Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); // Paper
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // Paper
}
super.entityInside(state, world, pos, entity);