Fixed RenderingRegistry not working. Closes #2312.
This commit is contained in:
parent
6e90348dc5
commit
cf2bbd1353
5 changed files with 19 additions and 28 deletions
|
@ -1,8 +1,10 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
|
||||
@@ -193,6 +193,10 @@
|
||||
@@ -192,7 +192,12 @@
|
||||
this.field_178637_m = new RenderPlayer(this);
|
||||
this.field_178636_l.put("default", this.field_178637_m);
|
||||
this.field_178636_l.put("slim", new RenderPlayer(this, true));
|
||||
+ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.field_78729_o);
|
||||
}
|
||||
+
|
||||
+ public Map<String, RenderPlayer> getSkinMap() {
|
||||
|
@ -11,7 +13,7 @@
|
|||
|
||||
public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_)
|
||||
{
|
||||
@@ -241,9 +245,9 @@
|
||||
@@ -241,9 +246,9 @@
|
||||
IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_));
|
||||
Block block = iblockstate.func_177230_c();
|
||||
|
||||
|
|
|
@ -321,7 +321,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
|
||||
// Reload resources
|
||||
client.refreshResources();
|
||||
RenderingRegistry.loadEntityRenderers(Minecraft.getMinecraft().getRenderManager().entityRenderMap);
|
||||
guiFactories = HashBiMap.create();
|
||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
||||
{
|
||||
|
|
|
@ -31,13 +31,13 @@ public class ClientRegistry
|
|||
* @param id
|
||||
* @param specialRenderer
|
||||
*/
|
||||
public static <T extends TileEntity> void registerTileEntity(Class<T> tileEntityClass, String id, TileEntitySpecialRenderer<T> specialRenderer)
|
||||
public static <T extends TileEntity> void registerTileEntity(Class<T> tileEntityClass, String id, TileEntitySpecialRenderer<? super T> specialRenderer)
|
||||
{
|
||||
GameRegistry.registerTileEntity(tileEntityClass, id);
|
||||
bindTileEntitySpecialRenderer(tileEntityClass, specialRenderer);
|
||||
}
|
||||
|
||||
public static <T extends TileEntity> void bindTileEntitySpecialRenderer(Class<T> tileEntityClass, TileEntitySpecialRenderer<T> specialRenderer)
|
||||
public static <T extends TileEntity> void bindTileEntitySpecialRenderer(Class<T> tileEntityClass, TileEntitySpecialRenderer<? super T> specialRenderer)
|
||||
{
|
||||
TileEntityRendererDispatcher.instance.mapSpecialRenderers.put(tileEntityClass, specialRenderer);
|
||||
specialRenderer.setRendererDispatcher(TileEntityRendererDispatcher.instance);
|
||||
|
|
|
@ -11,52 +11,44 @@
|
|||
*/
|
||||
package net.minecraftforge.fml.client.registry;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class RenderingRegistry
|
||||
{
|
||||
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
|
||||
|
||||
private List<EntityRendererInfo> entityRenderers = Lists.newArrayList();
|
||||
private Map<Class<? extends Entity>, IRenderFactory<? extends Entity>> entityRenderers = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Register an entity rendering handler. This will, after mod initialization, be inserted into the main
|
||||
* render map for entities
|
||||
* render map for entities.
|
||||
* Call this during Preinitialization phase.
|
||||
*
|
||||
* @param entityClass
|
||||
* @param renderer
|
||||
*/
|
||||
public static void registerEntityRenderingHandler(Class<? extends Entity> entityClass, Render<? extends Entity> renderer)
|
||||
public static <T extends Entity> void registerEntityRenderingHandler(Class<T> entityClass, IRenderFactory<? super T> renderFactory)
|
||||
{
|
||||
INSTANCE.entityRenderers.add(new EntityRendererInfo(entityClass, renderer));
|
||||
INSTANCE.entityRenderers.put(entityClass, renderFactory);
|
||||
}
|
||||
|
||||
private static class EntityRendererInfo
|
||||
public static void loadEntityRenderers(RenderManager manager, Map<Class<? extends Entity> , Render<? extends Entity>> renderMap)
|
||||
{
|
||||
public EntityRendererInfo(Class<? extends Entity> target, Render<? extends Entity> renderer)
|
||||
for (Map.Entry<Class<? extends Entity>, IRenderFactory<? extends Entity>> entry : INSTANCE.entityRenderers.entrySet())
|
||||
{
|
||||
this.target = target;
|
||||
this.renderer = renderer;
|
||||
register(manager, renderMap, entry.getKey(), entry.getValue());
|
||||
}
|
||||
private Class<? extends Entity> target;
|
||||
private Render<? extends Entity> renderer;
|
||||
}
|
||||
|
||||
public static void loadEntityRenderers(Map<Class<? extends Entity>, Render<? extends Entity>> entityRenderMap)
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Entity> void register(RenderManager manager, Map<Class<? extends Entity> , Render<? extends Entity>> renderMap, Class<T> entityClass, IRenderFactory<?> renderFactory)
|
||||
{
|
||||
for (EntityRendererInfo info : INSTANCE.entityRenderers)
|
||||
{
|
||||
entityRenderMap.put(info.target, info.renderer);
|
||||
}
|
||||
renderMap.put(entityClass, ((IRenderFactory<T>)renderFactory).createRenderFor(manager));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,8 +159,6 @@ public net.minecraft.entity.EntityList func_75614_a(Ljava/lang/Class;Ljava/lang/
|
|||
public net.minecraft.entity.EntityList field_75625_b #nameToClassMap
|
||||
public net.minecraft.entity.EntityList field_75626_c #classToNameMap
|
||||
public net.minecraft.entity.EntityList field_75623_d #idToClassMap
|
||||
## RenderManager
|
||||
public net.minecraft.client.renderer.entity.RenderManager field_78729_o #renderers
|
||||
## TileEntityRendererDispatcher
|
||||
public net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher field_147559_m
|
||||
## WeightedRandomItem
|
||||
|
|
Loading…
Reference in a new issue