PaperMC/nms-patches/BlockEnderPortal.patch

30 lines
1.1 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockEnderPortal.java
+++ b/net/minecraft/server/BlockEnderPortal.java
@@ -1,5 +1,10 @@
2019-04-23 04:00:00 +02:00
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityPortalEnterEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
+// CraftBukkit end
+
2016-02-29 22:32:46 +01:00
public class BlockEnderPortal extends BlockTileEntity {
2018-07-15 02:00:00 +02:00
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D);
2020-06-25 02:00:00 +02:00
@@ -28,6 +33,15 @@
return;
}
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (entity instanceof EntityPlayer) {
2020-06-25 02:00:00 +02:00
+ ((EntityPlayer) entity).a(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ return;
+ }
+ // CraftBukkit end
2020-06-25 02:00:00 +02:00
entity.a(worldserver);
}