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@5436d44 Deprecate several Keyed#getKey methods (#10357) PaperMC/Paper@a7f1dc6 Change online mode default for Velocity configuration (#10413) PaperMC/Paper@37db2d7 [ci skip] Update book page/char limit for book meta doc (#10415) PaperMC/Paper@526795b Update patches to handle vineflower decompiler (#10406) PaperMC/Paper@8fe90de [ci skip] Referenced InventoryDragEvent in documentation of InventoryClickEvent (#10395) PaperMC/Paper@46d462b Fix StackOverflowException thrown on shutdown (Fixes #10404) (#10408) PaperMC/Paper@f061e76 Fix hit criteria advancement triggered before changing state (#10409) PaperMC/Paper@3263470 Add color transition and clone functions to ParticleBuilder (#10342) PaperMC/Paper@4445d23 Deprecate ItemStack#setType & add ItemStack#withType (#10290)
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 9b5da37a532595541eaac0a4607aff9045a20ff3..0be03430d8257d918b7cf646af518473ae027399 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -429,6 +429,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, this.damageSource.explodedBlockState).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;
|