9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-25 18:09:17 +00:00

potentially fix the portal issue (unsure how it can be reproduced)

This commit is contained in:
Taiyou06
2025-03-18 12:21:59 +01:00
parent e77896f346
commit 68c5449f61

View File

@@ -686,7 +686,7 @@ index f59662da0bbfe0e768c4ac5c7491d13263ac5cac..1643b3af9b33931277c03dbfa2f85e36
serverPlayer.connection = player.connection;
serverPlayer.restoreFrom(player, keepInventory);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 9bc978ca290ca772b0367e89b69fe16b502b0cd2..db9864a55f6f28aaec0054b054bdabf58f76ce0f 100644
index 9bc978ca290ca772b0367e89b69fe16b502b0cd2..c64ee2b79273eed8bba04f792cc07cc5876c1b8b 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -83,10 +83,15 @@ import net.minecraft.world.InteractionResult;
@@ -735,7 +735,7 @@ index 9bc978ca290ca772b0367e89b69fe16b502b0cd2..db9864a55f6f28aaec0054b054bdabf5
this.handlePortal();
}
}
@@ -3370,14 +3389,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3370,14 +3389,24 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.portalProcess != null) {
if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) {
this.setPortalCooldown();
@@ -750,12 +750,14 @@ index 9bc978ca290ca772b0367e89b69fe16b502b0cd2..db9864a55f6f28aaec0054b054bdabf5
+ // TCRF SparklyPaper (Pathothingi) start - parallel world ticking
+ getBukkitEntity().taskScheduler.schedule(
+ entity -> {
+ TeleportTransition portalDestination = entity.portalProcess.getPortalDestination(serverLevel, entity);
+ if (portalDestination != null) {
+ ServerLevel level = portalDestination.newLevel();
+ if (entity instanceof ServerPlayer // CraftBukkit - always call event for players
+ || (level != null && (level.dimension() == serverLevel.dimension() || entity.canTeleport(serverLevel, level)))) { // CraftBukkit
+ entity.teleport(portalDestination);
+ if (entity.portalProcess != null) { // Check if portalProcess is not null
+ TeleportTransition portalDestination = entity.portalProcess.getPortalDestination(serverLevel, entity);
+ if (portalDestination != null) {
+ ServerLevel level = portalDestination.newLevel();
+ if (entity instanceof ServerPlayer // CraftBukkit - always call event for players
+ || (level != null && (level.dimension() == serverLevel.dimension() || entity.canTeleport(serverLevel, level)))) { // CraftBukkit
+ entity.teleport(portalDestination);
+ }
+ }
+ }
+ },
@@ -766,7 +768,7 @@ index 9bc978ca290ca772b0367e89b69fe16b502b0cd2..db9864a55f6f28aaec0054b054bdabf5
} else if (this.portalProcess.hasExpired()) {
this.portalProcess = null;
@@ -3908,6 +3935,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3908,6 +3937,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
private Entity teleportCrossDimension(ServerLevel level, TeleportTransition teleportTransition) {
@@ -811,7 +813,7 @@ index 0b4c4707139c9c72929799818ec1a1b25575d70e..e7d11397701c7f8c7f1602572382373d
});
}
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
index d42f30a7ccdc10bc1f2bfc4b8d93821aa0a25679..4e82d3e714c39bf0a614e8692aca6364b76138a2 100644
index 8a0d1aebad1f92c43112e279b9c5922fdd1fd432..1fc83d18ab8c6d7a65fcd314f00414e638a417e9 100644
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -33,6 +33,7 @@ import net.minecraft.world.item.BundleItem;