diff options
author | Anthony Hilyard <anthony.hilyard@gmail.com> | 2021-09-20 20:17:15 -0700 |
---|---|---|
committer | Anthony Hilyard <anthony.hilyard@gmail.com> | 2021-09-20 20:17:15 -0700 |
commit | 72daae76ae205f2b4797101ce77696c56d867078 (patch) | |
tree | 79040f3f503f0854b269c74bcd2acc006ca574dd /src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java | |
parent | 3d17eb42809b793e3684d089a3d2bbfd748422cf (diff) | |
download | Iceberg-72daae76ae205f2b4797101ce77696c56d867078.tar.gz Iceberg-72daae76ae205f2b4797101ce77696c56d867078.tar.bz2 Iceberg-72daae76ae205f2b4797101ce77696c56d867078.zip |
Added renderer support for auto registry system.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java')
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java | 21 |
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."); + } + } +} |