80 lines
5.7 KiB
Diff
80 lines
5.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <wangxyper@163.com>
|
|
Date: Sun, 12 Jan 2025 11:04:12 +0800
|
|
Subject: [PATCH] Kaiiju: Vanilla end portal teleportation
|
|
|
|
Co-authored by: Sofiane H. Djerbi <46628754+kugge@users.noreply.github.com>
|
|
As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/patches/server/0024-Vanilla-end-portal-teleportation.patch)
|
|
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 4e33cc402bf34aa9b216323a52158d5fe2eb736b..b00d9bd9f0299804f4f33495724071b6cfbfca30 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -4471,14 +4471,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
targetPos, 16, // load 16 blocks to be safe from block physics
|
|
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
|
(chunks) -> {
|
|
- net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, targetPos.below(), true, null);
|
|
-
|
|
+ //net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, targetPos.below(), true, null); // Kaiiju - Vanilla end teleportation - moved down
|
|
+ // Kaiiju start - Vanilla end teleportation
|
|
+ Vec3 finalPos;
|
|
+ if (this instanceof Player) finalPos = Vec3.atBottomCenterOf(targetPos.below());
|
|
+ else finalPos = Vec3.atBottomCenterOf(targetPos);
|
|
+ // Kaiiju end
|
|
// the portal obsidian is placed at targetPos.y - 2, so if we want to place the entity
|
|
// on the obsidian, we need to spawn at targetPos.y - 1
|
|
portalInfoCompletable.complete(
|
|
new net.minecraft.world.level.portal.TeleportTransition(
|
|
- destination, Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, Direction.WEST.toYRot(), 0.0f,
|
|
- Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)),
|
|
+ destination, finalPos, this.getDeltaMovement(), Direction.WEST.toYRot(), 0.0f, // Kaiiju - Vanilla end teleportation
|
|
+ //Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)), // Kaiiju - Vanilla end teleportation
|
|
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
|
|
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
|
|
)
|
|
@@ -4504,11 +4508,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
|
(chunks) -> {
|
|
BlockPos adjustedSpawn = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawnPos);
|
|
-
|
|
+ // Kaiiju start - Vanilla end teleportation
|
|
+ Vec3 finalPos;
|
|
+ if (this instanceof Player) finalPos = Vec3.atBottomCenterOf(adjustedSpawn.below());
|
|
+ else finalPos = Vec3.atBottomCenterOf(adjustedSpawn);
|
|
+ // Kaiiju end
|
|
// done
|
|
portalInfoCompletable.complete(
|
|
new net.minecraft.world.level.portal.TeleportTransition(
|
|
- destination, Vec3.atBottomCenterOf(adjustedSpawn), Vec3.ZERO, 0.0f, 0.0f,
|
|
+ destination, finalPos, this.getDeltaMovement(), 0.0f, 0.0f, // Kaiiju - Vanilla end teleportation
|
|
Relative.union(Relative.DELTA, Relative.ROTATION),
|
|
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
|
|
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
|
|
@@ -4705,6 +4713,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
return false;
|
|
}
|
|
// Luminol end
|
|
+ // Kaiiju start - sync end platform spawning & entity teleportation
|
|
+ final java.util.function.Consumer<Entity> tpComplete = type == PortalType.END && destination.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.END ?
|
|
+ e -> net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, ServerLevel.END_SPAWN_POINT.below(), true, null) : teleportComplete;
|
|
+ // Kaiiju end
|
|
|
|
Vec3 initialPosition = this.position();
|
|
ChunkPos initialPositionChunk = new ChunkPos(
|
|
@@ -4769,8 +4781,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
info.postTeleportTransition().onTransition(teleported);
|
|
}
|
|
|
|
- if (teleportComplete != null) {
|
|
+ // Kaiiju start - vanilla end teleportation
|
|
+ /*if (teleportComplete != null) {
|
|
teleportComplete.accept(teleported);
|
|
+ }*/
|
|
+ if (tpComplete != null){
|
|
+ tpComplete.accept(teleported);
|
|
}
|
|
// Kaiiju end
|
|
}
|