diff --git a/lophine-server/minecraft-patches/features/0024-Modify-merge-ItemEntity-logic.patch b/lophine-server/minecraft-patches/features/0024-Modify-merge-ItemEntity-logic.patch new file mode 100644 index 0000000..6d8e2b2 --- /dev/null +++ b/lophine-server/minecraft-patches/features/0024-Modify-merge-ItemEntity-logic.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Helvetica Volubi +Date: Fri, 3 Oct 2025 19:43:36 +0800 +Subject: [PATCH] Modify merge ItemEntity logic + +Add followTickSequenceMerge to modify merge items, due to Paper's modification of the merge radius, when the merge radius is large and stacks containing many items get stuck in an unexpected position, individual items may never reach their destination. This configuration option is added to fix this behavior. + +diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java +index e5e8c752129a6ebb0dd1315c9b8ec459be11ef07..dfd202a74ec7f2cdb9cdc208a6428090a110f811 100644 +--- a/net/minecraft/world/entity/item/ItemEntity.java ++++ b/net/minecraft/world/entity/item/ItemEntity.java +@@ -295,7 +295,7 @@ public class ItemEntity extends Entity implements TraceableEntity, ChangePublish + ItemStack item = this.getItem(); + ItemStack item1 = itemEntity.getItem(); + if (Objects.equals(this.target, itemEntity.target) && areMergable(item, item1)) { +- if (item1.getCount() < item.getCount()) { ++ if (fun.bm.lophine.config.modules.misc.ItemEntityConfig.followTickSequenceMerge || item1.getCount() < item.getCount()) { // Lophine - add follow Tick Sequence Merge, see Paper#13073 + merge(this, item, itemEntity, item1); + } else { + merge(itemEntity, item1, this, item); diff --git a/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java index f75c7cd..2a12580 100644 --- a/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/ContainerExpansionConfig.java @@ -23,14 +23,16 @@ public class ContainerExpansionConfig implements IConfigModule { range: 1~6""") public static int enderchestRows = 3; + @TransformedConfig(name = "shulker_stackable_count", directory = {"function", "container_expansion"}) @TransformedConfig(name = "shulker_stackable_count", directory = {"misc", "container_expansion"}) @CommandSuggestions(suggest = {"1", "2", "32", "64"}) - @ConfigInfo(name = "shulker_stackable_count", comments = + @ConfigInfo(name = "shulker_stackable_count", directory = {"shulker_box"}, comments = """ range: 1~64""") public static int shulkerCount = 1; + @TransformedConfig(name = "same_nbt_shulker_stackable", directory = {"function", "container_expansion"}) @TransformedConfig(name = "same_nbt_shulker_stackable", directory = {"misc", "container_expansion"}) - @ConfigInfo(name = "same_nbt_shulker_stackable") + @ConfigInfo(name = "same_nbt_shulker_stackable", directory = {"shulker_box"}) public static boolean nbtShulkerStackable = false; } \ No newline at end of file diff --git a/lophine-server/src/main/java/fun/bm/lophine/config/modules/misc/ItemEntityConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/misc/ItemEntityConfig.java new file mode 100644 index 0000000..869e22f --- /dev/null +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/misc/ItemEntityConfig.java @@ -0,0 +1,16 @@ +package fun.bm.lophine.config.modules.misc; + +import me.earthme.luminol.config.IConfigModule; +import me.earthme.luminol.config.flags.ConfigClassInfo; +import me.earthme.luminol.config.flags.ConfigInfo; +import me.earthme.luminol.enums.EnumConfigCategory; + +@ConfigClassInfo(category = EnumConfigCategory.MISC, name = "item-entity") +public class ItemEntityConfig implements IConfigModule { + @ConfigInfo(name = "follow-tick-sequence-merge", comments = """ + Due to Paper's modification of the merge radius, + when the merge radius is large and stacks containing many items get stuck in an unexpected position, + individual items may never reach their destination. + This configuration option is added to fix this behavior.""") + public static boolean followTickSequenceMerge = false; +}