--- a/net/minecraft/client/renderer/model/ModelManager.java +++ b/net/minecraft/client/renderer/model/ModelManager.java @@ -18,7 +18,7 @@ @OnlyIn(Dist.CLIENT) public class ModelManager extends ReloadListener implements AutoCloseable { - private Map field_174958_a; + private Map field_174958_a = new java.util.HashMap<>(); private SpriteMap field_229352_b_; private final BlockModelShapes field_174957_c; private final TextureManager field_229353_d_; @@ -34,6 +34,10 @@ this.field_174957_c = new BlockModelShapes(this); } + public IBakedModel getModel(ResourceLocation modelLocation) { + return this.field_174958_a.getOrDefault(modelLocation, this.field_174955_d); + } + public IBakedModel func_174953_a(ModelResourceLocation p_174953_1_) { return this.field_174958_a.getOrDefault(p_174953_1_, this.field_174955_d); } @@ -48,7 +52,7 @@ protected ModelBakery func_212854_a_(IResourceManager p_212854_1_, IProfiler p_212854_2_) { p_212854_2_.func_219894_a(); - ModelBakery modelbakery = new ModelBakery(p_212854_1_, this.field_224743_d, p_212854_2_, this.field_229354_f_); + net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_212854_1_, this.field_224743_d, p_212854_2_, this.field_229354_f_); p_212854_2_.func_219897_b(); return modelbakery; } @@ -64,6 +68,7 @@ this.field_174958_a = p_212853_1_.func_217846_a(); this.field_224744_f = p_212853_1_.func_225354_b(); this.field_174955_d = this.field_174958_a.get(ModelBakery.field_177604_a); + net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, (net.minecraftforge.client.model.ModelLoader) p_212853_1_); p_212853_3_.func_219895_b("cache"); this.field_174957_c.func_178124_c(); p_212853_3_.func_76319_b(); @@ -89,6 +94,7 @@ } public AtlasTexture func_229356_a_(ResourceLocation p_229356_1_) { + if (this.field_229352_b_ == null) throw new RuntimeException("func_229356_a_ called too early!"); return this.field_229352_b_.func_229152_a_(p_229356_1_); } @@ -99,4 +105,10 @@ public void func_229355_a_(int p_229355_1_) { this.field_229354_f_ = p_229355_1_; } + + // TODO + //@Override + public net.minecraftforge.resource.IResourceType getResourceType() { + return net.minecraftforge.resource.VanillaResourceType.MODELS; + } }