mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 07:39:16 +01:00
30 lines
2.2 KiB
Diff
30 lines
2.2 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] Add EntityTeleportEndGatewayEvent
|
||
|
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||
|
index 439e8b4f52ba88456fb8ae5ab960d715f5c0d131..d790aec175e61bd9dd9c14cbbbd4c3c354bf867a 100644
|
||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||
|
@@ -3301,8 +3301,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||
|
if (!this.isRemoved()) {
|
||
|
// CraftBukkit start
|
||
|
Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot());
|
||
|
- EntityTeleportEvent teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to);
|
||
|
- if (teleEvent.isCancelled()) {
|
||
|
+ // Paper start - gateway-specific teleport event
|
||
|
+ final EntityTeleportEvent teleEvent;
|
||
|
+ if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
|
||
|
+ teleEvent = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), to, new org.bukkit.craftbukkit.block.CraftEndGateway(to.getWorld(), theEndGatewayBlockEntity));
|
||
|
+ teleEvent.callEvent();
|
||
|
+ } else {
|
||
|
+ teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to);
|
||
|
+ }
|
||
|
+ // Paper end - gateway-specific teleport event
|
||
|
+ if (teleEvent.isCancelled() || teleEvent.getTo() == null) {
|
||
|
return null;
|
||
|
}
|
||
|
to = teleEvent.getTo();
|