Hi, i have attached a IItemHandler capability to my entity but i have to pass an IInventory to my Container and i don't kwon how convert it in order to be able to pass to the Container constructor.
Here is the code:
Entity:
@CapabilityInject(IItemHandler.class)
private static Capability<IItemHandler> ITEM_HANDLER_CAPABILITY = null;
protected IItemHandler inventory = new ItemStackHandler();
Container:
public class RidableDolphinContainer extends Container {
private PlayerInventory playerInventory;
private IInventory inventory;
public RidableDolphinContainer(int windowID, PlayerInventory playerInventory) {
this(windowID, playerInventory, new Inventory(1));
}
public RidableDolphinContainer(int windowID, PlayerInventory playerInventory, IInventory inventory) {
super(ModContainers.RIDABLE_DOLPHIN.get(), windowID);
assertInventorySize(inventory, 1);
this.playerInventory = playerInventory;
this.inventory = inventory;
inventory.openInventory(playerInventory.player);
this.addSlot(new SlotSonarRidableDolphin(inventory, 0, 80, 20));