Paper/patches/server/0202-Implement-EntityTeleportEndGatewayEvent.patch
Nassim Jahnke 72e87abc2d
Strip raytracing for EntityLiving#hasLineOfSight
Co-authored-by: Paul Sauve <paul@technove.co>
2023-09-10 12:28:03 +10:00

33 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 9 Jun 2018 14:08:39 +0200
Subject: [PATCH] Implement EntityTeleportEndGatewayEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 020314dded2c6305bd5e9013b108bc74be25ccc1..85914124014b4e6f0a561cf560918af68682b6f5 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -224,9 +224,20 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
}
// CraftBukkit end
+ // Paper start - EntityTeleportEndGatewayEvent
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D);
+ location.setPitch(entity1.getXRot());
+ location.setYaw(entity1.getBukkitYaw());
+
+ org.bukkit.entity.Entity bukkitEntity = entity1.getBukkitEntity();
+ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(world.getWorld(), blockEntity));
+ if (!event.callEvent()) {
+ return;
+ }
+ // Paper end
entity1.setPortalCooldown();
- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); // Paper - diff on change
+ entity1.teleportToWithTicket(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); // Paper
}
TheEndGatewayBlockEntity.triggerCooldown(world, pos, state, blockEntity);