diff --git a/shiroha-server/minecraft-patches/features/0009-Entity-portal-teleport-speed-fix.patch b/shiroha-server/minecraft-patches/features/0009-Entity-portal-teleport-speed-fix.patch deleted file mode 100644 index 20aa335..0000000 --- a/shiroha-server/minecraft-patches/features/0009-Entity-portal-teleport-speed-fix.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MrHua269 -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 35ab432bbd59aba80a6eaca1769e6aa82c8a7e46..9933e59dfebf5d731ea73585c2b08f9e4ff42d53 100644 ---- a/net/minecraft/server/level/ServerLevel.java -+++ b/net/minecraft/server/level/ServerLevel.java -@@ -1492,7 +1492,35 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet - foliaProfiler.startTimer(timerId); - try { - // Folia end - profiler -+ // Shiroha start - Entity portal-teleport speed fix - if (isActive) { // Paper - EAR 2 -+ if (!(entity instanceof Player) && entity.teleportTickType == 2) { // Shiroha - after portal compensate tick -+ 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; -+ } -+ } else if (!(entity instanceof Player) && entity.teleportTickType == 1) { // Shiroha - 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)) { -@@ -1503,6 +1531,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet - // portalled - return; - } -+ } -+ // Shiroha end - Entity portal-teleport speed fix - // 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 75dabd3e7b6077b5ae8ee30048786442742b93f9..55263dcdb3ba4d754ad9aa36ce7af3718db98e73 100644 ---- a/net/minecraft/world/entity/Entity.java -+++ b/net/minecraft/world/entity/Entity.java -@@ -388,6 +388,7 @@ public abstract class Entity - public long activatedTick = Integer.MIN_VALUE; - public boolean isTemporarilyActive; - public long activatedImmunityTick = Integer.MIN_VALUE; -+ public int teleportTickType = 0; // Shiroha - Entity portal-teleport speed fix - - public void inactiveTick() { - } diff --git a/shiroha-server/minecraft-patches/features/0009-Fix-entity-portal-teleport-speed.patch b/shiroha-server/minecraft-patches/features/0009-Fix-entity-portal-teleport-speed.patch new file mode 100644 index 0000000..05da16c --- /dev/null +++ b/shiroha-server/minecraft-patches/features/0009-Fix-entity-portal-teleport-speed.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Helvetica Volubi +Date: Mon, 20 Apr 2026 01:10:30 +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 35ab432bbd59aba80a6eaca1769e6aa82c8a7e46..e541189887f446844ffd77ff099d1f4dba556fe9 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -1492,7 +1492,31 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet + foliaProfiler.startTimer(timerId); + try { + // Folia end - profiler ++ // Shiroha start - Entity portal-teleport speed fix + if (isActive) { // Paper - EAR 2 ++ if (!(entity instanceof Player) && entity.teleportTickType == io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NEED_SYNC) { // Luminol - after portal compensate tick ++ entity.tick(); ++ while (entity.losingTicks-- > 0) { ++ entity.tick(); ++ } ++ entity.teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NORMAL; ++ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity)) { ++ return; ++ } ++ if (entity.handlePortal()) { ++ return; ++ } ++ } else if (!(entity instanceof Player) && entity.teleportTickType == io.nanachiyo0721.shiroha.enums.EnumTeleportStage.STOP_TICKING) { // Luminol - portal teleport only ++ if (io.nanachiyo0721.shiroha.config.modules.fixes.TeleportConfig.enableDelayCompensation && entity.losingTicks < io.nanachiyo0721.shiroha.config.modules.fixes.TeleportConfig.maxDelayCompensationTicks) { ++ entity.losingTicks++; ++ } ++ 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)) { +@@ -1503,6 +1527,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet + // portalled + return; + } ++ } ++ // Shiroha end - Entity portal-teleport speed fix + // 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 75dabd3e7b6077b5ae8ee30048786442742b93f9..5d4d4d07cae83a98fcf16370c98a5118c39e1f5a 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -388,6 +388,8 @@ public abstract class Entity + public long activatedTick = Integer.MIN_VALUE; + public boolean isTemporarilyActive; + public long activatedImmunityTick = Integer.MIN_VALUE; ++ public io.nanachiyo0721.shiroha.enums.EnumTeleportStage teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NORMAL; // Shiroha - Entity portal-teleport speed fix ++ public int losingTicks = 0; // Shiroha - Entity portal-teleport speed fix + + public void inactiveTick() { + } +@@ -3597,6 +3599,7 @@ public abstract class Entity + } else { + if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) { + this.portalProcess = new PortalProcessor(portal, pos.immutable()); ++ this.teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.STOP_TICKING; // Shiroha - Entity portal-teleport speed fix + } else if (!this.portalProcess.isInsidePortalThisTick()) { + this.portalProcess.updateEntryPosition(pos.immutable()); + this.portalProcess.setAsInsidePortalThisTick(true); +@@ -4559,6 +4562,7 @@ public abstract class Entity + + public void postChangeDimension() { + this.resetStoredPositions(); ++ this.teleportTickType = io.nanachiyo0721.shiroha.enums.EnumTeleportStage.NEED_SYNC; // Shiroha - Entity portal-teleport speed fix + } + + protected static enum PortalType { diff --git a/shiroha-server/minecraft-patches/features/0013-Fix-riding-statistics-desync.patch b/shiroha-server/minecraft-patches/features/0013-Fix-riding-statistics-desync.patch index 3e57017..0d2fc84 100644 --- a/shiroha-server/minecraft-patches/features/0013-Fix-riding-statistics-desync.patch +++ b/shiroha-server/minecraft-patches/features/0013-Fix-riding-statistics-desync.patch @@ -19,10 +19,10 @@ index 297269e18111b93692bdfbc318de6e9e38c18d50..c29167dee1855b142c78d9ae8700b25d int distance = Math.round((float)Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F); Entity vehicle = this.getVehicle(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 55263dcdb3ba4d754ad9aa36ce7af3718db98e73..9df6003d325536639706751c109c42eed7904f73 100644 +index 5d4d4d07cae83a98fcf16370c98a5118c39e1f5a..f18f8e24442ceb418996a86bca20ae7c0700af8a 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4201,7 +4201,13 @@ public abstract class Entity +@@ -4203,7 +4203,13 @@ public abstract class Entity } } @@ -36,7 +36,7 @@ index 55263dcdb3ba4d754ad9aa36ce7af3718db98e73..9df6003d325536639706751c109c42ee java.util.ArrayDeque queue = new java.util.ArrayDeque<>(); queue.add(this); -@@ -4214,14 +4220,24 @@ public abstract class Entity +@@ -4216,14 +4222,24 @@ public abstract class Entity for (EntityTreeNode passenger : passengers) { queue.add(passenger); diff --git a/shiroha-server/minecraft-patches/features/0015-Fix-dragon-part-desync.patch b/shiroha-server/minecraft-patches/features/0015-Fix-dragon-part-desync.patch index 1dd55ff..2d665aa 100644 --- a/shiroha-server/minecraft-patches/features/0015-Fix-dragon-part-desync.patch +++ b/shiroha-server/minecraft-patches/features/0015-Fix-dragon-part-desync.patch @@ -17,10 +17,10 @@ index aa53138b3670a8337b639472a6ab5ce46702ff76..6be786dcd9f02c0b59ca90453ddabff9 } diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 9df6003d325536639706751c109c42eed7904f73..d89696bd0a0bd0b7c565b647ea97f24fb7b53ce0 100644 +index f18f8e24442ceb418996a86bca20ae7c0700af8a..dee189bea3e90fd5dd503a2fe6b8a5c986589c62 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4461,6 +4461,7 @@ public abstract class Entity +@@ -4463,6 +4463,7 @@ public abstract class Entity Entity copy = this.getType().create(destination, EntitySpawnReason.DIMENSION_TRAVEL); copy.restoreFrom(this); copy.transform(pos, yaw, pitch, velocity); diff --git a/shiroha-server/minecraft-patches/features/0018-Fix-high-velocity-moving-issue.patch b/shiroha-server/minecraft-patches/features/0018-Fix-high-velocity-moving-issue.patch index 60fd7cf..a855a82 100644 --- a/shiroha-server/minecraft-patches/features/0018-Fix-high-velocity-moving-issue.patch +++ b/shiroha-server/minecraft-patches/features/0018-Fix-high-velocity-moving-issue.patch @@ -8,10 +8,10 @@ On folia, entity usually cannot move out of the tickregion, but sometimes it act Reference from : https://github.com/KaiijuMC/Kaiiju/blob/ver/1.20.1/patches/server/0040-Teleport-async-if-we-cannot-move-entity-off-main.patch diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index d89696bd0a0bd0b7c565b647ea97f24fb7b53ce0..6e09efff84414d5507a639b6c14362f32b3c5416 100644 +index dee189bea3e90fd5dd503a2fe6b8a5c986589c62..6715a4c8078fe49c929f24d87df76bef04e5b43a 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1164,6 +1164,20 @@ public abstract class Entity +@@ -1165,6 +1165,20 @@ public abstract class Entity this.moveStartZ = this.getZ(); this.moveVector = delta; } @@ -32,7 +32,7 @@ index d89696bd0a0bd0b7c565b647ea97f24fb7b53ce0..6e09efff84414d5507a639b6c14362f3 try { // Paper end - detailed watchdog information if (this.noPhysics) { -@@ -1202,6 +1216,23 @@ public abstract class Entity +@@ -1203,6 +1217,23 @@ public abstract class Entity } // Paper end diff --git a/shiroha-server/minecraft-patches/features/0023-Fix-folia-nether-portal-ticket-placement.patch b/shiroha-server/minecraft-patches/features/0023-Fix-folia-nether-portal-ticket-placement.patch index c721c28..bc39675 100644 --- a/shiroha-server/minecraft-patches/features/0023-Fix-folia-nether-portal-ticket-placement.patch +++ b/shiroha-server/minecraft-patches/features/0023-Fix-folia-nether-portal-ticket-placement.patch @@ -30,10 +30,10 @@ index ea93ac07ec6d4e83d1d0904daf721132e2bbecc3..947413df55b972a5f866d5717fdb9e92 public static class IntBounds { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 6e09efff84414d5507a639b6c14362f32b3c5416..dbf449e258bcd66d0182f003e029bde3b58558cc 100644 +index 6715a4c8078fe49c929f24d87df76bef04e5b43a..216c7a6c9a139c998809b98134706a52ad271518 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4743,7 +4743,7 @@ public abstract class Entity +@@ -4746,7 +4746,7 @@ public abstract class Entity portalInfoCompletable.complete( new TeleportTransition(destination, Vec3.atCenterOf(targetPos), Vec3.ZERO, 90.0f, 0.0f, @@ -42,7 +42,7 @@ index 6e09efff84414d5507a639b6c14362f32b3c5416..dbf449e258bcd66d0182f003e029bde3 ); return; } -@@ -4755,7 +4755,7 @@ public abstract class Entity +@@ -4758,7 +4758,7 @@ public abstract class Entity portalInfoCompletable.complete( net.minecraft.world.level.block.NetherPortalBlock.createDimensionTransition( destination, portal, originalPortalDirection, relativePos, diff --git a/shiroha-server/minecraft-patches/features/0030-Reduce-ticket-operations-in-nether-portal-searching.patch b/shiroha-server/minecraft-patches/features/0030-Reduce-ticket-operations-in-nether-portal-searching.patch index d534e90..8438074 100644 --- a/shiroha-server/minecraft-patches/features/0030-Reduce-ticket-operations-in-nether-portal-searching.patch +++ b/shiroha-server/minecraft-patches/features/0030-Reduce-ticket-operations-in-nether-portal-searching.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reduce ticket operations in nether portal searching diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 9933e59dfebf5d731ea73585c2b08f9e4ff42d53..01a93a747d2fec6248909165bd450833e72cc231 100644 +index e541189887f446844ffd77ff099d1f4dba556fe9..dfe1ebb4e016ef1c8c8bb47973b93834be707921 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet @@ -25,10 +25,10 @@ index 9933e59dfebf5d731ea73585c2b08f9e4ff42d53..01a93a747d2fec6248909165bd450833 // Folia start - region threading diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index dbf449e258bcd66d0182f003e029bde3b58558cc..34dff91f9694b6a884bac2039891d05fdec7c12c 100644 +index 216c7a6c9a139c998809b98134706a52ad271518..27a29be1be014bee576d64ff198d394a08f0601b 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4762,10 +4762,10 @@ public abstract class Entity +@@ -4765,10 +4765,10 @@ public abstract class Entity ); // kick off search for existing portal or creation diff --git a/shiroha-server/minecraft-patches/features/0037-Kaiiju-Entity-tick-and-removal-limiter.patch b/shiroha-server/minecraft-patches/features/0037-Kaiiju-Entity-tick-and-removal-limiter.patch index 8dd9b9f..c15c40e 100644 --- a/shiroha-server/minecraft-patches/features/0037-Kaiiju-Entity-tick-and-removal-limiter.patch +++ b/shiroha-server/minecraft-patches/features/0037-Kaiiju-Entity-tick-and-removal-limiter.patch @@ -20,7 +20,7 @@ index 55dabe4dd77cff25ec9b1bc26749a1b56c36e2a2..fbbc05e946b72da1079271810fdb3034 // block ticking private final ObjectLinkedOpenHashSet blockEvents = new ObjectLinkedOpenHashSet<>(); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 01a93a747d2fec6248909165bd450833e72cc231..674ebe647a5e44bf7819e1e7a234164476b31e3d 100644 +index dfe1ebb4e016ef1c8c8bb47973b93834be707921..553395d07ec436280ff1415564ece10f544a37e7 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -912,6 +912,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet diff --git a/shiroha-server/minecraft-patches/features/0038-Kaiiju-Vanilla-end-portal-teleportation.patch b/shiroha-server/minecraft-patches/features/0038-Kaiiju-Vanilla-end-portal-teleportation.patch index 677e148..88abeca 100644 --- a/shiroha-server/minecraft-patches/features/0038-Kaiiju-Vanilla-end-portal-teleportation.patch +++ b/shiroha-server/minecraft-patches/features/0038-Kaiiju-Vanilla-end-portal-teleportation.patch @@ -8,10 +8,10 @@ As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2e 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 34dff91f9694b6a884bac2039891d05fdec7c12c..453261efff85beec55fb0f9796be0269470670af 100644 +index 27a29be1be014bee576d64ff198d394a08f0601b..ce1d50bfeb598e3ef3172766d575a89d0c87f921 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4660,15 +4660,19 @@ public abstract class Entity +@@ -4663,15 +4663,19 @@ public abstract class Entity targetPos, 16, // load 16 blocks to be safe from block physics ca.spottedleaf.concurrentutil.util.Priority.HIGH, (chunks) -> { @@ -35,7 +35,7 @@ index 34dff91f9694b6a884bac2039891d05fdec7c12c..453261efff85beec55fb0f9796be0269 TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL, TeleportTransition.PassengerTeleportationMode.POSITION_RIDER -@@ -4684,13 +4688,17 @@ public abstract class Entity +@@ -4687,13 +4691,17 @@ public abstract class Entity ca.spottedleaf.concurrentutil.util.Priority.HIGH, (chunks) -> { BlockPos adjustedSpawn = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawnPos); @@ -56,7 +56,7 @@ index 34dff91f9694b6a884bac2039891d05fdec7c12c..453261efff85beec55fb0f9796be0269 TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL, TeleportTransition.PassengerTeleportationMode.POSITION_RIDER -@@ -4869,6 +4877,10 @@ public abstract class Entity +@@ -4872,6 +4880,10 @@ public abstract class Entity return false; } @@ -67,7 +67,7 @@ index 34dff91f9694b6a884bac2039891d05fdec7c12c..453261efff85beec55fb0f9796be0269 Vec3 initialPosition = this.position(); ChunkPos initialPositionChunk = new ChunkPos( ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(initialPosition), -@@ -4932,9 +4944,14 @@ public abstract class Entity +@@ -4935,9 +4947,14 @@ public abstract class Entity info.postTeleportTransition().onTransition(teleported); } diff --git a/shiroha-server/minecraft-patches/features/0053-Add-portal-rate-limiter.patch b/shiroha-server/minecraft-patches/features/0053-Add-portal-rate-limiter.patch index 246304a..2e6da7a 100644 --- a/shiroha-server/minecraft-patches/features/0053-Add-portal-rate-limiter.patch +++ b/shiroha-server/minecraft-patches/features/0053-Add-portal-rate-limiter.patch @@ -93,10 +93,10 @@ index 28f5c28bdf9a3090b98451e559f807c4364ea259..170ff99a055d7ea582d6a18ef6acd572 //this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked // Folia - region threading diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 674ebe647a5e44bf7819e1e7a234164476b31e3d..2670e265d1ef57371224d831a0c8478dbe8bd43c 100644 +index 553395d07ec436280ff1415564ece10f544a37e7..4e1a035f8797196c765f59553ff3a0c9749bacfb 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -1538,8 +1538,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet +@@ -1534,8 +1534,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet // removed from region while ticking return; } @@ -112,7 +112,7 @@ index 674ebe647a5e44bf7819e1e7a234164476b31e3d..2670e265d1ef57371224d831a0c8478d return; } } -@@ -1583,8 +1590,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet +@@ -1579,8 +1586,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet // removed from region while ticking return; } diff --git a/shiroha-server/minecraft-patches/features/0054-Add-status-bar.patch b/shiroha-server/minecraft-patches/features/0054-Add-status-bar.patch index 4bfe9e0..6d8ba84 100644 --- a/shiroha-server/minecraft-patches/features/0054-Add-status-bar.patch +++ b/shiroha-server/minecraft-patches/features/0054-Add-status-bar.patch @@ -68,7 +68,7 @@ index 170ff99a055d7ea582d6a18ef6acd57269d943c4..c4dddd5c66098301de2abc2de93d4409 this.lastServerStatus = nano; this.status = this.buildServerStatus(); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 2670e265d1ef57371224d831a0c8478dbe8bd43c..f2a00943b36f0cfb943bd40b5120ddbf8b7bcf7c 100644 +index 4e1a035f8797196c765f59553ff3a0c9749bacfb..137d81703024eec114132982904cdaa2609966c2 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -1487,6 +1487,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet @@ -80,7 +80,7 @@ index 2670e265d1ef57371224d831a0c8478dbe8bd43c..f2a00943b36f0cfb943bd40b5120ddbf try { // Folia - region threading // Paper end - log detailed entity tick information -@@ -1563,6 +1565,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet +@@ -1559,6 +1561,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet } finally { // Folia - region threading } @@ -88,7 +88,7 @@ index 2670e265d1ef57371224d831a0c8478dbe8bd43c..f2a00943b36f0cfb943bd40b5120ddbf // Paper end - log detailed entity tick information } -@@ -1574,6 +1577,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet +@@ -1570,6 +1573,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet final int timerId = isActive ? entity.getType().tickTimerId : entity.getType().inactiveTickTimerId; final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle foliaProfiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); foliaProfiler.startTimer(timerId); @@ -97,7 +97,7 @@ index 2670e265d1ef57371224d831a0c8478dbe8bd43c..f2a00943b36f0cfb943bd40b5120ddbf try { // Folia end - profiler entity.setOldPosAndRot(); -@@ -1615,6 +1620,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet +@@ -1611,6 +1616,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet this.tickPassenger(entity, passenger, isActive); // Paper - EAR 2 } } finally { foliaProfiler.stopTimer(timerId); } // Folia - profiler @@ -171,10 +171,10 @@ index f03fa06c0ba56f7f5e1e45bc1568a490751efde3..eee1c14249addbf4714df733870da974 + // KioCG end } diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 453261efff85beec55fb0f9796be0269470670af..b22211aaa7c2ec9b96a6de6d84200593b838cecc 100644 +index ce1d50bfeb598e3ef3172766d575a89d0c87f921..7cf2319ea6bf4e46b7a5bedc71d46d0a3cd454eb 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -6457,4 +6457,6 @@ public abstract class Entity +@@ -6460,4 +6460,6 @@ public abstract class Entity return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition()); } // Paper end diff --git a/shiroha-server/minecraft-patches/features/0056-Leaves-Lithium-Sleeping-Block-Entity.patch b/shiroha-server/minecraft-patches/features/0056-Leaves-Lithium-Sleeping-Block-Entity.patch index 4e03b2f..1c3c6ff 100644 --- a/shiroha-server/minecraft-patches/features/0056-Leaves-Lithium-Sleeping-Block-Entity.patch +++ b/shiroha-server/minecraft-patches/features/0056-Leaves-Lithium-Sleeping-Block-Entity.patch @@ -240,7 +240,7 @@ index 6e08d50794c4af4405f3e164a3fd46f376b3f78f..dd2d0940eece3e85078e574f66f71a4c int getContainerSize(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index b22211aaa7c2ec9b96a6de6d84200593b838cecc..b339904e8894774321c322f15842a41ede87ee4e 100644 +index 7cf2319ea6bf4e46b7a5bedc71d46d0a3cd454eb..6be5b9d82686c52eb04ee501fc762b5ddfbc2cca 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -324,7 +324,7 @@ public abstract class Entity @@ -252,7 +252,7 @@ index b22211aaa7c2ec9b96a6de6d84200593b838cecc..b339904e8894774321c322f15842a41e private final VecDeltaCodec packetPositionCodec = new VecDeltaCodec(); public boolean needsSync; public boolean syncPosition; -@@ -4487,11 +4487,13 @@ public abstract class Entity +@@ -4489,11 +4489,13 @@ public abstract class Entity } protected Entity transformForAsyncTeleport(ServerLevel destination, Vec3 pos, Float yaw, Float pitch, Vec3 velocity) { @@ -266,7 +266,7 @@ index b22211aaa7c2ec9b96a6de6d84200593b838cecc..b339904e8894774321c322f15842a41e if (copy instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon dragon) dragon.syncDragonPartsAfterTeleportTransform(); // Shiroha - Fix dragon part desync // vanilla code used to call remove _after_ copying, and some stuff is required to be after copy - so add hook here // for example, clearing of inventory after switching dimensions -@@ -6058,8 +6060,29 @@ public abstract class Entity +@@ -6061,8 +6063,29 @@ public abstract class Entity this.setBoundingBox(this.makeBoundingBox()); } // Paper end - Block invalid positions and bounding box diff --git a/shiroha-server/minecraft-patches/features/0061-Leaf-Secure-seed-and-matter-seed-command.patch b/shiroha-server/minecraft-patches/features/0061-Leaf-Secure-seed-and-matter-seed-command.patch index 1397eb9..16b2f3c 100644 --- a/shiroha-server/minecraft-patches/features/0061-Leaf-Secure-seed-and-matter-seed-command.patch +++ b/shiroha-server/minecraft-patches/features/0061-Leaf-Secure-seed-and-matter-seed-command.patch @@ -63,7 +63,7 @@ index 7927769cf9bccb892745f4d1390eb83b2861d1bb..414c21345879f589fb61130180d0ca60 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index f2a00943b36f0cfb943bd40b5120ddbf8b7bcf7c..f95b0efc2f61a12eeb42c1a867ccdf87cb51a1a2 100644 +index 137d81703024eec114132982904cdaa2609966c2..579e40e74cd90fae60237f0b6d307b971161bfbf 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -634,6 +634,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet diff --git a/shiroha-server/minecraft-patches/features/0075-Gale-Skip-entity-move-if-movement-is-zero.patch b/shiroha-server/minecraft-patches/features/0075-Gale-Skip-entity-move-if-movement-is-zero.patch index a674894..c34240e 100644 --- a/shiroha-server/minecraft-patches/features/0075-Gale-Skip-entity-move-if-movement-is-zero.patch +++ b/shiroha-server/minecraft-patches/features/0075-Gale-Skip-entity-move-if-movement-is-zero.patch @@ -10,10 +10,10 @@ VMP (https://github.com/RelativityMC/VMP-fabric) Licensed under: MIT (https://opensource.org/licenses/MIT) diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index b339904e8894774321c322f15842a41ede87ee4e..bf55500a27000b22de7e17bf31993d698945bbef 100644 +index 6be5b9d82686c52eb04ee501fc762b5ddfbc2cca..7365aa216ece4c04d0315da7e12ead1af235eccd 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1153,8 +1153,14 @@ public abstract class Entity +@@ -1154,8 +1154,14 @@ public abstract class Entity private double moveStartY; private double moveStartZ; // Paper end - detailed watchdog information @@ -28,7 +28,7 @@ index b339904e8894774321c322f15842a41ede87ee4e..bf55500a27000b22de7e17bf31993d69 final Vec3 originalMovement = delta; // Paper - Expose pre-collision velocity // Paper start - detailed watchdog information ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); -@@ -5552,6 +5558,11 @@ public abstract class Entity +@@ -5555,6 +5561,11 @@ public abstract class Entity } public final void setBoundingBox(final AABB bb) { diff --git a/shiroha-server/minecraft-patches/features/0077-Gale-Optimize-random-calls-in-chunk-ticking.patch b/shiroha-server/minecraft-patches/features/0077-Gale-Optimize-random-calls-in-chunk-ticking.patch index d3612c8..723f8a4 100644 --- a/shiroha-server/minecraft-patches/features/0077-Gale-Optimize-random-calls-in-chunk-ticking.patch +++ b/shiroha-server/minecraft-patches/features/0077-Gale-Optimize-random-calls-in-chunk-ticking.patch @@ -57,7 +57,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index f95b0efc2f61a12eeb42c1a867ccdf87cb51a1a2..c79193fa5a12186d5f1ecb25abf92e2cb4a04f8d 100644 +index 579e40e74cd90fae60237f0b6d307b971161bfbf..c7bad58fded53e03988a462e0def43113b4c8c94 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -1054,7 +1054,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet diff --git a/shiroha-server/minecraft-patches/features/0080-Gale-For-collision-check-has-physics-before-same-veh.patch b/shiroha-server/minecraft-patches/features/0080-Gale-For-collision-check-has-physics-before-same-veh.patch index 047258f..1454d42 100644 --- a/shiroha-server/minecraft-patches/features/0080-Gale-For-collision-check-has-physics-before-same-veh.patch +++ b/shiroha-server/minecraft-patches/features/0080-Gale-For-collision-check-has-physics-before-same-veh.patch @@ -20,10 +20,10 @@ As part of: Akarin (https://github.com/Akarin-project/Akarin) Licensed under: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index bf55500a27000b22de7e17bf31993d698945bbef..4f863e68fb2323a442f868a2531a9eda816a2555 100644 +index 7365aa216ece4c04d0315da7e12ead1af235eccd..2a51f2fefc93c9a4ef42e93e83af4e8a305ea35a 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -2457,8 +2457,8 @@ public abstract class Entity +@@ -2458,8 +2458,8 @@ public abstract class Entity } public void push(final Entity entity) { diff --git a/shiroha-server/minecraft-patches/features/0081-Gale-Skip-negligible-planar-movement-multiplication.patch b/shiroha-server/minecraft-patches/features/0081-Gale-Skip-negligible-planar-movement-multiplication.patch index 128b70e..4400950 100644 --- a/shiroha-server/minecraft-patches/features/0081-Gale-Skip-negligible-planar-movement-multiplication.patch +++ b/shiroha-server/minecraft-patches/features/0081-Gale-Skip-negligible-planar-movement-multiplication.patch @@ -7,10 +7,10 @@ License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://github.com/GaleMC/Gale diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 4f863e68fb2323a442f868a2531a9eda816a2555..ecd17c6bdf9668842879aa687505afc7c7430dad 100644 +index 2a51f2fefc93c9a4ef42e93e83af4e8a305ea35a..fdf43e876d5387d93e2776885179f2478cbd1a19 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1318,8 +1318,17 @@ public abstract class Entity +@@ -1319,8 +1319,17 @@ public abstract class Entity } } diff --git a/shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/modules/fixes/TeleportConfig.java b/shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/modules/fixes/TeleportConfig.java new file mode 100644 index 0000000..563fa7b --- /dev/null +++ b/shiroha-server/src/main/java/io/nanachiyo0721/shiroha/config/modules/fixes/TeleportConfig.java @@ -0,0 +1,17 @@ +package io.nanachiyo0721.shiroha.config.modules.fixes; + +import io.nanachiyo0721.shiroha.config.IConfigModule; +import io.nanachiyo0721.shiroha.config.flags.ConfigClassInfo; +import io.nanachiyo0721.shiroha.config.flags.ConfigInfo; +import io.nanachiyo0721.shiroha.enums.EnumConfigCategory; + +@ConfigClassInfo(category = EnumConfigCategory.FIXES, name = "teleport") +public class TeleportConfig implements IConfigModule { + @ConfigInfo(name = "enable_delay_compensation", comments = """ + Whether to enable delay compensation after teleportation, + as Folia's teleportation mechanism causes teleportation to be delayed by at least 1 tick""") + public static boolean enableDelayCompensation = true; + + @ConfigInfo(name = "max_delay_compensation_ticks", comments = "Maximum number of ticks to compensate for delay") + public static int maxDelayCompensationTicks = 1; +} diff --git a/shiroha-server/src/main/java/io/nanachiyo0721/shiroha/enums/EnumTeleportStage.java b/shiroha-server/src/main/java/io/nanachiyo0721/shiroha/enums/EnumTeleportStage.java new file mode 100644 index 0000000..3de25aa --- /dev/null +++ b/shiroha-server/src/main/java/io/nanachiyo0721/shiroha/enums/EnumTeleportStage.java @@ -0,0 +1,7 @@ +package io.nanachiyo0721.shiroha.enums; + +public enum EnumTeleportStage { + NORMAL, + STOP_TICKING, + NEED_SYNC +}