testserver/patches/server/0740-call-EntityDamageByBlo...

21 lines
1.5 KiB
Diff

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);