Files
MinecraftForge/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch
T
4a2db246e0 1.21 Update
Co-authored-by: RealMangoRage <[email protected]>
Co-authored-by: Daniel Norris <[email protected]>
Co-authored-by: Ven <[email protected]>
2024-06-13 10:42:32 -07:00

64 lines
2.9 KiB
Diff

--- a/net/minecraft/client/resources/model/ModelManager.java
+++ b/net/minecraft/client/resources/model/ModelManager.java
@@ -63,13 +_,14 @@
TextureAtlas.LOCATION_BLOCKS,
ResourceLocation.withDefaultNamespace("blocks")
);
- private Map<ModelResourceLocation, BakedModel> bakedRegistry;
+ private Map<ModelResourceLocation, BakedModel> bakedRegistry = new java.util.HashMap<>();
private final AtlasSet atlases;
private final BlockModelShaper blockModelShaper;
private final BlockColors blockColors;
private int maxMipmapLevels;
private BakedModel missingModel;
private Object2IntMap<BlockState> modelGroups;
+ private ModelBakery modelBakery;
public ModelManager(TextureManager p_119406_, BlockColors p_119407_, int p_119408_) {
this.blockColors = p_119407_;
@@ -100,6 +_,7 @@
Executor p_249221_
) {
p_250336_.startTick();
+ net.minecraftforge.client.model.geometry.GeometryLoaderManager.init();
CompletableFuture<Map<ResourceLocation, BlockModel>> completablefuture = loadBlockModels(p_251134_, p_250550_);
CompletableFuture<Map<ResourceLocation, List<BlockStateModelLoader.LoadedJson>>> completablefuture1 = loadBlockStates(p_251134_, p_250550_);
CompletableFuture<ModelBakery> completablefuture2 = completablefuture.thenCombineAsync(
@@ -214,6 +_,8 @@
.collect(Collectors.joining("\n"))
)
);
+ p_252136_.popPush("forge_modify_baking_result");
+ net.minecraftforge.client.ForgeHooksClient.onModifyBakingResult(p_248945_.getBakedTopLevelModels(), p_248945_);
p_252136_.popPush("dispatch");
Map<ModelResourceLocation, BakedModel> map = p_248945_.getBakedTopLevelModels();
BakedModel bakedmodel = map.get(ModelBakery.MISSING_MODEL_VARIANT);
@@ -243,6 +_,8 @@
this.bakedRegistry = modelbakery.getBakedTopLevelModels();
this.modelGroups = modelbakery.getModelGroups();
this.missingModel = p_248996_.missingModel;
+ this.modelBakery = modelbakery;
+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.bakedRegistry, modelbakery);
p_251960_.popPush("cache");
this.blockModelShaper.replaceCache(p_248996_.modelCache);
p_251960_.pop();
@@ -268,6 +_,7 @@
}
public TextureAtlas getAtlas(ResourceLocation p_119429_) {
+ if (this.atlases == null) throw new RuntimeException("getAtlasTexture called too early!");
return this.atlases.getAtlas(p_119429_);
}
@@ -278,6 +_,10 @@
public void updateMaxMipLevel(int p_119411_) {
this.maxMipmapLevels = p_119411_;
+ }
+
+ public ModelBakery getModelBakery() {
+ return com.google.common.base.Preconditions.checkNotNull(modelBakery, "Attempted to query model bakery before it has been initialized.");
}
@OnlyIn(Dist.CLIENT)