mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-14 20:31:37 +01:00
Fix endgateway teleportation offset (#9517)
This commit is contained in:
parent
fc035b6403
commit
b6c058204f
@ -12,12 +12,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - EntityTeleportEndGatewayEvent - replicated from above
|
||||
+ org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.getBukkitEntity();
|
||||
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D);
|
||||
+ location.setPitch(bukkitEntity.getLocation().getPitch());
|
||||
+ location.setYaw(bukkitEntity.getLocation().getYaw());
|
||||
+ // 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;
|
||||
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
|
||||
entity1.setPortalCooldown();
|
||||
- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D);
|
||||
- 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
|
||||
}
|
||||
|
||||
|
@ -4,20 +4,18 @@ Date: Sat, 31 Dec 2016 21:44:50 -0500
|
||||
Subject: [PATCH] PlayerTeleportEndGatewayEvent
|
||||
|
||||
Allows you to access the Gateway being used in a teleport event
|
||||
Fix the offset used for player teleportation
|
||||
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.data.worldgen.features.EndFeatures;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
+import io.papermc.paper.util.MCUtil;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -0,0 +0,0 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
// CraftBukkit start - Fire PlayerTeleportEvent
|
||||
if (entity1 instanceof ServerPlayer) {
|
||||
org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity();
|
||||
- org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D);
|
||||
+ org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0, 0.5D); // Paper - use the right Y offset
|
||||
location.setPitch(player.getLocation().getPitch());
|
||||
location.setYaw(player.getLocation().getYaw());
|
||||
|
||||
@ -26,3 +24,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
if (teleEvent.isCancelled()) {
|
||||
return;
|
||||
@@ -0,0 +0,0 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
// CraftBukkit end
|
||||
|
||||
entity1.setPortalCooldown();
|
||||
- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D);
|
||||
+ entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); // Paper - diff on change
|
||||
}
|
||||
|
||||
TheEndGatewayBlockEntity.triggerCooldown(world, pos, state, blockEntity);
|
||||
|
Loading…
Reference in New Issue
Block a user