Handle block state in EntityDamageByBlockEvent (#9396)
This commit is contained in:
parent
3f6585c8be
commit
a0765eb7df
3 changed files with 145 additions and 64 deletions
|
@ -1,7 +1,8 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 22 Oct 2021 16:25:07 -0700
|
||||
Subject: [PATCH] Add exploded block state to BlockExplodeEvent
|
||||
Subject: [PATCH] Add exploded block state to BlockExplodeEvent and
|
||||
EntityDamageByBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
|
@ -128,3 +129,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
// See BlockStateFactory#createBlockState(World, BlockPosition, IBlockData, TileEntity)
|
||||
private static CraftBlockState getBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
CraftEventFactory.entityDamage = null;
|
||||
EntityDamageEvent event;
|
||||
if (damager == null) {
|
||||
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions);
|
||||
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions, source.explodedBlockState); // Paper - handle block state in damage
|
||||
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
|
||||
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
|
||||
} else {
|
Loading…
Add table
Add a link
Reference in a new issue