Fix BeaconEffectEvent

It is no longer 5 am
This commit is contained in:
Zach Brown 2016-03-11 20:36:47 -06:00
parent 5dcb658e3e
commit 3fc67691fc
8 changed files with 16 additions and 73 deletions

View file

@ -1,4 +1,4 @@
From dc65a8bcffb8c2767d4907e60d516b57f401730e Mon Sep 17 00:00:00 2001 From e517ad6d7b004bfea02ba11c3e32ff28ba42acdc Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net> From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 23:30:53 -0600 Date: Wed, 2 Mar 2016 23:30:53 -0600
Subject: [PATCH] Add BeaconEffectEvent Subject: [PATCH] Add BeaconEffectEvent
@ -18,31 +18,32 @@ index 24ae8e2..a5cbda5 100644
public double durationModifier; public double durationModifier;
private boolean h; private boolean h;
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index ed5b374..6615890 100644 index ed5b374..f490dca 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -13,6 +13,14 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; @@ -13,6 +13,15 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
// CraftBukkit end // CraftBukkit end
+// Paper start +// Paper start
+import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.potion.CraftPotionUtil;
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
+import org.bukkit.potion.PotionData;
+import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import com.destroystokyo.paper.event.block.BeaconEffectEvent; +import com.destroystokyo.paper.event.block.BeaconEffectEvent;
+// Paper end +// Paper end
+ +
public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory { public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory {
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}}; public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}};
@@ -85,17 +93,33 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable, @@ -85,17 +94,33 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable,
EntityHuman entityhuman; EntityHuman entityhuman;
+ // Paper start + // Paper start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); + org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
+ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getByName(this.l.e), 180, b0, true, true); + PotionEffect primaryEffect = CraftPotionUtil.toBukkit(new MobEffect(this.l, i, b0, true, true));
+ // Paper end + // Paper end
+ +
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -52,13 +53,13 @@ index ed5b374..6615890 100644
+ BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true); + BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true);
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue; + if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+ PotionEffect effect = event.getEffect(); + PotionEffect effect = event.getEffect();
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); + entityhuman.getBukkitEntity().addPotionEffect(effect);
+ // Paper end + // Paper end
} }
if (this.k >= 4 && this.l != this.m && this.m != null) { if (this.k >= 4 && this.l != this.m && this.m != null) {
iterator = list.iterator(); iterator = list.iterator();
+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getByName(this.m.e), 180, 0, true, true); // Paper + PotionEffect secondaryEffect = org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(new MobEffect(this.m, i, 0, true, true)); // Paper
while (iterator.hasNext()) { while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next(); entityhuman = (EntityHuman) iterator.next();
@ -67,7 +68,7 @@ index ed5b374..6615890 100644
+ BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false); + BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false);
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue; + if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+ PotionEffect effect = event.getEffect(); + PotionEffect effect = event.getEffect();
+ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); + entityhuman.getBukkitEntity().addPotionEffect(effect);
+ // Paper end + // Paper end
} }
} }

View file

@ -1,4 +1,4 @@
From 0a11215975146d80e77d2b32dcca515391a2db9c Mon Sep 17 00:00:00 2001 From fdfdc3dab2a765b9586a86a6551e244b1bc6aaa6 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com> From: Techcable <Techcable@outlook.com>
Date: Mon, 7 Mar 2016 12:51:01 -0700 Date: Mon, 7 Mar 2016 12:51:01 -0700
Subject: [PATCH] Speedup BlockPos by fixing inlining Subject: [PATCH] Speedup BlockPos by fixing inlining

View file

@ -1,58 +0,0 @@
From f0f541994c80d95ab31cb898ddb4debbae47b003 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 3 Mar 2016 04:45:26 -0600
Subject: [PATCH] Temp patch to nuke BeaconEffectEvent until we get some sleep
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 6615890..92b1211 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -95,30 +95,34 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable,
// Paper start
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
- PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getByName(this.l.e), 180, b0, true, true);
+ // TODO: anytime other than 5 am
+ //PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getById(MobEffectList.getId(this.l)), 180, b0, true, true);
// Paper end
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
// Paper start - BeaconEffectEvent
- BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true);
- if (CraftEventFactory.callEvent(event).isCancelled()) continue;
- PotionEffect effect = event.getEffect();
- entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ //BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true);
+ //if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+ //PotionEffect effect = event.getEffect();
+ //entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ entityhuman.addEffect(new MobEffect(this.l, i, b0, true, true));
// Paper end
}
if (this.k >= 4 && this.l != this.m && this.m != null) {
iterator = list.iterator();
- PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getByName(this.m.e), 180, 0, true, true); // Paper
+ // TODO: anytime other than 5 am
+ //PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getById(MobEffectList.getId(this.m)), 180, b0, true, true);
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
// Paper start - BeaconEffectEvent
- BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false);
- if (CraftEventFactory.callEvent(event).isCancelled()) continue;
- PotionEffect effect = event.getEffect();
- entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ //BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false);
+ //if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+ //PotionEffect effect = event.getEffect();
+ //entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
+ entityhuman.addEffect(new MobEffect(this.m, i, 0, true, true));
// Paper end
}
}
--
2.7.2

View file

@ -1,4 +1,4 @@
From 24c626d4c99727d3d22ce44cf7357708fbf4bd5b Mon Sep 17 00:00:00 2001 From 8680d4ea4f4a3409433f75857a5f92a2b173d656 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 19:13:54 -0500 Date: Tue, 8 Mar 2016 19:13:54 -0500
Subject: [PATCH] Optimize Navigation Listener Subject: [PATCH] Optimize Navigation Listener

View file

@ -1,4 +1,4 @@
From 1c64bf34796c41e6d950ae814340c172f1f5f6da Mon Sep 17 00:00:00 2001 From 8b951fc6098c10ec700fc28360efc2fb7ae7f233 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Tue, 8 Mar 2016 18:28:43 -0800 Date: Tue, 8 Mar 2016 18:28:43 -0800
Subject: [PATCH] Don't nest if we don't need to when cerealising text Subject: [PATCH] Don't nest if we don't need to when cerealising text

View file

@ -1,4 +1,4 @@
From c1a962fb1d95ee2a8d8d049f776918e89d679b13 Mon Sep 17 00:00:00 2001 From 7212983f1d0fec1e4483dab4a9e37073560b5f38 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 23:25:45 -0500 Date: Tue, 8 Mar 2016 23:25:45 -0500
Subject: [PATCH] Disable Scoreboards for non players by default Subject: [PATCH] Disable Scoreboards for non players by default

View file

@ -1,4 +1,4 @@
From cccaa58b370ea1d06cb7c18f9c635dd0a91085e6 Mon Sep 17 00:00:00 2001 From 63947a2a46bc67cc097163e3958b80ea7eb74bd3 Mon Sep 17 00:00:00 2001
From: mrapple <tony@oc.tc> From: mrapple <tony@oc.tc>
Date: Sun, 25 Nov 2012 13:43:39 -0600 Date: Sun, 25 Nov 2012 13:43:39 -0600
Subject: [PATCH] Add methods for working with arrows stuck in living entities Subject: [PATCH] Add methods for working with arrows stuck in living entities

View file

@ -1,4 +1,4 @@
From ba76b4cb1be00b84939bdffcb7206f9c18edc838 Mon Sep 17 00:00:00 2001 From a38e6329573c936add21981f1afe62db94b47d59 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com> From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 23:17:52 -0400 Date: Sat, 4 Apr 2015 23:17:52 -0400
Subject: [PATCH] Complete resource pack API Subject: [PATCH] Complete resource pack API