mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@f7124df Fix recursive chunk loading in chunk unload event PaperMC/Paper@8b558d9 Apply entity tracker desync patch PaperMC/Paper@a594d18 Fix entities not being visible to clients when teleporting PaperMC/Paper@f250ec0 Increment ChunkHolderManager current tick PaperMC/Paper@7bd22b1 Optimise entity tracker PaperMC/Paper@90ae1dc Port collision optimisation patch from Moonrise PaperMC/Paper@821081d Drop unapplied patches PaperMC/Paper@1d0fcb5 Port lag compensation patch PaperMC/Paper@0e02aa5 Port watchdog detail patch PaperMC/Paper@c6e9579 Fix explosions calculation getting stuck (#11061) PaperMC/Paper@2773dc4 Add light block to indestructible block list PaperMC/Paper@70ff1ec Only skip damage tick if damage is unmodified zero (#11058)
37 lines
1.9 KiB
Diff
37 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: SageSphinx63920 <sage@sagesphinx63920.dev>
|
|
Date: Mon, 26 Dec 2022 23:42:37 +0100
|
|
Subject: [PATCH] Add PreExplodeEvents
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
index d7cd063240a2799996cf7efa3f766ee748702db1..5248e32e2109494904bc16839b2f202dab3d96c9 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -407,6 +407,25 @@ public class Explosion {
|
|
return;
|
|
}
|
|
// CraftBukkit end
|
|
+
|
|
+ // Purpur start - add PreExplodeEvents
|
|
+ if(this.source != null){
|
|
+ Location location = new Location(this.level.getWorld(), this.x, this.y, this.z);
|
|
+ if(!new org.purpurmc.purpur.event.entity.PreEntityExplodeEvent(this.source.getBukkitEntity(), location, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F).callEvent()) {
|
|
+ this.wasCanceled = true;
|
|
+ return;
|
|
+ }
|
|
+ }else {
|
|
+ Location location = new Location(this.level.getWorld(), this.x, this.y, this.z);
|
|
+ org.bukkit.block.Block block = location.getBlock();
|
|
+ org.bukkit.block.BlockState blockState = (this.damageSource.getDirectBlockState() != null) ? this.damageSource.getDirectBlockState() : block.getState();
|
|
+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, blockState).callEvent()) {
|
|
+ this.wasCanceled = true;
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ //Purpur end
|
|
+
|
|
this.level.gameEvent(this.source, (Holder) GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
|
|
|
|
// Paper start - collision optimisations
|