package com.infinityraider.infinitylib.container;

import com.infinityraider.infinitylib.utility.IInfinityRegistrable;
import net.minecraft.client.gui.IHasContainer;
import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

import javax.annotation.Nullable;

public interface IInfinityContainerType extends IInfinityRegistrable<ContainerType<?>> {

    @Nullable
    IGuiFactory<?> getGuiFactory();

    interface IGuiFactory<T extends Container> {
        @OnlyIn(Dist.CLIENT)
        <U extends Screen & IHasContainer<T>> U createGui(T container, PlayerInventory inventory, ITextComponent name);
    }

    @OnlyIn(Dist.CLIENT)
    @SuppressWarnings("unchecked")
    static <T extends Container, U extends Screen & IHasContainer<T>> ScreenManager.IScreenFactory<T,U> castGuiFactory(IGuiFactory factory) {
        return factory::createGui;
    }
}

@@ -257,60 +257,8 @@
 en;%0A
-import net.minecraft.entity.player.PlayerInventory;%0A
 impo
@@ -297,32 +297,32 @@
 iner.Container;%0A
+
 import net.minec
@@ -365,55 +365,8 @@
 pe;%0A
-import net.minecraft.util.text.ITextComponent;%0A
 impo
@@ -762,79 +762,64 @@
 T%3E%3E 
-U createGui(T container, PlayerInventory inventory, ITextComponent name
+ScreenManager.IScreenFactory%3CT, U%3E getGuiScreenProvider(
 );%0A 
@@ -1052,19 +1052,31 @@
 tory
-::createGui
+.getGuiScreenProvider()
 ;%0A  

Fix a generics bug