-
Notifications
You must be signed in to change notification settings - Fork 0
Container Drop Optimization
In vanilla Minecraft, breaking a container (chest, barrel, shulker box) containing items splits each slot's stack into small entity piles of 10โ30 items each. If a chest contains stacks of thousands or millions of items, breaking that chest attempts to spawn hundreds of thousands of item entities in a single tick, causing server freeze or immediate game crash.
InventoryDropHelper.dropItemStack intercepts vanilla Containers.dropItemStack via ContainersMixin to split large stacks into controlled entity counts:
public class InventoryDropHelper {
public static void dropItemStack(Level level, double x, double y, double z, ItemStack itemStack) {
...
int maxEntities = DynamicGameRuleManager.getInt(level, StackSizeAdjusterFabric.MAX_DROP_ENTITIES);
while (!itemStack.isEmpty()) {
int currentCount = itemStack.getCount();
int splitSize = random.nextInt(21) + 10;
// Safety limit: cap entity spawning per slot
if (currentCount > splitSize * maxEntities) {
splitSize = (currentCount + maxEntities - 1) / maxEntities;
}
ItemEntity entity = new ItemEntity(level, xo, yo, zo, itemStack.split(splitSize));
...
level.addFreshEntity(entity);
}
}
}Given a total stack count max_drop_entities
- Baseline random split size
$S \in [10, 30]$ . - Dynamic split threshold check:
$$\text{If } N > S \times M \implies S_{\text{effective}} = \left\lceil \frac{N}{M} \right\rceil$$ - Total spawned
ItemEntitycount for that slot is bounded strictly by:$$E_{\text{spawned}} \le M$$
max_drop_entities Setting |
100,000 Item Drop Entities | Server Tick Impact | Visual Scatter |
|---|---|---|---|
| Vanilla (Uncapped) |
|
Severe Lag / Crash | Extreme |
| 8 (Recommended Default) |
|
|
Excellent visual scatter |
| 1 (Max Performance) | Exactly |
Instant ( |
Single entity pile |
๐ 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