Search in sources :

Example 1 with BlockStateMapper

use of net.minecraft.client.renderer.block.statemap.BlockStateMapper in project MinecraftForge by MinecraftForge.

the class ModelLoader method loadBlocks.

@Override
protected void loadBlocks() {
    List<Block> blocks = Lists.newArrayList(Iterables.filter(Block.REGISTRY, new Predicate<Block>() {

        public boolean apply(Block block) {
            return block.getRegistryName() != null;
        }
    }));
    Collections.sort(blocks, new Comparator<Block>() {

        public int compare(Block b1, Block b2) {
            return b1.getRegistryName().toString().compareTo(b2.getRegistryName().toString());
        }
    });
    ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", blocks.size());
    BlockStateMapper mapper = this.blockModelShapes.getBlockStateMapper();
    for (Block block : blocks) {
        blockBar.step(block.getRegistryName().toString());
        for (ResourceLocation location : mapper.getBlockstateLocations(block)) {
            loadBlock(mapper, block, location);
        }
    }
    ProgressManager.pop(blockBar);
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) ModelBlock(net.minecraft.client.renderer.block.model.ModelBlock) ProgressBar(net.minecraftforge.fml.common.ProgressManager.ProgressBar) BlockStateMapper(net.minecraft.client.renderer.block.statemap.BlockStateMapper) Predicate(com.google.common.base.Predicate)

Aggregations

Predicate (com.google.common.base.Predicate)1 Block (net.minecraft.block.Block)1 ModelBlock (net.minecraft.client.renderer.block.model.ModelBlock)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 BlockStateMapper (net.minecraft.client.renderer.block.statemap.BlockStateMapper)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 ProgressBar (net.minecraftforge.fml.common.ProgressManager.ProgressBar)1