diff options
author | Nassim Jahnke <[email protected]> | 2023-06-07 18:24:39 +0200 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2023-06-07 19:06:55 +0200 |
commit | 965cf53cd5067d9f3facf87eed5132c0c82f9878 (patch) | |
tree | 1f8f05afb8e9590389c178778a7132d1c7c21f6b /patches/server/0046-Add-BeaconEffectEvent.patch | |
parent | bc4a6647c99ae98c52c1c81597834be8fec6aa0d (diff) | |
download | Paper-965cf53cd5067d9f3facf87eed5132c0c82f9878.tar.gz Paper-965cf53cd5067d9f3facf87eed5132c0c82f9878.zip |
Start working on 1.20
Diffstat (limited to 'patches/server/0046-Add-BeaconEffectEvent.patch')
-rw-r--r-- | patches/server/0046-Add-BeaconEffectEvent.patch | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/patches/server/0046-Add-BeaconEffectEvent.patch b/patches/server/0046-Add-BeaconEffectEvent.patch deleted file mode 100644 index ea3de2967b..0000000000 --- a/patches/server/0046-Add-BeaconEffectEvent.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux <[email protected]> -Date: Wed, 2 Mar 2016 23:30:53 -0600 -Subject: [PATCH] Add BeaconEffectEvent - - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index ff49285fe50e8361c2d4529bf1dda5b54a90e3fe..05d98a0f34ffd50449fbafcf23fe7d05ca721317 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -41,6 +41,10 @@ import net.minecraft.world.phys.AABB; - import org.bukkit.craftbukkit.potion.CraftPotionUtil; - import org.bukkit.potion.PotionEffect; - // CraftBukkit end -+// Paper start -+import org.bukkit.craftbukkit.event.CraftEventFactory; -+import com.destroystokyo.paper.event.block.BeaconEffectEvent; -+// Paper end - - public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Nameable { - -@@ -280,15 +284,23 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name - } - } - -- private static void applyEffect(List list, MobEffect mobeffectlist, int j, int b0) { -- { -+ private static void applyEffect(List list, MobEffect effects, int i, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent -+ if (!list.isEmpty()) { // Paper - BeaconEffectEvent - Iterator iterator = list.iterator(); - - Player entityhuman; -+ // Paper start - BeaconEffectEvent -+ org.bukkit.block.Block block = ((Player) list.get(0)).level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()); -+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true)); -+ // Paper end - - while (iterator.hasNext()) { -- entityhuman = (Player) iterator.next(); -- entityhuman.addEffect(new MobEffectInstance(mobeffectlist, j, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON); -+ // Paper start - BeaconEffectEvent -+ entityhuman = (ServerPlayer) iterator.next(); -+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary); -+ if (CraftEventFactory.callEvent(event).isCancelled()) continue; -+ entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON); -+ // Paper end - } - } - } -@@ -311,10 +323,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name - int j = BeaconBlockEntity.getLevel(beaconLevel); - List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel); - -- BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0); -+ BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0, true, pos); // Paper - BeaconEffectEvent - - if (BeaconBlockEntity.hasSecondaryEffect(beaconLevel, primaryEffect, secondaryEffect)) { -- BeaconBlockEntity.applyEffect(list, secondaryEffect, j, 0); -+ BeaconBlockEntity.applyEffect(list, secondaryEffect, j, 0, false, pos); // Paper - BeaconEffectEvent - } - } - |