#913: Handle campfire damage with EntityDamageByBlockEvent
This commit is contained in:
parent
6cfc062a5b
commit
c30e8f8d51
@ -1,6 +1,27 @@
|
|||||||
--- a/net/minecraft/world/level/block/BlockCampfire.java
|
--- a/net/minecraft/world/level/block/BlockCampfire.java
|
||||||
+++ b/net/minecraft/world/level/block/BlockCampfire.java
|
+++ b/net/minecraft/world/level/block/BlockCampfire.java
|
||||||
@@ -202,6 +202,11 @@
|
@@ -48,6 +48,10 @@
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||||
|
|
||||||
|
+// CraftBukkit start
|
||||||
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
|
+// CraftBukkit end
|
||||||
|
+
|
||||||
|
public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged {
|
||||||
|
|
||||||
|
protected static final VoxelShape SHAPE = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
|
||||||
|
@@ -92,7 +96,9 @@
|
||||||
|
@Override
|
||||||
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||||
|
if (!entity.isFireProof() && (Boolean) iblockdata.get(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.i((EntityLiving) entity)) {
|
||||||
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
|
||||||
|
entity.damageEntity(DamageSource.IN_FIRE, (float) this.fireDamage);
|
||||||
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||||
|
}
|
||||||
|
|
||||||
|
super.a(iblockdata, world, blockposition, entity);
|
||||||
|
@@ -202,6 +208,11 @@
|
||||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||||
|
|
||||||
if (!world.isClientSide && iprojectile.isBurning() && iprojectile.a(world, blockposition) && !(Boolean) iblockdata.get(BlockCampfire.LIT) && !(Boolean) iblockdata.get(BlockCampfire.WATERLOGGED)) {
|
if (!world.isClientSide && iprojectile.isBurning() && iprojectile.a(world, blockposition) && !(Boolean) iblockdata.get(BlockCampfire.LIT) && !(Boolean) iblockdata.get(BlockCampfire.WATERLOGGED)) {
|
||||||
|
@ -898,6 +898,8 @@ public class CraftEventFactory {
|
|||||||
cause = DamageCause.HOT_FLOOR;
|
cause = DamageCause.HOT_FLOOR;
|
||||||
} else if (source == DamageSource.MAGIC) {
|
} else if (source == DamageSource.MAGIC) {
|
||||||
cause = DamageCause.MAGIC;
|
cause = DamageCause.MAGIC;
|
||||||
|
} else if (source == DamageSource.IN_FIRE) {
|
||||||
|
cause = DamageCause.FIRE;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.msgId));
|
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.msgId));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user