2016-03-05 23:46:57 +01:00
|
|
|
--- a/net/minecraft/server/ItemChorusFruit.java
|
|
|
|
+++ b/net/minecraft/server/ItemChorusFruit.java
|
2016-05-10 13:47:39 +02:00
|
|
|
@@ -1,6 +1,11 @@
|
2016-03-05 23:46:57 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
2016-05-10 13:47:39 +02:00
|
|
|
import javax.annotation.Nullable;
|
2016-03-05 23:46:57 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.Location;
|
|
|
|
+import org.bukkit.entity.Player;
|
|
|
|
+import org.bukkit.event.player.PlayerTeleportEvent;
|
|
|
|
+// CraftBukkit end
|
2016-05-10 13:47:39 +02:00
|
|
|
|
2016-03-05 23:46:57 +01:00
|
|
|
public class ItemChorusFruit extends ItemFood {
|
|
|
|
|
2016-05-10 13:47:39 +02:00
|
|
|
@@ -22,7 +27,21 @@
|
2016-03-05 23:46:57 +01:00
|
|
|
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;
|
|
|
|
+ }
|
2016-03-05 23:57:59 +01:00
|
|
|
+ d3 = teleEvent.getTo().getX();
|
|
|
|
+ d4 = teleEvent.getTo().getY();
|
|
|
|
+ d5 = teleEvent.getTo().getZ();
|
2016-03-05 23:46:57 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (entityliving.k(d3, d4, d5)) {
|
2016-03-05 23:57:59 +01:00
|
|
|
+ // CraftBukkit end
|
2016-03-05 23:46:57 +01:00
|
|
|
world.a((EntityHuman) null, d0, d1, d2, SoundEffects.af, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
|
|
|
entityliving.a(SoundEffects.af, 1.0F, 1.0F);
|
2016-03-05 23:57:59 +01:00
|
|
|
break;
|