第124批续27: 0信任拖拽/点击路径 unsetData 彻底交还原版堆叠
Auto Release / build (push) Successful in 2m39s

onInventoryClick 在 0信任(stackEnabled=false/坏JSON停用)时, 对当前/光标物品 unsetData 清除自定义 max_stack_size 组件。
此前 applyStackSize 在 0信任时 return false 不写也不清除组件, 导致玩家拖出的14蛋仍带 max=64 组件,
14+2=16 受 64 约束无法合并到16(原版上限)。修复后玩家像原版一样堆叠。
This commit is contained in:
youpaishidifu
2026-11-18 17:44:50 +08:00
parent bba83aa115
commit 93f5ebea31
@@ -926,13 +926,39 @@ public class StackConfigManager implements Listener {
}
}
ItemStack cursor = e.getCursor();
if (cursor != null && applyStackSize(cursor)) {
changed = true;
e.setCursor(cursor);
// ★ 续27(2026-11-18):0信任(stackEnabled=false / 坏JSON停用)时,
// 对当前/光标物品 unsetData 清除自定义 max_stack_size 组件,彻底交还原版堆叠。
// 此前 applyStackSize 在 0信任时直接 return false 不写组件、也不清除已有组件,
// 导致玩家拖出的 14 蛋仍带 max=64 组件,14+2=16 受 64 约束无法合并到 16(原版上限)。
// 修复:0信任时 unsetData 清除,玩家像原版一样堆叠(16 蛋满格)。
if (!stackEnabled) {
if (current != null) {
try {
current.unsetData(io.papermc.paper.datacomponent.DataComponentTypes.MAX_STACK_SIZE);
int rawSlot = e.getRawSlot();
if (rawSlot >= 0 && rawSlot < clicked.getSize()) {
clicked.setItem(rawSlot, current);
}
changed = true;
} catch (Exception ignored) {}
}
ItemStack cur2 = e.getCursor();
if (cur2 != null) {
try {
cur2.unsetData(io.papermc.paper.datacomponent.DataComponentTypes.MAX_STACK_SIZE);
e.setCursor(cur2);
changed = true;
} catch (Exception ignored) {}
}
} else {
ItemStack cursor = e.getCursor();
if (cursor != null && applyStackSize(cursor)) {
changed = true;
e.setCursor(cursor);
}
}
if (changed) logApplyThrottled(current, cursor);
if (changed) logApplyThrottled(current, e.getCursor());
}
/**