172 lines
9.3 KiB
Diff
172 lines
9.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java
|
|
@@ -103,6 +103,21 @@
|
|
{
|
|
try
|
|
{
|
|
+ loadBlock(blockstatemapper, block, resourcelocation);
|
|
+ }
|
|
+ catch (Exception exception)
|
|
+ {
|
|
+ field_177603_c.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation)
|
|
+ {
|
|
+ {
|
|
+ {
|
|
+ {
|
|
ModelBlockDefinition modelblockdefinition = this.func_177586_a(resourcelocation);
|
|
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.func_188181_b(block);
|
|
|
|
@@ -115,7 +130,6 @@
|
|
if (collection1 == null)
|
|
{
|
|
collection1 = Lists.<ModelResourceLocation>newArrayList();
|
|
- this.field_188642_k.put(modelblockdefinition, collection1);
|
|
}
|
|
|
|
collection1.addAll(Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
|
|
@@ -125,6 +139,7 @@
|
|
return resourcelocation.equals(p_apply_1_);
|
|
}
|
|
})));
|
|
+ registerMultipartVariant(modelblockdefinition, collection1);
|
|
}
|
|
|
|
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
|
|
@@ -135,22 +150,18 @@
|
|
{
|
|
try
|
|
{
|
|
- this.field_177612_i.put(modelresourcelocation, modelblockdefinition.func_188004_c(modelresourcelocation.func_177518_c()));
|
|
+ func_177569_a(modelblockdefinition, modelresourcelocation);
|
|
}
|
|
catch (RuntimeException var12)
|
|
{
|
|
if (!modelblockdefinition.func_188002_b())
|
|
{
|
|
- field_177603_c.warn("Unable to load variant: {} from {}", modelresourcelocation.func_177518_c(), modelresourcelocation);
|
|
+ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var12);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch (Exception exception)
|
|
- {
|
|
- field_177603_c.warn("Unable to load definition {}", resourcelocation, exception);
|
|
- }
|
|
}
|
|
}
|
|
}
|
|
@@ -394,6 +405,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("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("dirt", "coarse_dirt", "podzol"));
|
|
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList("oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"));
|
|
@@ -441,6 +453,10 @@
|
|
this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList("oak_door"));
|
|
this.field_177613_u.put(Items.field_151124_az, Lists.newArrayList("oak_boat"));
|
|
this.field_177613_u.put(Items.field_190929_cY, Lists.newArrayList("totem"));
|
|
+ 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_)
|
|
@@ -457,7 +473,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());
|
|
}
|
|
|
|
@@ -565,7 +581,7 @@
|
|
for (Entry<String, ResourceLocation> entry : this.field_177615_s.entrySet())
|
|
{
|
|
ResourceLocation resourcelocation = entry.getValue();
|
|
- ModelResourceLocation modelresourcelocation = new ModelResourceLocation(entry.getKey(), "inventory");
|
|
+ ModelResourceLocation modelresourcelocation = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey());
|
|
ModelBlock modelblock = this.field_177611_h.get(resourcelocation);
|
|
|
|
if (modelblock != null && modelblock.func_178303_d())
|
|
@@ -653,6 +669,11 @@
|
|
@Nullable
|
|
private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_)
|
|
{
|
|
+ return bakeModel(p_177578_1_, (net.minecraftforge.common.model.ITransformation)p_177578_2_, p_177578_3_);
|
|
+ }
|
|
+
|
|
+ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.common.model.ITransformation p_177578_2_, boolean p_177578_3_)
|
|
+ {
|
|
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_, p_177578_1_.func_187967_g())).func_177646_a(textureatlassprite);
|
|
|
|
@@ -669,13 +690,13 @@
|
|
BlockPartFace blockpartface = blockpart.field_178240_c.get(enumfacing);
|
|
TextureAtlasSprite textureatlassprite1 = 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.common.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_));
|
|
}
|
|
}
|
|
}
|
|
@@ -686,9 +707,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.common.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.common.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();
|
|
@@ -916,4 +942,23 @@
|
|
field_177606_o.field_178317_b = "generation marker";
|
|
field_177616_r.field_178317_b = "block entity marker";
|
|
}
|
|
+
|
|
+ protected void registerMultipartVariant(ModelBlockDefinition definition, Collection<ModelResourceLocation> locations)
|
|
+ {
|
|
+ this.field_188642_k.put(definition, locations);
|
|
+ }
|
|
+
|
|
+ private static Map<net.minecraftforge.fml.common.registry.RegistryDelegate<Item>, Set<String>> customVariantNames = Maps.newHashMap();
|
|
+
|
|
+ public static void registerItemVariants(Item item, ResourceLocation... names)
|
|
+ {
|
|
+ if (!customVariantNames.containsKey(item.delegate))
|
|
+ {
|
|
+ customVariantNames.put(item.delegate, Sets.<String>newHashSet());
|
|
+ }
|
|
+ for(ResourceLocation name : names)
|
|
+ {
|
|
+ customVariantNames.get(item.delegate).add(name.toString());
|
|
+ }
|
|
+ }
|
|
}
|