2026-07-09 00:03:09 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: MrHua269 <mrhua269@gmail.com>
|
|
|
|
|
Date: Wed, 8 Jul 2026 21:32:08 +0800
|
|
|
|
|
Subject: [PATCH] Entity portal-teleport speed fix
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
index 3db75ac3f7f111b94178cc29684f24dd55ac5847..39e511061d11039a1027320de624be07e34a2978 100644
|
|
|
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
@@ -1491,7 +1491,35 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
|
|
|
|
foliaProfiler.startTimer(timerId);
|
|
|
|
|
try {
|
|
|
|
|
// Folia end - profiler
|
2026-07-14 11:32:51 +08:00
|
|
|
+ // Shiroha start - Entity portal-teleport speed fix
|
2026-07-09 00:03:09 +08:00
|
|
|
if (isActive) { // Paper - EAR 2
|
2026-07-14 11:32:51 +08:00
|
|
|
+ if (!(entity instanceof Player) && entity.teleportTickType == 2) { // Shiroha - after portal compensate tick
|
2026-07-09 00:03:09 +08:00
|
|
|
+ entity.tick();
|
|
|
|
|
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
|
|
|
|
+ // removed from region while ticking
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (entity.handlePortal()) {
|
|
|
|
|
+ // portalled
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ entity.tick();
|
|
|
|
|
+ entity.teleportTickType = 0;
|
|
|
|
|
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (entity.handlePortal()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
2026-07-14 11:32:51 +08:00
|
|
|
+ } else if (!(entity instanceof Player) && entity.teleportTickType == 1) { // Shiroha - portal teleport only
|
2026-07-09 00:03:09 +08:00
|
|
|
+ entity.teleportTickType++;
|
|
|
|
|
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (entity.handlePortal()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
entity.tick();
|
|
|
|
|
// Folia start - region threading
|
|
|
|
|
if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
|
|
|
|
@@ -1502,6 +1530,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
|
|
|
|
// portalled
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
+ }
|
2026-07-14 11:32:51 +08:00
|
|
|
+ // Shiroha end - Entity portal-teleport speed fix
|
2026-07-09 00:03:09 +08:00
|
|
|
// Folia end - region threading
|
|
|
|
|
} else {entity.inactiveTick();} // Paper - EAR 2
|
|
|
|
|
profiler.pop();
|
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
|
|
|
index 2a8a7aeddffdfed31cd6e1162c0756986049fbab..a3f473cab6a37e65de233c7f77d9de7c967fcdd0 100644
|
|
|
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
|
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
|
|
|
@@ -387,6 +387,7 @@ public abstract class Entity
|
|
|
|
|
public long activatedTick = Integer.MIN_VALUE;
|
|
|
|
|
public boolean isTemporarilyActive;
|
|
|
|
|
public long activatedImmunityTick = Integer.MIN_VALUE;
|
2026-07-14 11:32:51 +08:00
|
|
|
+ public int teleportTickType = 0; // Shiroha - Entity portal-teleport speed fix
|
2026-07-09 00:03:09 +08:00
|
|
|
|
|
|
|
|
public void inactiveTick() {
|
|
|
|
|
}
|