mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 21:20:12 +00:00
130 lines
7.6 KiB
Diff
130 lines
7.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java
|
|
@@ -114,7 +114,7 @@
|
|
}
|
|
catch (Exception var6)
|
|
{
|
|
- field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation);
|
|
+ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var6);
|
|
}
|
|
}
|
|
catch (Exception exception)
|
|
@@ -294,6 +294,7 @@
|
|
|
|
protected 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"}));
|
|
@@ -336,6 +337,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()));
|
|
+ }
|
|
}
|
|
|
|
protected List<String> func_177596_a(Item p_177596_1_)
|
|
@@ -352,7 +357,7 @@
|
|
|
|
protected ResourceLocation func_177583_a(String p_177583_1_)
|
|
{
|
|
- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_);
|
|
+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", ""));
|
|
return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a());
|
|
}
|
|
|
|
@@ -395,7 +400,7 @@
|
|
for (Entry<String, ResourceLocation> entry : this.field_177615_s.entrySet())
|
|
{
|
|
ResourceLocation resourcelocation = (ResourceLocation)entry.getValue();
|
|
- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory");
|
|
+ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey());
|
|
ModelBlock modelblock1 = (ModelBlock)this.field_177611_h.get(resourcelocation);
|
|
|
|
if (modelblock1 != null && modelblock1.func_178303_d())
|
|
@@ -453,6 +458,11 @@
|
|
|
|
private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_)
|
|
{
|
|
+ return bakeModel(p_177578_1_, (net.minecraftforge.client.model.ITransformation)p_177578_2_, p_177578_3_);
|
|
+ }
|
|
+
|
|
+ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.client.model.ITransformation p_177578_2_, boolean p_177578_3_)
|
|
+ {
|
|
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle")));
|
|
SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_)).func_177646_a(textureatlassprite);
|
|
|
|
@@ -463,13 +473,13 @@
|
|
BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing);
|
|
TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d)));
|
|
|
|
- if (blockpartface.field_178244_b == null)
|
|
+ if (blockpartface.field_178244_b == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix()))
|
|
{
|
|
- simplebakedmodel$builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
|
|
+ simplebakedmodel$builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
|
|
}
|
|
else
|
|
{
|
|
- simplebakedmodel$builder.func_177650_a(p_177578_2_.func_177523_a(blockpartface.field_178244_b), this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
|
|
+ simplebakedmodel$builder.func_177650_a(p_177578_2_.rotate(blockpartface.field_178244_b), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
|
|
}
|
|
}
|
|
}
|
|
@@ -479,9 +489,14 @@
|
|
|
|
private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_)
|
|
{
|
|
- return this.field_177607_l.func_178414_a(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e);
|
|
+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_);
|
|
}
|
|
|
|
+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_)
|
|
+ {
|
|
+ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e);
|
|
+ }
|
|
+
|
|
private void func_177597_h()
|
|
{
|
|
this.func_177574_i();
|
|
@@ -722,4 +737,35 @@
|
|
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();
|
|
+ /**
|
|
+ * @deprecated use registerItemVariants
|
|
+ */
|
|
+ @Deprecated
|
|
+ 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));
|
|
+ }
|
|
+
|
|
+ public static <T extends ResourceLocation> void registerItemVariants(Item item, T... names)
|
|
+ {
|
|
+ if (!customVariantNames.containsKey(item.delegate))
|
|
+ {
|
|
+ customVariantNames.put(item.delegate, Sets.<String>newHashSet());
|
|
+ }
|
|
+ for(ResourceLocation name : names)
|
|
+ {
|
|
+ customVariantNames.get(item.delegate).add(name.toString());
|
|
+ }
|
|
+ }
|
|
+ /***********************************************************
|
|
+ * FML End
|
|
+ ***********************************************************/
|
|
}
|