mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-20 22:18:58 +01:00
Revert "Always pass event block to damage source (#12158)"
This reverts commit ab984a0711
.
The block damage is null *and has been* null in cases where the block
has already been cleared. Consumers are supposed to use the
getDamagerBlockState instead.
This commit is contained in:
parent
ab984a0711
commit
7b4d44f573
3 changed files with 4 additions and 9 deletions
paper-server/patches/sources/net/minecraft/world
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -20,6 +_,97 @@
|
||||
@@ -20,6 +_,92 @@
|
||||
private final Entity directEntity;
|
||||
@Nullable
|
||||
private final Vec3 damageSourcePosition;
|
||||
|
@ -60,16 +60,11 @@
|
|||
+ return this.fromBlockSnapshot;
|
||||
+ }
|
||||
+
|
||||
+ public DamageSource causingBlockSnapshot(
|
||||
+ final net.minecraft.world.level.LevelAccessor level,
|
||||
+ final net.minecraft.core.BlockPos pos,
|
||||
+ final @Nullable org.bukkit.block.BlockState blockState
|
||||
+ ) {
|
||||
+ public DamageSource causingBlockSnapshot(final @Nullable org.bukkit.block.BlockState blockState) {
|
||||
+ if (this.eventBlockDamager != null) {
|
||||
+ throw new IllegalStateException("Cannot set a block snapshot when an event block damager is already set (report a bug to Paper)");
|
||||
+ }
|
||||
+ final DamageSource damageSource = this.copy();
|
||||
+ damageSource.eventBlockDamager = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos);
|
||||
+ damageSource.fromBlockSnapshot = blockState;
|
||||
+ return damageSource;
|
||||
+ }
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
+ }
|
||||
+
|
||||
+ Vec3 center = pos.getCenter();
|
||||
+ level.explode(null, level.damageSources().badRespawnPointExplosion(center).causingBlockSnapshot(level, pos, blockState), null, center, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
|
||||
+ level.explode(null, level.damageSources().badRespawnPointExplosion(center).causingBlockSnapshot(blockState), null, center, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
|
||||
+ return InteractionResult.SUCCESS_SERVER;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
Vec3 center = pos2.getCenter();
|
||||
level.explode(
|
||||
- null, level.damageSources().badRespawnPointExplosion(center), explosionDamageCalculator, center, 5.0F, true, Level.ExplosionInteraction.BLOCK
|
||||
+ null, level.damageSources().badRespawnPointExplosion(center).causingBlockSnapshot(level, pos2, blockState), explosionDamageCalculator, center, 5.0F, true, Level.ExplosionInteraction.BLOCK // CraftBukkit - add state
|
||||
+ null, level.damageSources().badRespawnPointExplosion(center).causingBlockSnapshot(blockState), explosionDamageCalculator, center, 5.0F, true, Level.ExplosionInteraction.BLOCK // CraftBukkit - add state
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue