aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/registry/RendererRegistrar.java
blob: e77fd1f0f2eff23a0800f13758775d269257401b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.");
		}
	}
}