Fixed progress reporting for model loading.
This commit is contained in:
parent
87f4351783
commit
8b4bce37de
2 changed files with 103 additions and 50 deletions
|
@ -1,6 +1,28 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java
|
||||
@@ -109,7 +109,7 @@
|
||||
@@ -102,6 +102,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);
|
||||
|
||||
@@ -109,7 +124,7 @@
|
||||
{
|
||||
Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
|
||||
modelblockdefinition.func_188001_c().func_188138_a(block.func_176194_O());
|
||||
|
@ -9,7 +31,7 @@
|
|||
{
|
||||
public boolean apply(ModelResourceLocation p_apply_1_)
|
||||
{
|
||||
@@ -126,13 +126,13 @@
|
||||
@@ -126,22 +141,18 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -25,7 +47,16 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -370,6 +370,7 @@
|
||||
}
|
||||
}
|
||||
- catch (Exception exception)
|
||||
- {
|
||||
- field_177603_c.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception);
|
||||
- }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -370,6 +381,7 @@
|
||||
|
||||
protected void func_177592_e()
|
||||
{
|
||||
|
@ -33,7 +64,7 @@
|
|||
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"}));
|
||||
@@ -413,6 +414,10 @@
|
||||
@@ -413,6 +425,10 @@
|
||||
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"}));
|
||||
this.field_177613_u.put(Items.field_151124_az, Lists.newArrayList(new String[] {"oak_boat"}));
|
||||
|
@ -44,7 +75,7 @@
|
|||
}
|
||||
|
||||
protected List<String> func_177596_a(Item p_177596_1_)
|
||||
@@ -429,7 +434,7 @@
|
||||
@@ -429,7 +445,7 @@
|
||||
|
||||
protected ResourceLocation func_177583_a(String p_177583_1_)
|
||||
{
|
||||
|
@ -53,7 +84,7 @@
|
|||
return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a());
|
||||
}
|
||||
|
||||
@@ -536,7 +541,7 @@
|
||||
@@ -536,7 +552,7 @@
|
||||
for (Entry<String, ResourceLocation> entry : this.field_177615_s.entrySet())
|
||||
{
|
||||
ResourceLocation resourcelocation = (ResourceLocation)entry.getValue();
|
||||
|
@ -62,7 +93,7 @@
|
|||
ModelBlock modelblock = (ModelBlock)this.field_177611_h.get(resourcelocation);
|
||||
|
||||
if (modelblock != null && modelblock.func_178303_d())
|
||||
@@ -623,6 +628,11 @@
|
||||
@@ -623,6 +639,11 @@
|
||||
|
||||
private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_)
|
||||
{
|
||||
|
@ -74,7 +105,7 @@
|
|||
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_, p_177578_1_.func_187967_g())).func_177646_a(textureatlassprite);
|
||||
|
||||
@@ -639,13 +649,13 @@
|
||||
@@ -639,13 +660,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)));
|
||||
|
||||
|
@ -91,7 +122,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -656,9 +666,14 @@
|
||||
@@ -656,9 +677,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_)
|
||||
{
|
||||
|
@ -107,7 +138,7 @@
|
|||
private void func_177597_h()
|
||||
{
|
||||
this.func_177574_i();
|
||||
@@ -878,4 +893,23 @@
|
||||
@@ -878,4 +904,23 @@
|
||||
field_177606_o.field_178317_b = "generation marker";
|
||||
field_177616_r.field_178317_b = "block entity marker";
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.awt.image.BufferedImage;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -40,6 +41,7 @@ import net.minecraft.client.renderer.block.model.VariantList;
|
|||
import net.minecraft.client.renderer.block.model.WeightedBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.multipart.Multipart;
|
||||
import net.minecraft.client.renderer.block.model.multipart.Selector;
|
||||
import net.minecraft.client.renderer.block.statemap.BlockStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.renderer.texture.IIconCreator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
@ -83,6 +85,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
public final class ModelLoader extends ModelBakery
|
||||
|
@ -135,8 +138,14 @@ public final class ModelLoader extends ModelBakery
|
|||
|
||||
IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance);
|
||||
Map<IModel, IBakedModel> bakedModels = Maps.newHashMap();
|
||||
for(IModel model : stateModels.values())
|
||||
HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
|
||||
Multimaps.invertFrom(Multimaps.forMap(stateModels), models);
|
||||
|
||||
ProgressBar bakeBar = ProgressManager.push("ModelLoader: baking", models.keySet().size());
|
||||
|
||||
for(IModel model : models.keySet())
|
||||
{
|
||||
bakeBar.step("[" + Joiner.on(", ").join(models.get(model)) + "]");
|
||||
if(model == getMissingModel())
|
||||
{
|
||||
bakedModels.put(model, missingBaked);
|
||||
|
@ -146,6 +155,9 @@ public final class ModelLoader extends ModelBakery
|
|||
bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance));
|
||||
}
|
||||
}
|
||||
|
||||
ProgressManager.pop(bakeBar);
|
||||
|
||||
for (Entry<ModelResourceLocation, IModel> e : stateModels.entrySet())
|
||||
{
|
||||
bakedRegistry.putObject(e.getKey(), bakedModels.get(e.getValue()));
|
||||
|
@ -161,27 +173,31 @@ public final class ModelLoader extends ModelBakery
|
|||
@Override
|
||||
protected void loadMultipartVariantModels() {}
|
||||
|
||||
/*private void loadBlocks()
|
||||
@Override
|
||||
protected void loadBlocks()
|
||||
{
|
||||
Map<IBlockState, ModelResourceLocation> stateMap = blockModelShapes.getBlockStateMapper().putAllStateModelLocations();
|
||||
List<ModelResourceLocation> variants = Lists.newArrayList(stateMap.values());
|
||||
variants.add(new ModelResourceLocation("minecraft:item_frame", "normal")); //Vanilla special cases item_frames so must we
|
||||
variants.add(new ModelResourceLocation("minecraft:item_frame", "map"));
|
||||
Collections.sort(variants, new Comparator<ModelResourceLocation>()
|
||||
List<Block> blocks = Lists.newArrayList(Block.blockRegistry);
|
||||
Collections.sort(blocks, new Comparator<Block>()
|
||||
{
|
||||
public int compare(ModelResourceLocation v1, ModelResourceLocation v2)
|
||||
public int compare(Block b1, Block b2)
|
||||
{
|
||||
return v1.toString().compareTo(v2.toString());
|
||||
return b1.getRegistryName().compareTo(b2.getRegistryName());
|
||||
}
|
||||
});
|
||||
ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", variants.size());
|
||||
for(ModelResourceLocation variant : variants)
|
||||
ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", blocks.size());
|
||||
|
||||
BlockStateMapper mapper = this.blockModelShapes.getBlockStateMapper();
|
||||
|
||||
for(Block block : blocks)
|
||||
{
|
||||
loadVariant(variant);
|
||||
blockBar.step(variant.toString());
|
||||
blockBar.step(block.getRegistryName());
|
||||
for(ResourceLocation location : mapper.getBlockstateLocations(block))
|
||||
{
|
||||
loadBlock(mapper, block, location);
|
||||
}
|
||||
}
|
||||
ProgressManager.pop(blockBar);
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location)
|
||||
|
@ -238,18 +254,23 @@ public final class ModelLoader extends ModelBakery
|
|||
|
||||
registerVariantNames();
|
||||
|
||||
List<String> itemVariants = Lists.newArrayList();
|
||||
for(Item item : GameData.getItemRegistry().typeSafeIterable())
|
||||
List<Item> items = Lists.newArrayList(GameData.getItemRegistry().typeSafeIterable());
|
||||
Collections.sort(items, new Comparator<Item>()
|
||||
{
|
||||
itemVariants.addAll(getVariantNames(item));
|
||||
public int compare(Item i1, Item i2)
|
||||
{
|
||||
return i1.getRegistryName().compareTo(i2.getRegistryName());
|
||||
}
|
||||
Collections.sort(itemVariants);
|
||||
ProgressBar itemBar = ProgressManager.push("ModelLoader: items", itemVariants.size());
|
||||
for(String s : itemVariants)
|
||||
});
|
||||
|
||||
ProgressBar itemBar = ProgressManager.push("ModelLoader: items", items.size());
|
||||
for(Item item : items)
|
||||
{
|
||||
itemBar.step(item.getRegistryName());
|
||||
for(String s : getVariantNames(item))
|
||||
{
|
||||
ResourceLocation file = getItemLocation(s);
|
||||
ModelResourceLocation memory = getInventoryVariant(s);
|
||||
itemBar.step(memory.toString());
|
||||
IModel model = ModelLoaderRegistry.getMissingModel();
|
||||
Exception exception = null;
|
||||
try
|
||||
|
@ -275,6 +296,7 @@ public final class ModelLoader extends ModelBakery
|
|||
storeException(memory, exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
ProgressManager.pop(itemBar);
|
||||
|
||||
// replace vanilla bucket models if desired. done afterwards for performance reasons
|
||||
|
|
Loading…
Reference in a new issue