Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/ItemChorusFruit.patch

36 Zeilen
1.6 KiB
Diff

--- a/net/minecraft/server/ItemChorusFruit.java
+++ b/net/minecraft/server/ItemChorusFruit.java
2016-11-17 02:41:03 +01:00
@@ -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
2016-11-17 02:41:03 +01:00
+
public class ItemChorusFruit extends ItemFood {
2018-07-15 02:00:00 +02:00
public ItemChorusFruit(int i, float f, Item.Info item_info) {
2016-11-17 02:41:03 +01:00
@@ -19,6 +25,20 @@
2018-07-15 02:00:00 +02:00
double d4 = MathHelper.a(entityliving.locY + (double) (entityliving.getRandom().nextInt(16) - 8), 0.0D, (double) (world.aa() - 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;
+ }
+ d3 = teleEvent.getTo().getX();
+ d4 = teleEvent.getTo().getY();
+ d5 = teleEvent.getTo().getZ();
+ }
2016-06-09 03:43:49 +02:00
+ // CraftBukkit end
+
2016-06-09 03:43:49 +02:00
if (entityliving.isPassenger()) {
entityliving.stopRiding();
}