package org.squiddev.plethora.integration.vanilla.converter;

import net.minecraft.inventory.IInventory;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.InvWrapper;
import org.squiddev.plethora.api.converter.IConverter;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

@IConverter.Inject(IInventory.class)
public class ConverterItemHandler implements IConverter<IInventory, IItemHandler> {
	@Nullable
	@Override
	public IItemHandler convert(@Nonnull IInventory from) {
		return new InvWrapper(from);
	}
}

@@ -79,29 +79,53 @@
 raft
-.inventory.IInventory
+forge.common.capabilities.ICapabilityProvider
 ;%0Aim
@@ -154,17 +154,26 @@
 e.items.
-I
+Capability
 ItemHand
@@ -213,24 +213,18 @@
 ems.
-wrapper.InvWrapp
+IItemHandl
 er;%0A
@@ -367,25 +367,34 @@
 Inject(I
-Inventory
+CapabilityProvider
 .class)%0A
@@ -450,25 +450,34 @@
 verter%3CI
-Inventory
+CapabilityProvider
 , IItemH
@@ -551,54 +551,114 @@
 ll I
-Inventory from) %7B%0A%09%09return new InvWrapper(from
+CapabilityProvider from) %7B%0A%09%09return from.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null
 );%0A%09

Convert from IItemHandler capability