private void loadSprites() { final Set<ResourceLocation> set = this.getVariantsTextureLocations(); set.addAll(this.getItemsTextureLocations()); set.remove(TextureMap.LOCATION_MISSING_TEXTURE); ITextureMapPopulator itexturemappopulator = new ITextureMapPopulator() { public void registerSprites(TextureMap textureMapIn) { for (ResourceLocation resourcelocation : set) { TextureAtlasSprite textureatlassprite = textureMapIn.registerSprite(resourcelocation); ModelBakery.this.sprites.put(resourcelocation, textureatlassprite); } } }; this.textureMap.loadSprites(this.resourceManager, itexturemappopulator); this.sprites.put(new ResourceLocation("missingno"), this.textureMap.getMissingSprite()); }
@Override public IRegistry<ModelResourceLocation, IBakedModel> setupModelRegistry() { isLoading = true; loadBlocks(); loadVariantItemModels(); missingModel = ModelLoaderRegistry.getMissingModel(); stateModels.put(MODEL_MISSING, missingModel); final Set<ResourceLocation> textures = Sets.newHashSet(ModelLoaderRegistry.getTextures()); textures.remove(TextureMap.LOCATION_MISSING_TEXTURE); textures.addAll(LOCATIONS_BUILTIN_TEXTURES); textureMap.loadSprites(resourceManager, new ITextureMapPopulator() { public void registerSprites(TextureMap map) { for(ResourceLocation t : textures) { map.registerSprite(t); } } }); IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE); Map<IModel, IBakedModel> bakedModels = Maps.newHashMap(); HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create(); Multimaps.invertFrom(Multimaps.forMap(stateModels), models); if (firstLoad) { firstLoad = false; for (ModelResourceLocation mrl : stateModels.keySet()) { bakedRegistry.putObject(mrl, missingBaked); } return bakedRegistry; } 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); } else { 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())); } return bakedRegistry; }