diff --git a/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSource.patch b/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSource.patch index a42500d312..11c2d5168e 100644 --- a/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSource.patch +++ b/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSource.patch @@ -1,12 +1,14 @@ --- a/net/minecraft/world/damagesource/DamageSource.java +++ b/net/minecraft/world/damagesource/DamageSource.java -@@ -21,6 +21,86 @@ +@@ -21,6 +21,88 @@ private final Entity directEntity; @Nullable private final Vec3D damageSourcePosition; + // CraftBukkit start + @Nullable + private org.bukkit.block.Block directBlock; // The block that caused the damage. damageSourcePosition is not used for all block damages ++ @Nullable ++ public org.bukkit.block.BlockState blockState; // The block state of the block relevant to this damage source + private boolean withSweep = false; + private boolean melting = false; + private boolean poison = false; diff --git a/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSources.patch b/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSources.patch index 988fa64141..e8e616bd43 100644 --- a/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSources.patch +++ b/paper-server/nms-patches/net/minecraft/world/damagesource/DamageSources.patch @@ -33,3 +33,22 @@ public DamageSource inFire() { return this.inFire; } +@@ -250,7 +266,17 @@ + } + + public DamageSource badRespawnPointExplosion(Vec3D vec3d) { +- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d); ++ // CraftBukkit start ++ return badRespawnPointExplosion(vec3d, null, null, null); ++ } ++ ++ public DamageSource badRespawnPointExplosion(Vec3D vec3d, net.minecraft.world.level.World world, net.minecraft.world.level.block.state.IBlockData blockData, net.minecraft.core.BlockPosition position) { ++ DamageSource damageSource = new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d); ++ if (world != null && blockData != null && position != null) { ++ damageSource.blockState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(world, position, blockData, null); ++ } ++ return damageSource; ++ // CraftBukkit end + } + + public DamageSource outOfBorder() { diff --git a/paper-server/nms-patches/net/minecraft/world/level/Explosion.patch b/paper-server/nms-patches/net/minecraft/world/level/Explosion.patch index 7a2387c08d..7e65299c7a 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/Explosion.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/Explosion.patch @@ -116,7 +116,7 @@ entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1)); if (entity instanceof EntityHuman) { EntityHuman entityhuman = (EntityHuman) entity; -@@ -290,9 +349,63 @@ +@@ -290,9 +349,65 @@ SystemUtils.shuffle(this.toBlow, this.level.random); ObjectListIterator objectlistiterator = this.toBlow.iterator(); @@ -143,7 +143,9 @@ + bukkitBlocks = event.blockList(); + this.yield = event.getYield(); + } else { -+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield); ++ org.bukkit.block.Block block = location.getBlock(); ++ org.bukkit.block.BlockState blockState = (damageSource.blockState != null) ? damageSource.blockState : block.getState(); ++ BlockExplodeEvent event = new BlockExplodeEvent(block, blockState, blockList, this.yield); + this.level.getCraftServer().getPluginManager().callEvent(event); + this.wasCanceled = event.isCancelled(); + bukkitBlocks = event.blockList(); @@ -180,7 +182,7 @@ this.level.getBlockState(blockposition).onExplosionHit(this.level, blockposition, this, (itemstack, blockposition1) -> { addOrAppendStack(list, itemstack, blockposition1); -@@ -317,7 +430,11 @@ +@@ -317,7 +432,11 @@ BlockPosition blockposition1 = (BlockPosition) objectlistiterator1.next(); if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition1).isAir() && this.level.getBlockState(blockposition1.below()).isSolidRender(this.level, blockposition1.below())) { @@ -193,7 +195,7 @@ } } } -@@ -325,6 +442,7 @@ +@@ -325,6 +444,7 @@ } private static void addOrAppendStack(List> list, ItemStack itemstack, BlockPosition blockposition) { diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/BlockBed.patch b/paper-server/nms-patches/net/minecraft/world/level/block/BlockBed.patch index d521c9519d..dbb8c3605b 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/BlockBed.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/BlockBed.patch @@ -44,7 +44,7 @@ + + Vec3D vec3d = blockposition.getCenter(); + -+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK); ++ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state + return EnumInteractionResult.SUCCESS; + } + } diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/BlockRespawnAnchor.patch b/paper-server/nms-patches/net/minecraft/world/level/block/BlockRespawnAnchor.patch index ce86163294..3e715a01bf 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/BlockRespawnAnchor.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/BlockRespawnAnchor.patch @@ -26,3 +26,12 @@ @Override public Optional getBlockExplosionResistance(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition1, IBlockData iblockdata1, Fluid fluid) { return blockposition1.equals(blockposition) && flag1 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, iblockaccess, blockposition1, iblockdata1, fluid); +@@ -144,7 +144,7 @@ + }; + Vec3D vec3d = blockposition.getCenter(); + +- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK); ++ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state + } + + public static boolean canSetSpawn(World world) {