Compare commits

..

13 Commits

Author SHA1 Message Date
MrHua269
fbc64bd17c Tidy patches 2025-04-30 21:02:59 +08:00
M2ke4U
462f2d940d Merge pull request #83 from Suisuroru/ss/setblock-fix
Command IllegalArgumentException crash fix
2025-04-30 20:56:30 +08:00
MrHua269
157b73620a Tidy patches 2025-04-30 19:29:09 +08:00
Helvetica Volubi
bb107e7e4c EndGateway Portal Passengers Fix (#90)
* feat: EndGateway Portal Passengers Fix

* refactor: delete some debug information

* refactor: merge patches to [Portal behavior modifiers]

* refactor: rebuild patch
2025-04-30 16:52:48 +08:00
Helvetica Volubi
7e41183c7f refactor: better log print 2025-04-29 23:49:37 +08:00
MrHua269
8668ac45f4 Fix off tickregion sync teleport & tidy patches 2025-04-29 23:06:36 +08:00
M2ke4U
60a82d9766 Merge pull request #88 from Suisuroru/ss/portal-speed-fix
Entity portal-teleport speed fix
2025-04-28 23:28:54 +08:00
Helvetica Volubi
8d222e6b02 patch: fixup a patch's name 2025-04-28 15:14:39 +08:00
Helvetica Volubi
94e5c047a3 note: fixup note 2025-04-28 12:31:00 +08:00
Helvetica Volubi
55e50ffc54 feat: add flag to process async failed 2025-04-28 12:05:43 +08:00
Helvetica Volubi
b66229fdfb fix: Entity portal-teleport speed fix 2025-04-28 11:53:51 +08:00
Helvetica Volubi
04d414a04b feat: origin print complete 2025-04-24 23:47:39 +08:00
Helvetica Volubi
3a8425d3e9 bugfix: fix crash when execute setblock with an illegal nbt 2025-04-24 21:06:41 +08:00
35 changed files with 230 additions and 59 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Correct player respawn place
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 884d338e00017ff351b91c70fb51186cbdfb1fe6..d0853f44f1b4c88ba62a74db9e49a32709685425 100644
index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..b6df8df78105e08ca7be82524685d8b9422abf21 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -472,8 +472,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Thu, 24 Apr 2025 20:59:52 +0800
Subject: [PATCH] Command IllegalArgumentException crash fix
diff --git a/net/minecraft/server/commands/FillCommand.java b/net/minecraft/server/commands/FillCommand.java
index 89154adfc659afa188cd771e70087e3b1a9c98b9..e622f96e6e116bf491bbea39da099e02ceaee502 100644
--- a/net/minecraft/server/commands/FillCommand.java
+++ b/net/minecraft/server/commands/FillCommand.java
@@ -210,6 +210,10 @@ public class FillCommand {
// Folia start - region threading
} catch (CommandSyntaxException ex) {
sendMessage(source, ex);
+ // Luminol Start - Server crash fix
+ } catch (IllegalArgumentException ex) {
+ net.minecraft.server.commands.SetBlockCommand.processIAE(source, ex);
+ // Luminol End - Server crash fix
}
}); return 0; // Folia end - region threading
}
diff --git a/net/minecraft/server/commands/SetBlockCommand.java b/net/minecraft/server/commands/SetBlockCommand.java
index 05b824409546ba8bacf7efdaeac106af89ff0715..55911d49c7650b344b46b2cfa9c4ae840ae433c8 100644
--- a/net/minecraft/server/commands/SetBlockCommand.java
+++ b/net/minecraft/server/commands/SetBlockCommand.java
@@ -86,6 +86,15 @@ public class SetBlockCommand {
}
// Folia end - region threading
+ // Luminol Start - Server crash fix
+ public static void processIAE(CommandSourceStack src, IllegalArgumentException ex) {
+ Component hoverText = Component.translatable("command.failed")
+ .withStyle(style -> style.withHoverEvent(new net.minecraft.network.chat.HoverEvent(net.minecraft.network.chat.HoverEvent.Action.SHOW_TEXT, Component.literal(ex.getMessage()))));
+ src.sendFailure(hoverText);
+ com.mojang.logging.LogUtils.getLogger().error(ex.getMessage(), ex);
+ }
+ // Luminol end - Server crash fix
+
private static int setBlock(
CommandSourceStack source, BlockPos pos, BlockInput state, SetBlockCommand.Mode mode, @Nullable Predicate<BlockInWorld> predicate
) throws CommandSyntaxException {
@@ -119,6 +128,10 @@ public class SetBlockCommand {
// Folia start - region threading
} catch (CommandSyntaxException ex) {
sendMessage(source, ex);
+ // Luminol Start - Server crash fix
+ } catch (IllegalArgumentException ex) {
+ processIAE(source, ex);
+ // Luminol End - Server crash fix
}
});
return 1;

View File

@@ -5,10 +5,10 @@ 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 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..c2562b8f7ca3bc815a5abe5ae00a6fe1654b002d 100644
index b6df8df78105e08ca7be82524685d8b9422abf21..98ce0736c18cbb09704ef7ca6b67866d5736f7c7 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1661,6 +1661,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1673,6 +1673,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
if (respawnComplete != null) {
respawnComplete.accept(ServerPlayer.this);
}

View File

@@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:45 +0800
Subject: [PATCH] Fix SculkCatalyst exp skip
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index c2562b8f7ca3bc815a5abe5ae00a6fe1654b002d..884d338e00017ff351b91c70fb51186cbdfb1fe6 100644
index 98ce0736c18cbb09704ef7ca6b67866d5736f7c7..d0853f44f1b4c88ba62a74db9e49a32709685425 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1346,7 +1346,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1358,7 +1358,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
// SPIGOT-5478 must be called manually now
@@ -17,7 +17,7 @@ index c2562b8f7ca3bc815a5abe5ae00a6fe1654b002d..884d338e00017ff351b91c70fb51186c
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) {
// Paper start - PlayerDeathEvent#getItemsToKeep
@@ -1380,6 +1380,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1392,6 +1392,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setClientLoaded(false);
}
@@ -34,7 +34,7 @@ index c2562b8f7ca3bc815a5abe5ae00a6fe1654b002d..884d338e00017ff351b91c70fb51186c
AABB aabb = new AABB(this.blockPosition()).inflate(32.0, 10.0, 32.0);
this.level()
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 015a6c45241148eb5a26f9494ca731354273f3cd..1df158d30622ea71fcc937140c682d0e994d54c1 100644
index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..658aa09aecf8d64145feedb82dc9be2a55201450 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -293,6 +293,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Thu, 7 Nov 2024 21:50:47 +0100
Subject: [PATCH] Lithium: fast util
Subject: [PATCH] Lithium: Fast util
This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java"

View File

@@ -1,47 +0,0 @@
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] Add afterPortalLogic to process some logics
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ceca76a5791e319dd7cc4048c9860b1df065b95a..065e74d29eee35e07a0d5db8850dc6f93a9729c0 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4545,6 +4545,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<Entity> teleportComplete) {
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
@@ -4628,6 +4634,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 88570bb4aa02896545805d7721c45cf9599befea..bbf9748a36404139356db606dbb3b0cc13c66b50 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -251,4 +251,10 @@ 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);
+ }
+ // Luminol start - Add afterPortalLogic
}

View File

@@ -12,10 +12,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..015a6c45241148eb5a26f9494ca731354273f3cd 100644
index 658aa09aecf8d64145feedb82dc9be2a55201450..1df158d30622ea71fcc937140c682d0e994d54c1 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2642,6 +2642,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2644,6 +2644,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void updateSwingTime() {
@@ -23,7 +23,7 @@ index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..015a6c45241148eb5a26f9494ca73135
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -3567,6 +3568,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3569,6 +3570,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected void updateFallFlying() {
this.checkSlowFallDistance();
if (!this.level().isClientSide) {

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Thu, 24 Apr 2025 23:11:13 +0800
Subject: [PATCH] Fix off tickregion sync teleport
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ceca76a5791e319dd7cc4048c9860b1df065b95a..fc7da66320bfd8701b754e607ad18370f460fd4d 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4067,6 +4067,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.resetStoredPositions();
}
+ // Luminol start - Fix sync teleport issue
+ private boolean getNearByEdge(int destX, int destZ) {
+ int sizeBx = Math.min(6, (int) (this.bb.maxX - this.bb.minX) + this.level.getCraftServer().getSimulationDistance());
+ int sizeBz = Math.min(6, (int) (this.bb.maxZ - this.bb.minZ) + this.level.getCraftServer().getSimulationDistance());
+
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level,
+ (destX >> 4) - sizeBx,
+ (destZ >> 4) - sizeBz,
+ (destX >> 4) + sizeBx,
+ (destZ >> 4) + sizeBz);
+ }
+ // Luminol end
+
protected final void transform(TeleportTransition telpeort) {
PositionMoveRotation move = PositionMoveRotation.calculateAbsolute(
PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives()
@@ -4189,7 +4202,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// check for same region
if (destination == this.level()) {
Vec3 currPos = this.position();
- if (
+ if (this.getNearByEdge((int) pos.x, (int) pos.z) && // Luminol - Fix sync teleport issue
destination.regioniser.getRegionAtUnsynchronised(
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(currPos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(currPos)
) == destination.regioniser.getRegionAtUnsynchronised(

View File

@@ -0,0 +1,127 @@
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] Portal Behavior Modifiers
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index fc7da66320bfd8701b754e607ad18370f460fd4d..ddea23366c290ce44cc0c6764dffba5aeb63772a 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -3304,7 +3304,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPortalCooldown();
} else {
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
- this.portalProcess = new PortalProcessor(portal, pos.immutable());
+ this.portalProcess = new PortalProcessor(portal, pos.immutable(), this.getDeltaMovement()); // Luminol - Entity portal-teleport speed fix
} else if (!this.portalProcess.isInsidePortalThisTick()) {
this.portalProcess.updateEntryPosition(pos.immutable());
this.portalProcess.setAsInsidePortalThisTick(true);
@@ -3829,20 +3829,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<Entity> 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()) {
@@ -4558,6 +4565,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<Entity> teleportComplete) {
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
@@ -4641,6 +4654,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/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java
index 46d989aef0eceebd98bfd93999153319de77a8a0..6e9171fa0c636439bd96401ea9e5fe80ffdc8bdd 100644
--- a/net/minecraft/world/entity/PortalProcessor.java
+++ b/net/minecraft/world/entity/PortalProcessor.java
@@ -9,12 +9,14 @@ import net.minecraft.world.level.portal.TeleportTransition;
public class PortalProcessor {
private final Portal portal;
private BlockPos entryPosition;
+ private net.minecraft.world.phys.Vec3 speedVec3; // Luminol - Entity portal-teleport speed fix
private int portalTime;
private boolean insidePortalThisTick;
- public PortalProcessor(Portal portal, BlockPos entryPosition) {
+ public PortalProcessor(Portal portal, BlockPos entryPosition, net.minecraft.world.phys.Vec3 speedVec3) { // Luminol - Entity portal-teleport speed fix
this.portal = portal;
this.entryPosition = entryPosition;
+ this.speedVec3 = speedVec3; // Luminol - Entity portal-teleport speed fix
this.insidePortalThisTick = true;
}
@@ -35,7 +37,15 @@ public class PortalProcessor {
// Folia start - region threading
public boolean portalAsync(ServerLevel sourceWorld, Entity portalTarget) {
- return this.portal.portalAsync(sourceWorld, portalTarget, this.entryPosition);
+ // Luminol start - Entity portal-teleport speed fix
+ net.minecraft.world.phys.Vec3 oldSpeed = portalTarget.getDeltaMovement();
+ portalTarget.setDeltaMovement(this.speedVec3);
+ boolean flag = this.portal.portalAsync(sourceWorld, portalTarget, this.entryPosition);
+ if (!flag) {
+ portalTarget.setDeltaMovement(oldSpeed);
+ }
+ return flag;
+ // Luminol end - Entity portal-teleport speed fix
}
// Folia end - region threading
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 88570bb4aa02896545805d7721c45cf9599befea..bbf9748a36404139356db606dbb3b0cc13c66b50 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -251,4 +251,10 @@ 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);
+ }
+ // Luminol start - Add afterPortalLogic
}