-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Smart Pickup and Inventory Distribution
This document details the single-batch inventory intake, capacity simulation, vanilla stack creation, and zero-NBT pollution architecture of Item Clumps for Minecraft 26.2.
| Property | Specification |
|---|---|
| System Name | Smart Batch Inventory Dispatcher |
| Target Class | net.minecraft.world.entity.item.ItemEntity |
| Inventory Limits | Strict vanilla compliance ( |
| Data Cleanliness |
|
| Pickup Animation | Native player.take(this, added) entity animation & sound effects |
| Statistics Tracking | Triggers vanilla Stats.ITEM_PICKED_UP.get(item)
|
| Partial Pickup | Fully supported (Leaves uncollected remainder on ground) |
A critical design requirement of Item Clumps is Zero Inventory Pollution. Even though an entity on the ground can hold
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Player Collides with Ground Clump (e.g. 500x)β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Pickup Validity & Target Check β
β - pickupDelay == 0? β
β - target == null || target == player? β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β (Pass)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Single-Batch Native Inventory Dispatch β
β player.getInventory().add(stack) β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β
βββββββββββββββββββ΄ββββββββββββββββββ
β β
Inventory Has Space Inventory Becomes Full
β β
βΌ βΌ
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β Entire Clump Absorbed β β Partial Pickup β
β - 500 items transferred β β - e.g. 192 items added β
β - Clump entity removed β β - 308 items remain in β
β - Sound & particles playβ β ground clump entity β
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
Items on the ground display a custom name tag (e.g. Stone x500) to communicate their count to players. However, when those items enter a player's inventory:
-
Name Tags Removed: The custom name tag belongs strictly to the
ItemEntity, not the underlyingItemStack. -
Vanilla Stacking: Because the
ItemStackentering the player inventory has no custom components, it stacks seamlessly with existing items in chests, shulker boxes, and vanilla crafting tables. - No Ghost Data: World saves remain 100% clean and uncorrupted, even if the mod is later uninstalled from the server.
From ItemEntityMixin.java in Minecraft 26.2:
@Inject(method = "playerTouch", at = @At("HEAD"), cancellable = true)
private void item_clumps$smartPickup(Player player, CallbackInfo ci) {
if (!DynamicGameRuleManager.getBoolean(this.level(), ItemClumpsFabric.ENABLE_CLUMPING) ||
this.level().isClientSide()) return;
int count = this.getItem().getCount();
if (count <= 1) return; // Allow vanilla to handle normal 1-count items
if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID()))) {
ItemStack pickupStack = this.getItem().copy();
int originalCount = count;
// Native batch addition into player inventory
player.getInventory().add(pickupStack);
int added = originalCount - pickupStack.getCount();
if (added > 0) {
player.take(this, added);
player.awardStat(net.minecraft.stats.Stats.ITEM_PICKED_UP.get(pickupStack.getItem()), added);
ItemStack remainingStack = this.getItem().copyWithCount(pickupStack.getCount());
this.setItem(remainingStack);
if (pickupStack.getCount() <= 0) {
player.onItemPickup((ItemEntity) (Object) this);
}
}
ci.cancel(); // Prevent vanilla pickup interference
}
}Item Clumps is engineered with β€οΈ by Dasik (Rifaditya) | Licensed under GNU General Public License v3.0 (GPL-3.0-or-later).
π 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.
- 26.2 Hub
- 26.2 Mega-Stack Clumping
- 26.2 Smart Pickup System
- 26.2 Hopper Integration
- 26.2 Despawn Age Rules
- 26.2 Holographic Labels
- 26.2 Mod Compatibility
- 26.2 GameRules Table
- 26.2 Commands & Admin
- 26.2 Advancements
- 26.2 Configuration
- 26.2 ModVersionGuard
- 26.2 Architecture & Mixins
- 26.2 Developer Setup
- 26.2 API & Addons
- 26.2 FAQ & Diagnostics
- 26.1.2 Hub
- 26.1.2 Mega-Stack Clumping
- 26.1.2 Smart Pickup System
- 26.1.2 Hopper Integration
- 26.1.2 Despawn Age Rules
- 26.1.2 Holographic Labels
- 26.1.2 GameRules Table
- 26.1.2 Commands & Admin
- 26.1.2 Advancements
- 26.1.2 Configuration
- 26.1.2 Architecture & Mixins
- 26.1.2 Developer Setup
- 26.1.2 API & Addons
- 26.1.2 FAQ & Diagnostics