-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kaiiju Vanilla end portal teleportation
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
patches/server/0036-Kaiiju-Vanilla-end-portal-teleportation.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: M2ke4U <79621885+MrHua269@users.noreply.github.com> | ||
Date: Sun, 26 Nov 2023 20:25:38 +0800 | ||
Subject: [PATCH] Kaiiju Vanilla end portal teleportation | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java | ||
index 6f3e87661c3181b6537e4d6d96e50d8d5680c040..3a5c8f1f9a8173777b00d43c15e8e313526d3e28 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/Entity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java | ||
@@ -4108,12 +4108,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { | ||
targetPos, 16, // load 16 blocks to be safe from block physics | ||
ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH, | ||
(chunks) -> { | ||
- ServerLevel.makeObsidianPlatform(destination, null, targetPos); | ||
+ //ServerLevel.makeObsidianPlatform(destination, null, targetPos); // 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 PortalInfo(Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f, destination, null) | ||
+ new PortalInfo(finalPos, this.getDeltaMovement(), 90.0f, 0.0f, destination, null) // Kaiiju - Vanilla end teleportation | ||
); | ||
} | ||
); | ||
@@ -4300,6 +4305,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { | ||
if (!this.canPortalAsync(takePassengers)) { | ||
return false; | ||
} | ||
+ // Kaiiju start - sync end platform spawning & entity teleportation | ||
+ final java.util.function.Consumer<Entity> tpComplete = type == PortalType.END && destination.getTypeKey() == LevelStem.END ? | ||
+ e -> ServerLevel.makeObsidianPlatform(destination, null, ServerLevel.END_SPAWN_POINT) : teleportComplete; | ||
+ // Kaiiju end | ||
|
||
Vec3 initialPosition = this.position(); | ||
ChunkPos initialPositionChunk = new ChunkPos( | ||
@@ -4358,7 +4367,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { | ||
// place | ||
passengerTree.root.placeInAsync( | ||
originWorld, destination, Entity.TELEPORT_FLAG_LOAD_CHUNK | (takePassengers ? Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS : 0L), | ||
- passengerTree, teleportComplete | ||
+ passengerTree, tpComplete // Kaiiju - vanilla end teleportation | ||
); | ||
}); | ||
|