[Fix] CustomModelBakery could cause a crash when Resourcepacks are reloaded by another Mod before BCLib was initialized (#114)
This commit is contained in:
parent
7bb7a1cb62
commit
15279dd5cd
2 changed files with 11 additions and 4 deletions
|
@ -22,16 +22,24 @@ import net.fabricmc.fabric.api.client.model.*;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class BCLibClient implements ClientModInitializer, ModelResourceProvider, ModelVariantProvider {
|
public class BCLibClient implements ClientModInitializer, ModelResourceProvider, ModelVariantProvider {
|
||||||
public static CustomModelBakery modelBakery;
|
private static CustomModelBakery modelBakery;
|
||||||
|
|
||||||
|
public static CustomModelBakery lazyModelbakery() {
|
||||||
|
if (modelBakery == null) {
|
||||||
|
modelBakery = new CustomModelBakery();
|
||||||
|
}
|
||||||
|
return modelBakery;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
modelBakery = new CustomModelBakery();
|
||||||
|
|
||||||
WorldsTogetherClient.onInitializeClient();
|
WorldsTogetherClient.onInitializeClient();
|
||||||
ModIntegrationAPI.registerAll();
|
ModIntegrationAPI.registerAll();
|
||||||
BaseBlockEntityRenders.register();
|
BaseBlockEntityRenders.register();
|
||||||
DataExchangeAPI.prepareClientside();
|
DataExchangeAPI.prepareClientside();
|
||||||
PostInitAPI.postInit(true);
|
PostInitAPI.postInit(true);
|
||||||
modelBakery = new CustomModelBakery();
|
|
||||||
ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> this);
|
ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> this);
|
||||||
ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> this);
|
ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> this);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ public class ModelManagerMixin {
|
||||||
Executor executor2,
|
Executor executor2,
|
||||||
CallbackInfoReturnable<CompletableFuture<Void>> cir
|
CallbackInfoReturnable<CompletableFuture<Void>> cir
|
||||||
) {
|
) {
|
||||||
//TODO: 1.20 check
|
BCLibClient.lazyModelbakery().loadCustomModels(resourceManager);
|
||||||
BCLibClient.modelBakery.loadCustomModels(resourceManager);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue