mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
re-add removing curse of binding with weakness patch
This commit is contained in:
36
patches/server/0273-Add-PreExplodeEvents.patch
Normal file
36
patches/server/0273-Add-PreExplodeEvents.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
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 754373da9a5246c11f3c33a8907d387e2113ee4d..4c94fff162db3546434e502f39e90f42364e5092 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -166,6 +166,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));
|
||||
Set<BlockPos> set = Sets.newHashSet();
|
||||
boolean flag = true;
|
||||
Reference in New Issue
Block a user