package info.u_team.u_team_core.util.registry;

import java.util.function.Function;
import java.util.function.Supplier;

import net.minecraft.client.KeyMapping;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.MenuAccess;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.fmlclient.registry.IRenderFactory;
import net.minecraftforge.fmlclient.registry.RenderingRegistry;

public class ClientRegistry {
	
	public static <M extends AbstractContainerMenu, U extends Screen & MenuAccess<M>> void registerScreen(Supplier<? extends MenuType<? extends M>> supplier, MenuScreens.ScreenConstructor<M, U> factory) {
		MenuScreens.register(supplier.get(), factory);
	}
	
	public static <T extends Entity> void registerEntityRenderer(Supplier<? extends EntityType<T>> supplier, IRenderFactory<? super T> rendererFactory) {
		RenderingRegistry.registerEntityRenderingHandler(supplier.get(), rendererFactory);
	}
	
	public static <T extends BlockEntity> void registerSpecialTileEntityRenderer(Supplier<? extends BlockEntityType<T>> supplier, BlockEntityRenderer<? super T> renderer) {
		registerSpecialTileEntityRenderer(supplier, dispatcher -> renderer);
	}
	
	public static <T extends BlockEntity> void registerSpecialTileEntityRenderer(Supplier<? extends BlockEntityType<T>> supplier, Function<? super BlockEntityRenderDispatcher, ? extends BlockEntityRenderer<? super T>> rendererFactory) {
		net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer(supplier.get(), rendererFactory);
	}
	
	public static void registerKeybinding(KeyMapping key) {
		net.minecraftforge.fml.client.registry.ClientRegistry.registerKeyBinding(key);
	}
	
}

@@ -45,44 +45,8 @@
 y;%0A%0A
-import java.util.function.Function;%0A
 impo
@@ -347,24 +347,24 @@
 tyRender
-Dispatch
+erProvid
 er;%0Aimpo
@@ -427,16 +427,85 @@
 Renderer
+s;%0Aimport net.minecraft.client.renderer.entity.EntityRendererProvider
 ;%0Aimport
@@ -819,69 +819,8 @@
 pe;%0A
-import net.minecraftforge.fmlclient.registry.IRenderFactory;%0A
 impo
@@ -1278,49 +1278,50 @@
 er, 
-IRenderFactory%3C? super T%3E rendererFactory
+EntityRendererProvider%3C? super T%3E provider
 ) %7B%0A
@@ -1383,39 +1383,32 @@
 lier.get(), 
-rendererFactory
+provider
 );%0A%09%7D%0A%09%0A%09pub
@@ -1553,418 +1553,61 @@
 erer
-%3C? super T%3E renderer) %7B%0A%09%09registerSpecialTileEntityRenderer(supplier, dispatcher -%3E renderer);%0A%09%7D%0A%09%0A%09public static %3CT extends BlockEntity%3E void registerSpecialTileEntityRenderer(Supplier%3C? extends BlockEntityType%3CT%3E%3E supplier, Function%3C? super BlockEntityRenderDispatcher, ? extends BlockEntityRenderer%3C? super T%3E%3E rendererFactory) %7B%0A%09%09net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRender
+Provider%3CT%3E provider) %7B%0A%09%09BlockEntityRenderers.regist
 er(s
@@ -1625,23 +1625,16 @@
 (), 
-rendererFactory
+provider
 );%0A%09
@@ -1718,17 +1718,16 @@
 orge.fml
-.
 client.r

Fix client registry