Files
Applied-Energistics-2-Unoff…/src/main/java/appeng/container/implementations/ContainerBusIO.java
T
bd11e11741 Universal GUI (#872)
Co-authored-by: Kogepan229 <kogepan25629@gmail.com>
Co-authored-by: Kogepan229 <73163994+Kogepan229@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2025-12-11 16:09:06 +01:00

41 lines
1.4 KiB
Java

package appeng.container.implementations;
import static appeng.util.Platform.isServer;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.storage.StorageName;
import appeng.api.storage.data.IAEStack;
import appeng.container.interfaces.IVirtualSlotHolder;
import appeng.parts.automation.PartSharedItemBus;
import appeng.tile.inventory.IAEStackInventory;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
public class ContainerBusIO extends ContainerUpgradeable implements IVirtualSlotHolder {
public final IAEStack<?>[] virtualSlotsClient = new IAEStack<?>[9];
private final PartSharedItemBus<?> bus;
public ContainerBusIO(final InventoryPlayer ip, final PartSharedItemBus<?> te) {
super(ip, te);
this.bus = te;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
this.updateVirtualSlots(StorageName.NONE, this.bus.getAEInventoryByName(StorageName.NONE), virtualSlotsClient);
}
@Override
public void receiveSlotStacks(StorageName invName, Int2ObjectMap<IAEStack<?>> slotStacks) {
final IAEStackInventory storage = this.bus.getAEInventoryByName(StorageName.NONE);
for (var entry : slotStacks.int2ObjectEntrySet()) {
storage.putAEStackInSlot(entry.getIntKey(), entry.getValue());
}
if (isServer()) {
this.updateVirtualSlots(StorageName.CRAFTING_OUTPUT, storage, virtualSlotsClient);
}
}
}