-
Notifications
You must be signed in to change notification settings - Fork 0
Large Chest Overflow Protection
In Java and Minecraft, inventory stack calculations use 32-bit signed integers (int). The maximum representable value of a signed 32-bit integer is:
When a Large Chest (54 inventory slots) contains maximum stacks of items, calculating the sum total of items inside the container sums across all 54 slots.
If every slot in a 54-slot Large Chest holds a stack of size
To prevent
Thus, the Absolute Safety Threshold for stack limits is:
| Stack Limit ( |
54-Slot Chest Total Items | Integer Status | Risk |
|---|---|---|---|
| 128 (Default) | Safe ( |
Zero risk | |
| 1,000,000 | Safe ( |
Zero risk | |
| 39,768,215 | Safe ( |
Recommended Maximum Safe Cap | |
| 40,000,000 |
Overflow! (Wraps to |
Item deletion / container corruption |
In AbstractContainerMenuMixin, vanilla quick-crafting division math is overwritten to use 64-bit double precision floating point math to prevent precision loss and negative integer wrapping when dragging huge stack sizes:
@Mixin(AbstractContainerMenu.class)
public class AbstractContainerMenuMixin {
@Overwrite
public static int getQuickCraftPlaceCount(int quickCraftSlotsSize, int quickCraftingType, ItemStack itemStack) {
return switch (quickCraftingType) {
case 0 -> (int) ((double) itemStack.getCount() / (double) quickCraftSlotsSize);
case 1 -> 1;
case 2 -> itemStack.getMaxStackSize();
default -> itemStack.getCount();
};
}
}📌 Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
Copyright © 2026 Dasik (Rifaditya). Licensed under the GNU General Public License v3.0 (GPLv3).
🏠 Home
- Dynamic GameRules
- Category Stack Limits
- Container Drop Optim.
- Large Chest Overflow
- ModMenu & YACL Config
- Item Count Rendering
- Item Clumps Synergies
- Troubleshooting & FAQ
- Developer Setup
- Architecture Layout
- Mixin Reference
- Addon Override API
- Network Sync Protocol
- Give Command Handling
- Behavior Profiles
- Consumer Mods Guide
- Performance Impact
- Advancements Matrix
- Author: Dasik (Rifaditya)
- License: GPL-3.0-or-later