mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 17:22:55 +01:00
SPIGOT-1773: Chorus fruit teleport reason
By: md_5 <git@md-5.net>
This commit is contained in:
parent
6d76250ec1
commit
6cf567a47a
1 changed files with 32 additions and 0 deletions
32
paper-server/nms-patches/ItemChorusFruit.patch
Normal file
32
paper-server/nms-patches/ItemChorusFruit.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
--- a/net/minecraft/server/ItemChorusFruit.java
|
||||
+++ b/net/minecraft/server/ItemChorusFruit.java
|
||||
@@ -1,5 +1,11 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ItemChorusFruit extends ItemFood {
|
||||
|
||||
public ItemChorusFruit(int i, float f) {
|
||||
@@ -19,6 +25,17 @@
|
||||
double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.Z() - 1));
|
||||
double d5 = entityliving.locZ + (entityliving.getRandom().nextDouble() - 0.5D) * 16.0D;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (entityliving instanceof EntityPlayer) {
|
||||
+ Player player = ((EntityPlayer) entityliving).getBukkitEntity();
|
||||
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), new Location(player.getWorld(), d3, d4, d5), PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
|
||||
+ world.getServer().getPluginManager().callEvent(teleEvent);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityliving.k(d3, d4, d5)) {
|
||||
world.a((EntityHuman) null, d0, d1, d2, SoundEffects.af, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
||||
entityliving.a(SoundEffects.af, 1.0F, 1.0F);
|
Loading…
Add table
Reference in a new issue