aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java21
1 files changed, 21 insertions, 0 deletions
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 <T extends Entity> void registerRenderer(String name, IRenderFactory<? super T> renderFactory)
+ {
+ if (AutoRegistry.isEntityTypeRegistered(name))
+ {
+ // Register the rendering handler.
+ RenderingRegistry.registerEntityRenderingHandler(AutoRegistry.<T>getEntityType(name), renderFactory);
+ }
+ else
+ {
+ throw new RuntimeException("Tried to register a renderer for an unregistered entity type! Make sure you register renderers after entities.");
+ }
+ }
+}