Part models

This commit is contained in:
Sebastian Hartte
2020-06-09 00:53:40 +02:00
parent 4b11b8857b
commit 97e065ea1f
154 changed files with 578 additions and 839 deletions
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -43,15 +44,16 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
{
public static InventoryAdaptor getAdaptor( final TileEntity te, final Direction d )
{
// FIXME if( te != null && te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ) )
// FIXME {
// FIXME // Attempt getting an IItemHandler for the given side via caps
// FIXME IItemHandler itemHandler = te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d );
// FIXME if( itemHandler != null )
// FIXME {
// FIXME return new AdaptorItemHandler( itemHandler );
// FIXME }
// FIXME }
if( te != null )
{
LazyOptional<IItemHandler> cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d);
// Attempt getting an IItemHandler for the given side via caps
if( cap.isPresent() )
{
return new AdaptorItemHandler( cap.orElseThrow(IllegalStateException::new) );
}
}
return null;
}