From 72daae76ae205f2b4797101ce77696c56d867078 Mon Sep 17 00:00:00 2001 From: Anthony Hilyard Date: Mon, 20 Sep 2021 20:17:15 -0700 Subject: Added renderer support for auto registry system. --- .../iceberg/registry/RendererRegistrar.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java (limited to 'src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java') diff --git a/src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java b/src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java new file mode 100644 index 0000000..e77fd1f --- /dev/null +++ b/src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java @@ -0,0 +1,21 @@ +package com.anthonyhilyard.iceberg.registry; + +import net.minecraft.entity.Entity; +import net.minecraftforge.fml.client.registry.IRenderFactory; +import net.minecraftforge.fml.client.registry.RenderingRegistry; + +public abstract class RendererRegistrar +{ + protected static void registerRenderer(String name, IRenderFactory renderFactory) + { + if (AutoRegistry.isEntityTypeRegistered(name)) + { + // Register the rendering handler. + RenderingRegistry.registerEntityRenderingHandler(AutoRegistry.getEntityType(name), renderFactory); + } + else + { + throw new RuntimeException("Tried to register a renderer for an unregistered entity type! Make sure you register renderers after entities."); + } + } +} -- cgit