Integrasi Corong & Otomasi (MC 26.2)
Dokumen ini menjelaskan mekanisme ekstraksi corong, paritas laju transfer, stabilitas penyortir redstone, dan integrasi kontainer dari Item Clumps untuk Minecraft 26.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 Pengurangan Item | originalStack.shrink(1) dengan pembaruan metadata entity.setItem() |
| 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(1) │ │ (Standard 1-item / stack) │
└─────────────┬─────────────┘ └───────────────────────────┘
│
▼
┌───────────────────────────┐
│ Try Insert Into Hopper │
│ HopperBlockEntity.addItem │
└─────────────┬─────────────┘
│
┌────────┴────────┐
│ │
(Success) (Failed / Full)
│ │
▼ ▼
┌───────────────────┐ ┌───────────────┐
│ Shrink Ground │ │ Abort Transfer│
│ Clump by 1; │ │ Entity Retains│
│ Refresh Name Tag. │ │ Full Count. │
└───────────────────┘ └───────────────┘⏱️ Kecepatan Transfer & Paritas Penyortir Redstone
Corong vanilla Minecraft beroperasi pada cooldown 8 tick ($0.4$ detik):
$$\text{Hopper Transfer Rate} = \frac{1\text{ item}}{8\text{ ticks}} = \frac{20\text{ ticks/s}}{8\text{ ticks}} = 2.5\text{ items/second}$$
Karena Item Clumps mengekstraksi tepat $1$ item per siklus:
- Penyortir Item Standar: Corong filter penyortir (konfigurasi 41-1-1-1-1 item) menyedot kelompok item pada kecepatan yang tepat tanpa merusak sinyal komparator atau jalur redstone tetangga.
- Penyortir Aliran Air: Kelompok item masif yang melayang di atas jalur corong disedot bertahap tanpa menyumbat aliran air atau memicu lag tabrakan entitas.
- Kereta Tambang dengan Corong: Mengumpulkan item dari mega-clump dengan kecepatan dua kali lipat dari corong biasa ($1$ item per $1$ tick = $20$ item/detik), sepenuhnya sesuai dengan perilaku minecart vanilla.
💻 Implementasi Kode Sumber Java Asli
Dari HopperBlockEntityMixin.java di Minecraft 26.2:
@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 slice.
ItemStack baseItem = itemStack.copyWithCount(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().copy();
originalStack.shrink(1);
entity.setItem(originalStack); // Updates standard item tracker and custom name
cir.setReturnValue(true);
} else {
// Hopper was full or couldn't accept item
cir.setReturnValue(false);
}
}
}