diff --git a/gradle.properties b/gradle.properties index f0ebeb4..7a460e1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group = me.earthme.luminol version=1.21.5-R0.1-SNAPSHOT mcVersion=1.21.5 -foliaRef=06ace91ba91c18451404516eced1a9c05f4e3f69 +foliaRef=70f4f3ad9b40fce3d12ad5dc9672d95a96f041d3 org.gradle.configuration-cache=true org.gradle.caching=true diff --git a/luminol-server/minecraft-patches/features/0018-Add-config-to-enable-Raytracing-tracker.patch b/luminol-server/minecraft-patches/features/0018-Add-config-to-enable-Raytracing-tracker.patch index 9c27b58..4e5d97a 100644 --- a/luminol-server/minecraft-patches/features/0018-Add-config-to-enable-Raytracing-tracker.patch +++ b/luminol-server/minecraft-patches/features/0018-Add-config-to-enable-Raytracing-tracker.patch @@ -18,7 +18,7 @@ index d0c03dc51c8ad4997963b244ada855827a4c4065..99a8b9a8ee2032107be03bbc13d0275a double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1); if (rangeY != -1) { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index bf177d9f7e5d9f643d13fcb9ea23686fd0f32dc5..897f42dcaf1f1f300f5cccb1b1180237aab216e3 100644 +index b5838a0320c729778f27f0d6a623eed4ef7c3a52..e9ea86d77395975afbe189993ee0dbbd066c3536 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -140,7 +140,7 @@ import net.minecraft.world.scores.ScoreHolder; @@ -30,7 +30,7 @@ index bf177d9f7e5d9f643d13fcb9ea23686fd0f32dc5..897f42dcaf1f1f300f5cccb1b1180237 // CraftBukkit start private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); private static final int CURRENT_LEVEL = 2; -@@ -5955,4 +5955,48 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5957,4 +5957,48 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition()); } // Paper end - Expose entity id counter diff --git a/luminol-server/minecraft-patches/features/0023-Add-tpsbar-with-chunkhot-membar-and-regionbar.patch b/luminol-server/minecraft-patches/features/0023-Add-tpsbar-with-chunkhot-membar-and-regionbar.patch index a24cfbc..b5303f8 100644 --- a/luminol-server/minecraft-patches/features/0023-Add-tpsbar-with-chunkhot-membar-and-regionbar.patch +++ b/luminol-server/minecraft-patches/features/0023-Add-tpsbar-with-chunkhot-membar-and-regionbar.patch @@ -122,7 +122,7 @@ index 94fb1c99baefbdde91dc5fcf103683c7ffda6baf..b4fdbdba579fa7c7de4928c259b5ff16 } diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index d42f4375952239ecc53a8fbca449120d8a1c52a6..9b59ca539080798e4b731431e8a5dc01d5d336e6 100644 +index 111f2f05d0ad3f290dab97f231caf8516821e030..047279cce3ff3a9eedd54db370b8fa6754d85ee4 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -420,7 +420,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @@ -189,10 +189,10 @@ index bfd904e468bbf2cc1a5b3353d3a69ad5087c81ae..116933975ac975bb5a801be81e1c0e9b + // KioCG end } diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 897f42dcaf1f1f300f5cccb1b1180237aab216e3..cc1a9d2292eea91ad7046fa35ebe511515ffb6f3 100644 +index e9ea86d77395975afbe189993ee0dbbd066c3536..0228471a16805042f13158b86379a77371600489 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -5998,5 +5998,4 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -6000,5 +6000,4 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; return this.outOfCamera; } diff --git a/luminol-server/minecraft-patches/features/0024-Add-missing-teleportation-apis-for-folia.patch b/luminol-server/minecraft-patches/features/0024-Add-missing-teleportation-apis-for-folia.patch index 115a476..6b5a5dd 100644 --- a/luminol-server/minecraft-patches/features/0024-Add-missing-teleportation-apis-for-folia.patch +++ b/luminol-server/minecraft-patches/features/0024-Add-missing-teleportation-apis-for-folia.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add missing teleportation apis for folia diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 9b59ca539080798e4b731431e8a5dc01d5d336e6..5564bba66959a2a280f700f6c6a05d292faced88 100644 +index 047279cce3ff3a9eedd54db370b8fa6754d85ee4..bcc0c3cfa5be4daeec6e95a1b63a6cd38890f04d 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -1631,6 +1631,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @@ -19,10 +19,10 @@ index 9b59ca539080798e4b731431e8a5dc01d5d336e6..5564bba66959a2a280f700f6c6a05d29 ); }); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index cc1a9d2292eea91ad7046fa35ebe511515ffb6f3..11d995fc1554afa122475fabc904c88a8ca200dd 100644 +index 0228471a16805042f13158b86379a77371600489..9d945f615187f86913be8a9b83b1aada3a1336b6 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4106,6 +4106,31 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4108,6 +4108,31 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // TODO any events that can modify go HERE @@ -54,7 +54,7 @@ index cc1a9d2292eea91ad7046fa35ebe511515ffb6f3..11d995fc1554afa122475fabc904c88a // check for same region if (destination == this.level()) { -@@ -4222,7 +4247,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4224,7 +4249,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // we just select the spawn position case END: { if (destination.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.END) { @@ -74,7 +74,7 @@ index cc1a9d2292eea91ad7046fa35ebe511515ffb6f3..11d995fc1554afa122475fabc904c88a // need to load chunks so we can create the platform destination.moonrise$loadChunksAsync( targetPos, 16, // load 16 blocks to be safe from block physics -@@ -4243,7 +4279,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4245,7 +4281,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } ); } else { @@ -94,7 +94,7 @@ index cc1a9d2292eea91ad7046fa35ebe511515ffb6f3..11d995fc1554afa122475fabc904c88a // need to load chunk for heightmap destination.moonrise$loadChunksAsync( spawnPos, 0, -@@ -4294,8 +4341,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4296,8 +4343,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess WorldBorder destinationBorder = destination.getWorldBorder(); double dimensionScale = net.minecraft.world.level.dimension.DimensionType.getTeleportationScale(origin.dimensionType(), destination.dimensionType()); @@ -114,7 +114,7 @@ index cc1a9d2292eea91ad7046fa35ebe511515ffb6f3..11d995fc1554afa122475fabc904c88a ca.spottedleaf.concurrentutil.completable.CallbackCompletable portalFound = new ca.spottedleaf.concurrentutil.completable.CallbackCompletable<>(); -@@ -4432,6 +4489,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4434,6 +4491,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (!this.canPortalAsync(destination, takePassengers)) { return false; } @@ -130,7 +130,7 @@ index cc1a9d2292eea91ad7046fa35ebe511515ffb6f3..11d995fc1554afa122475fabc904c88a Vec3 initialPosition = this.position(); ChunkPos initialPositionChunk = new ChunkPos( -@@ -4499,6 +4565,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4501,6 +4567,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (teleportComplete != null) { teleportComplete.accept(teleported); } diff --git a/luminol-server/minecraft-patches/features/0027-Gale-Skip-entity-move-if-movement-is-zero.patch b/luminol-server/minecraft-patches/features/0027-Gale-Skip-entity-move-if-movement-is-zero.patch index 5854323..c0b3e18 100644 --- a/luminol-server/minecraft-patches/features/0027-Gale-Skip-entity-move-if-movement-is-zero.patch +++ b/luminol-server/minecraft-patches/features/0027-Gale-Skip-entity-move-if-movement-is-zero.patch @@ -8,7 +8,7 @@ As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493 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 11d995fc1554afa122475fabc904c88a8ca200dd..fce01a546e181d1feec2bb6a54801a22f84bde82 100644 +index 9d945f615187f86913be8a9b83b1aada3a1336b6..06496237f947af4849cb7f364eacf11d53736e3d 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1081,7 +1081,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -26,7 +26,7 @@ index 11d995fc1554afa122475fabc904c88a8ca200dd..fce01a546e181d1feec2bb6a54801a22 final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity // Paper start - detailed watchdog information ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); -@@ -5046,6 +5053,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5048,6 +5055,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public final void setBoundingBox(AABB bb) { diff --git a/luminol-server/minecraft-patches/features/0040-Kaiiju-Vanilla-end-portal-teleportation.patch b/luminol-server/minecraft-patches/features/0040-Kaiiju-Vanilla-end-portal-teleportation.patch index f66bd49..48925ae 100644 --- a/luminol-server/minecraft-patches/features/0040-Kaiiju-Vanilla-end-portal-teleportation.patch +++ b/luminol-server/minecraft-patches/features/0040-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 fce01a546e181d1feec2bb6a54801a22f84bde82..3489e4c3db5f71b094bc6d1841ca39f2132d73e4 100644 +index 06496237f947af4849cb7f364eacf11d53736e3d..af793516943582d92fe02a222b8c73f759ee8aae 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4271,14 +4271,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4273,14 +4273,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess targetPos, 16, // load 16 blocks to be safe from block physics ca.spottedleaf.concurrentutil.util.Priority.HIGH, (chunks) -> { @@ -34,7 +34,7 @@ index fce01a546e181d1feec2bb6a54801a22f84bde82..3489e4c3db5f71b094bc6d1841ca39f2 TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL ) -@@ -4304,11 +4308,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4306,11 +4310,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess ca.spottedleaf.concurrentutil.util.Priority.HIGH, (chunks) -> { BlockPos adjustedSpawn = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawnPos); @@ -52,7 +52,7 @@ index fce01a546e181d1feec2bb6a54801a22f84bde82..3489e4c3db5f71b094bc6d1841ca39f2 Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL -@@ -4505,6 +4513,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4507,6 +4515,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } // Luminol end @@ -63,7 +63,7 @@ index fce01a546e181d1feec2bb6a54801a22f84bde82..3489e4c3db5f71b094bc6d1841ca39f2 Vec3 initialPosition = this.position(); ChunkPos initialPositionChunk = new ChunkPos( -@@ -4569,8 +4581,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4571,8 +4583,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess info.postTeleportTransition().onTransition(teleported); } diff --git a/luminol-server/minecraft-patches/features/0057-Fix-entity-portal-teleport-speed.patch b/luminol-server/minecraft-patches/features/0057-Fix-entity-portal-teleport-speed.patch new file mode 100644 index 0000000..b4d77ee --- /dev/null +++ b/luminol-server/minecraft-patches/features/0057-Fix-entity-portal-teleport-speed.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Helvetica Volubi +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 8329bc0cf531a1317ff8e213e948019d28df1eea..84a6bf575902676fc06211562b57806415528e64 100644 +--- a/net/minecraft/server/level/ServerLevel.java ++++ b/net/minecraft/server/level/ServerLevel.java +@@ -1356,7 +1356,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)) { +@@ -1367,6 +1387,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 af793516943582d92fe02a222b8c73f759ee8aae..9f1d0c85631a585e00a8b20f3536f1f61b011201 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -350,6 +350,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() { + } +@@ -3223,6 +3224,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); diff --git a/luminol-server/minecraft-patches/features/0057-Fix-incorrectly-synced-data-after-player-teleportati.patch b/luminol-server/minecraft-patches/features/0057-Fix-incorrectly-synced-data-after-player-teleportati.patch deleted file mode 100644 index be4b2d4..0000000 --- a/luminol-server/minecraft-patches/features/0057-Fix-incorrectly-synced-data-after-player-teleportati.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MrHua269 -Date: Fri, 2 May 2025 12:03:14 +0800 -Subject: [PATCH] Fix incorrectly synced data after player teleportation - -Use vanilla's flag and logics to run some status sync after post teleportation, folia forgets send some packets after teleportation and which caused some desync between client and server - -diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 8b9c823deed1844fa69d1456a91ac65487b8ae69..4b5855a456e9703b8e0c60da4ab3dfa2865cef60 100644 ---- a/net/minecraft/server/level/ServerPlayer.java -+++ b/net/minecraft/server/level/ServerPlayer.java -@@ -1788,14 +1788,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc - this.connection.send(new ClientboundChangeDifficultyPacket( - worlddata.getDifficulty(), worlddata.isDifficultyLocked() - )); -- this.connection.send(new ClientboundSetExperiencePacket( -+ /*this.connection.send(new ClientboundSetExperiencePacket( // Luminol start - teleportAsync tweaks, will send in next tick, see the changes below - this.experienceProgress, this.totalExperience, this.experienceLevel -- )); -+ ));*/ // Luminol end - - playerlist.sendActivePlayerEffects(this); - playerlist.sendLevelInfo(this, destination); - playerlist.sendPlayerPermissionLevel(this); - -+ // Luminol start - teleportAsync tweaks -+ this.lastSentExp = -1; -+ this.lastSentHealth = -1.0F; -+ this.lastSentFood = -1; -+ // Luminol end -+ - // regular world add logic - this.unsetRemoved(); - destination.addDuringTeleport(this); diff --git a/luminol-server/minecraft-patches/features/0058-Fix-off-tickregion-sync-teleport.patch b/luminol-server/minecraft-patches/features/0058-Fix-off-tickregion-sync-teleport.patch index 2231210..73377c3 100644 --- a/luminol-server/minecraft-patches/features/0058-Fix-off-tickregion-sync-teleport.patch +++ b/luminol-server/minecraft-patches/features/0058-Fix-off-tickregion-sync-teleport.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix off tickregion sync teleport Folis's teleportAsync implementation has some checks missing during the sync teleportation checks, if we are teleport to the edge of the tickregion, it is still asserting that we are in the same tickregion and moved us directly, but there is actually some logics is already touching the stuff out of current tickregion.So we added some new edge checks to the sync teleportation checks which will check the tickregion belonging in a shape of cycle which is in min(entity's bounding box + simulate distance, 6) of radius to fix that issue diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 3489e4c3db5f71b094bc6d1841ca39f2132d73e4..2ed82b9a864b7878a26daf691a4a60153dba73fb 100644 +index 9f1d0c85631a585e00a8b20f3536f1f61b011201..87e22d1fed087886ac845f6e816be5bf20fac9fb 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4020,6 +4020,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4024,6 +4024,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.resetStoredPositions(); } @@ -31,7 +31,7 @@ index 3489e4c3db5f71b094bc6d1841ca39f2132d73e4..2ed82b9a864b7878a26daf691a4a6015 protected final void transform(TeleportTransition telpeort) { PositionMoveRotation move = PositionMoveRotation.calculateAbsolute( PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives() -@@ -4142,7 +4157,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4146,7 +4161,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // check for same region if (destination == this.level()) { Vec3 currPos = this.position(); diff --git a/luminol-server/minecraft-patches/features/0060-Portal-Behavior-Modifiers.patch b/luminol-server/minecraft-patches/features/0060-Portal-Behavior-Modifiers.patch deleted file mode 100644 index 06cd245..0000000 --- a/luminol-server/minecraft-patches/features/0060-Portal-Behavior-Modifiers.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Helvetica Volubi -Date: Sun, 27 Apr 2025 14:26:01 +0800 -Subject: [PATCH] Portal Behavior Modifiers - - -diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 8329bc0cf531a1317ff8e213e948019d28df1eea..84a6bf575902676fc06211562b57806415528e64 100644 ---- a/net/minecraft/server/level/ServerLevel.java -+++ b/net/minecraft/server/level/ServerLevel.java -@@ -1356,7 +1356,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)) { -@@ -1367,6 +1387,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 2ed82b9a864b7878a26daf691a4a60153dba73fb..bf12d32178bf05fa806a1e35f5d5dde2bedfe468 100644 ---- a/net/minecraft/world/entity/Entity.java -+++ b/net/minecraft/world/entity/Entity.java -@@ -350,6 +350,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() { - } -@@ -3223,6 +3224,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); -@@ -3782,20 +3784,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - - EntityTreeNode curr; - while ((curr = queue.pollFirst()) != null) { -- EntityTreeNode[] passengers = curr.passengers; -+ restore(curr); // Luminol - EndGateway Portal Passengers Fix -+ } -+ } -+ -+ // Luminol Start - EndGateway Portal Passengers Fix -+ private EntityTreeNode[] restore(EntityTreeNode entity) { -+ EntityTreeNode[] passengers = entity.passengers; - if (passengers == null) { -- continue; -+ return null; - } - - List newPassengers = new java.util.ArrayList<>(); - for (EntityTreeNode passenger : passengers) { -+ passenger.passengers = restore(passenger); - newPassengers.add(passenger.root); -- passenger.root.vehicle = curr.root; -+ passenger.root.vehicle = entity.root; - } -- -- curr.root.passengers = ImmutableList.copyOf(newPassengers); -- } -+ entity.root.passengers = ImmutableList.copyOf(newPassengers); -+ return passengers; - } -+ // Luminol End - EndGateway Portal Passengers Fix - - public void addTracker() { - for (final EntityTreeNode node : this.getFullTree()) { -@@ -4514,6 +4523,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - - } - -+ // Luminol start - Add afterPortalLogic -+ protected void afterPortalLogic() { -+ -+ } -+ // Luminol end - Add afterPortalLogic -+ - protected boolean portalToAsync(ServerLevel destination, BlockPos portalPos, boolean takePassengers, - PortalType type, java.util.function.Consumer teleportComplete) { - ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async"); -@@ -4597,6 +4612,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - info.postTeleportTransition().onTransition(teleported); - } - -+ teleported.afterPortalLogic(); // Luminol - Add afterPortalLogic -+ - // Kaiiju start - vanilla end teleportation - /*if (teleportComplete != null) { - teleportComplete.accept(teleported); -diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index e6f58a8b1733ff902516fe374db691029d4bd79a..713fcba887bbc6a7b059f7448a15be120b743275 100644 ---- a/net/minecraft/world/entity/item/PrimedTnt.java -+++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -253,4 +253,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { - return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid(); - } - // Paper end - Option to prevent TNT from moving in water -+ -+ // Luminol start - Add afterPortalLogic -+ protected void afterPortalLogic() { -+ this.setUsedPortal(true); -+ super.afterPortalLogic(); -+ } -+ // Luminol end - Add afterPortalLogic - } diff --git a/luminol-server/minecraft-patches/features/0061-Teleport-async-if-entity-was-moving-to-another-regio.patch b/luminol-server/minecraft-patches/features/0060-Teleport-async-if-entity-was-moving-to-another-regio.patch similarity index 97% rename from luminol-server/minecraft-patches/features/0061-Teleport-async-if-entity-was-moving-to-another-regio.patch rename to luminol-server/minecraft-patches/features/0060-Teleport-async-if-entity-was-moving-to-another-regio.patch index 81344c0..675b17e 100644 --- a/luminol-server/minecraft-patches/features/0061-Teleport-async-if-entity-was-moving-to-another-regio.patch +++ b/luminol-server/minecraft-patches/features/0060-Teleport-async-if-entity-was-moving-to-another-regio.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Teleport async if entity was moving to another region at once On folia, entity usually cannot move out of the tickregion, but sometimes it actually does(like some end pearl gun that can shoot an end pearl to the block faraway than 10000 blocks even more). To fix this, we added a temporary fix which teleport these entities to the destination instead running its move logics so that we could ensure anything is under control.But one thing need to consider is that teleportAsync is actually calling halfway of the entity tick and there is still something running when teleportAsync called, which is actually modified the entity in another thread, so there is still need an improvement diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index bf12d32178bf05fa806a1e35f5d5dde2bedfe468..7da1cf3df2a9a047012cca417e24ec80fb2d1a2d 100644 +index 87e22d1fed087886ac845f6e816be5bf20fac9fb..b163c43f5398b9f38c75ae7af6a3015b686624ce 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1084,6 +1084,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/luminol-server/minecraft-patches/features/0062-Try-fixing-folia-off-region-POI-accessing-issue.patch b/luminol-server/minecraft-patches/features/0061-Try-fixing-folia-off-region-POI-accessing-issue.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0062-Try-fixing-folia-off-region-POI-accessing-issue.patch rename to luminol-server/minecraft-patches/features/0061-Try-fixing-folia-off-region-POI-accessing-issue.patch diff --git a/luminol-server/minecraft-patches/features/0063-Use-old-registering-way-of-ticket-of-scheduler-api-o.patch b/luminol-server/minecraft-patches/features/0062-Use-old-registering-way-of-ticket-of-scheduler-api-o.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0063-Use-old-registering-way-of-ticket-of-scheduler-api-o.patch rename to luminol-server/minecraft-patches/features/0062-Use-old-registering-way-of-ticket-of-scheduler-api-o.patch