Add the ability to register custom variant names in ModelBakery.

This commit is contained in:
Lex Manos 2014-10-13 20:48:09 -07:00
parent 70b57c337a
commit 878f995711
2 changed files with 42 additions and 6 deletions

View file

@ -0,0 +1,41 @@
--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java
+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java
@@ -318,6 +318,7 @@
private void func_177592_e()
{
+ this.field_177613_u.clear(); //FML clear this to prevent double ups.
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"}));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"}));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"}));
@@ -360,6 +361,10 @@
this.field_177613_u.put(Item.func_150898_a(Blocks.field_180390_bo), Lists.newArrayList(new String[] {"oak_fence_gate"}));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_180407_aO), Lists.newArrayList(new String[] {"oak_fence"}));
this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList(new String[] {"oak_door"}));
+ for (Entry<net.minecraftforge.fml.common.registry.RegistryDelegate<Item>, Set<String>> e : customVariantNames.entrySet())
+ {
+ this.field_177613_u.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator()));
+ }
}
private List func_177596_a(Item p_177596_1_)
@@ -809,4 +814,19 @@
field_177617_q.field_178317_b = "class generation marker";
field_177616_r.field_178317_b = "block entity marker";
}
+
+ /***********************************************************
+ * FML Start
+ ***********************************************************/
+ private static Map<net.minecraftforge.fml.common.registry.RegistryDelegate<Item>, Set<String>> customVariantNames = Maps.newHashMap();
+ public static void addVariantName(Item item, String... names)
+ {
+ if (customVariantNames.containsKey(item.delegate))
+ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names));
+ else
+ customVariantNames.put(item.delegate, Sets.newHashSet(names));
+ }
+ /***********************************************************
+ * FML End
+ ***********************************************************/
}

View file

@ -46,12 +46,7 @@ public class RenderingRegistry
*/ */
public static void registerEntityRenderingHandler(Class<? extends Entity> entityClass, Render renderer) public static void registerEntityRenderingHandler(Class<? extends Entity> entityClass, Render renderer)
{ {
instance().entityRenderers.add(new EntityRendererInfo(entityClass, renderer)); INSTANCE.entityRenderers.add(new EntityRendererInfo(entityClass, renderer));
}
@Deprecated public static RenderingRegistry instance()
{
return INSTANCE;
} }
private static class EntityRendererInfo private static class EntityRendererInfo