mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
Add EntityTeleportEndGatewayEvent for entities (closes #1124)
This commit is contained in:
parent
ecc9347238
commit
5913a2cc1a
@ -1,4 +1,4 @@
|
||||
From 712103d9db1ebca6fc45f8fdd8b8b123735cb630 Mon Sep 17 00:00:00 2001
|
||||
From 16c613ce58c5d072bff472f8e249ffa206ea814d Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sat, 10 Jun 2017 16:59:40 -0500
|
||||
Subject: [PATCH] Fix upstream javadoc warnings and errors
|
||||
@ -348,5 +348,5 @@ index 92174e81..ac5cc32c 100644
|
||||
ChatColor getColor() throws IllegalStateException;
|
||||
|
||||
--
|
||||
2.16.1
|
||||
2.17.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 8e5a65fb5168e3a6f655fb0e99b3ca98b7e73860 Mon Sep 17 00:00:00 2001
|
||||
From be61a682cc9453b4372ac821c4aea25ba90ba606 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 5 May 2017 03:57:08 -0500
|
||||
Subject: [PATCH] Item#canEntityPickup
|
||||
@ -30,5 +30,5 @@ index 90260b7e..2e98e4f9 100644
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.13.1
|
||||
2.17.1
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
From e3bebcf4cbf12c0cd7c2c3627dfd87b53837a408 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 9 Jun 2018 13:08:21 +0100
|
||||
Subject: [PATCH] Add EntityTeleportEndGatewayEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
new file mode 100644
|
||||
index 00000000..80899ecb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
@@ -0,0 +1,29 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.block.EndGateway;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity attempts to teleport in an end gateway
|
||||
+ */
|
||||
+public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent {
|
||||
+
|
||||
+ private final EndGateway gateway;
|
||||
+
|
||||
+ public EntityTeleportEndGatewayEvent(Entity what, Location from, Location to, EndGateway gateway) {
|
||||
+ super(what, from, to);
|
||||
+ this.gateway = gateway;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The gateway triggering the teleport
|
||||
+ *
|
||||
+ * @return EndGateway used
|
||||
+ */
|
||||
+ public EndGateway getGateway() {
|
||||
+ return gateway;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
--
|
||||
2.17.1
|
||||
|
@ -0,0 +1,34 @@
|
||||
From de0b586bc05412392f63b9bb4b6f2ce7f3e77c97 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 9 Jun 2018 13:08:39 +0100
|
||||
Subject: [PATCH] Implement EntityTeleportEndGatewayEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
index ecbc48b0c..c84569612 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
|
||||
@@ -136,8 +136,19 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
|
||||
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - EntityTeleportEndGatewayEvent - replicated from above
|
||||
+ org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.getBukkitEntity();
|
||||
+ org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
||||
+ location.setPitch(bukkitEntity.getLocation().getPitch());
|
||||
+ location.setYaw(bukkitEntity.getLocation().getYaw());
|
||||
+
|
||||
+ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(MCUtil.toLocation(world, this.getPosition()).getBlock()));
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- entity.enderTeleportTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
|
||||
+ entity.enderTeleportTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
+ // Paper end - EntityTeleportEndGatewayEvent
|
||||
}
|
||||
|
||||
this.h();
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Reference in New Issue
Block a user