Compare commits

..

6 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
7e41183c7f refactor: better log print 2025-04-29 23:49:37 +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
33 changed files with 58 additions and 9 deletions

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,7 +5,7 @@ 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..4a0d07a3263704a7c6e6859ddcbe767c202ed794 100644
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
@@ -28,11 +28,8 @@ index ceca76a5791e319dd7cc4048c9860b1df065b95a..4a0d07a3263704a7c6e6859ddcbe767c
protected final void transform(TeleportTransition telpeort) {
PositionMoveRotation move = PositionMoveRotation.calculateAbsolute(
PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives()
@@ -4186,10 +4199,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
wrapped.callEvent();
// Luminol end
- // check for same region
@@ -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 (

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Portal Behavior Modifiers
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 4a0d07a3263704a7c6e6859ddcbe767c202ed794..5f30ea9ed5c0feb7272d35f0f5c0b748f2aebcd6 100644
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
@@ -51,7 +51,7 @@ index 4a0d07a3263704a7c6e6859ddcbe767c202ed794..5f30ea9ed5c0feb7272d35f0f5c0b748
public void addTracker() {
for (final EntityTreeNode node : this.getFullTree()) {
@@ -4557,6 +4564,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4558,6 +4565,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
@@ -64,7 +64,7 @@ index 4a0d07a3263704a7c6e6859ddcbe767c202ed794..5f30ea9ed5c0feb7272d35f0f5c0b748
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");
@@ -4640,6 +4653,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4641,6 +4654,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}