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@eb0693f Fix EntityDeathEvent cancellation (#9323) PaperMC/Paper@f8cfdd4 Fix SmithingInventory helper slot methods for 1.20 (#9325) PaperMC/Paper@de19eb8 fix incorrectly updated move vector checking patch (#9328) PaperMC/Paper@87dfff4 Implement BossBarViewer on Player (#9332) PaperMC/Paper@2d09115 Use net.kyori.ansi for console logging (#9313) PaperMC/Paper@b48e2e3 Fix dev bundle generation PaperMC/Paper@c287e92 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9301) PaperMC/Paper@2e363c7 1.20.1 (#9333)
35 lines
1.7 KiB
Diff
35 lines
1.7 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 dcc3b333f3647631e2fb695d0854036d3bc009be..6772c4584f1d243df76b42a730376247c8f04e3b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -141,6 +141,23 @@ 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);
|
|
+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F).callEvent()) {
|
|
+ this.wasCanceled = true;
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ //Purpur end
|
|
+
|
|
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
|
|
Set<BlockPos> set = Sets.newHashSet();
|
|
boolean flag = true;
|