Integrasi Corong & Otomasi (MC 26.1.2)
Dokumen ini menjelaskan mekanisme ekstraksi corong, paritas laju transfer, stabilitas penyortir redstone, dan integrasi kontainer dari Item Clumps untuk Minecraft 26.1.2.
📊 Kotak Info Fitur
| Properti | Spesifikasi |
|---|---|
| Nama Sistem | Mesin Ekstraksi Tetesan Corong |
| Kelas Target | net.minecraft.world.level.block.entity.HopperBlockEntity |
| Metode Ekstraksi | HopperBlockEntity.addItem(Container, ItemEntity) |
| Laju Ekstraksi | $1$ item per $8$ tick ($2,5$ item/detik) |
| Strategi Irisan Item | baseItem.setCount(1) |
| Kompatibilitas Otomasi | 100% kompatibel dengan Penyortir Item & Filter Redstone Vanilla |
⚙️ Arsitektur Tetesan Otomasi
Di vanilla Minecraft, corong menyedot seluruh entitas ItemEntity jika jumlah tumpukannya $\le 64$ dan corong memiliki ruang. Jika mod mengizinkan corong menyerap mega-clump berisi 5.000 item sekaligus, corong akan meluap atau ribuan item akan hilang begitu saja.
Item Clumps memotong HopperBlockEntity.addItem untuk menegakkan Ekstraksi Tetesan (Drip Extraction):
┌────────────────────────────┐
│ Hopper Tick Cycle │
│ (Every 8 Game Ticks) │
└─────────────┬──────────────┘
│
▼
┌────────────────────────────┐
│ Is Item Entity Count > 1? │
└─────────────┬──────────────┘
│
┌────────────────┴────────────────┐
│ (Yes) │ (No)
▼ ▼
┌───────────────────────────┐ ┌───────────────────────────┐
│ Clone Single Item Slice │ │ Native Vanilla Extraction │
│ baseItem = stack.copy() │ │ (Standard 1-item / stack) │
│ baseItem.setCount(1) │ └───────────────────────────┘
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ Try Insert Into Hopper │
│ HopperBlockEntity.addItem │
└─────────────┬─────────────┘
│
┌────────┴────────┐
│ │
(Success) (Failed / Full)
│ │
▼ ▼
┌───────────────────┐ ┌───────────────┐
│ Shrink Ground │ │ Abort Transfer│
│ Clump by 1; │ │ Entity Retains│
│ Refresh Name Tag. │ │ Full Count. │
└───────────────────┘ └───────────────┘💻 Implementasi Kode Sumber Java Asli
Dari HopperBlockEntityMixin.java di Minecraft 26.1.2:
java
@Inject(method = "addItem(Lnet/minecraft/world/Container;Lnet/minecraft/world/entity/item/ItemEntity;)Z", at = @At("HEAD"), cancellable = true)
private static void item_clumps$customHopperExtract(Container container, ItemEntity entity, CallbackInfoReturnable<Boolean> cir) {
ItemStack itemStack = entity.getItem();
int count = itemStack.getCount();
if (count > 1) {
// Entity is a clump. Extract exactly 1 item.
ItemStack baseItem = itemStack.copy();
baseItem.setCount(1);
ItemStack result = HopperBlockEntity.addItem(null, container, baseItem, null);
if (result.isEmpty()) {
// Hopper successfully absorbed the 1 item. Shrink entity stack.
ItemStack originalStack = entity.getItem();
originalStack.shrink(1);
entity.setItem(originalStack); // Updates standard item tracker and custom name
cir.setReturnValue(true);
} else {
// Hopper was full or couldn't take it
cir.setReturnValue(false);
}
}
}