mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
c94a28d0d5
By: md_5 <git@md-5.net>
38 lines
2.1 KiB
Diff
38 lines
2.1 KiB
Diff
--- a/net/minecraft/server/BlockEnderPortal.java
|
|
+++ b/net/minecraft/server/BlockEnderPortal.java
|
|
@@ -1,5 +1,10 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
|
+import org.bukkit.event.player.PlayerTeleportEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class BlockEnderPortal extends BlockTileEntity {
|
|
|
|
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D);
|
|
@@ -21,13 +26,22 @@
|
|
@Override
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
|
if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canPortal() && VoxelShapes.c(VoxelShapes.a(entity.getBoundingBox().d((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
|
- ResourceKey<World> resourcekey = world.getDimensionKey() == World.THE_END ? World.OVERWORLD : World.THE_END;
|
|
+ ResourceKey<World> resourcekey = world.getTypeKey() == DimensionManager.THE_END ? World.OVERWORLD : World.THE_END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
|
WorldServer worldserver = ((WorldServer) world).getMinecraftServer().getWorldServer(resourcekey);
|
|
|
|
if (worldserver == null) {
|
|
- return;
|
|
+ // return; // CraftBukkit - always fire event in case plugins wish to change it
|
|
}
|
|
|
|
+ // 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) {
|
|
+ ((EntityPlayer) entity).b(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
entity.b(worldserver);
|
|
}
|
|
|