68 lines
3.4 KiB
Diff
68 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Sun, 27 Apr 2025 14:26:01 +0800
|
|
Subject: [PATCH] Fix entity portal-teleport speed
|
|
|
|
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index 7b7c72f14ae966ef142d68615b2f88ba42a079f5..87377bba2ebdc0eba5b7b212d971994c35ca0b62 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1364,7 +1364,27 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
if (levelChunk != null) levelChunk.getChunkHot().startTicking(); try { // KioCG
|
|
try {
|
|
// Folia end - profiler
|
|
+ // Luminol start - Entity portal-teleport speed fix
|
|
if (isActive) { // Paper - EAR 2
|
|
+ if (!(entity instanceof Player) && entity.teleportTickType == 2) { // Luminol - after portal compensate tick
|
|
+ entity.tick();
|
|
+ entity.tick();
|
|
+ entity.teleportTickType = 0;
|
|
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) {
|
|
+ return;
|
|
+ }
|
|
+ if (entity.handlePortal()) {
|
|
+ return;
|
|
+ }
|
|
+ } else if (!(entity instanceof Player) && entity.teleportTickType == 1) { // Luminol - portal teleport only
|
|
+ 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)) {
|
|
@@ -1375,6 +1395,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
// portalled
|
|
return;
|
|
}
|
|
+ }
|
|
+ // Luminol end - Entity portal-teleport speed fix
|
|
// Folia end - region threading
|
|
} else {entity.inactiveTick();} // Paper - EAR 2
|
|
profilerFiller.pop();
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index b00d9bd9f0299804f4f33495724071b6cfbfca30..868a3c395b0f86b7587e8aa844aacb2cabd2e971 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -371,6 +371,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
public long activatedTick = Integer.MIN_VALUE;
|
|
public boolean isTemporarilyActive;
|
|
public long activatedImmunityTick = Integer.MIN_VALUE;
|
|
+ public int teleportTickType = 0;// Luminol - Entity portal-teleport speed fix
|
|
|
|
public void inactiveTick() {
|
|
}
|
|
@@ -3418,6 +3419,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
} else {
|
|
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
|
|
this.portalProcess = new PortalProcessor(portal, pos.immutable());
|
|
+ this.teleportTickType = 1; // Luminol - Entity portal-teleport speed fix
|
|
} else if (!this.portalProcess.isInsidePortalThisTick()) {
|
|
this.portalProcess.updateEntryPosition(pos.immutable());
|
|
this.portalProcess.setAsInsidePortalThisTick(true);
|