use of net.minecraft.client.render.model.UnbakedModel in project fabric by FabricMC.
the class MixinModelLoader method loadModelHook.
@Inject(at = @At("HEAD"), method = "loadModel", cancellable = true)
private void loadModelHook(Identifier id, CallbackInfo ci) {
UnbakedModel customModel = fabric_mlrLoaderInstance.loadModelFromVariant(id);
if (customModel != null) {
putModel(id, customModel);
ci.cancel();
}
}
use of net.minecraft.client.render.model.UnbakedModel in project AurorasDecorations by LambdAurora.
the class RestModelManager method loadModelEntry.
private RestModelEntry loadModelEntry(WoodType woodType, ResourceManager resourceManager, ModelVariantMap.DeserializationContext deserializationContext) {
var pathName = woodType.getPathName();
// Bench rest
UnbakedModel benchRest = null;
var benchBlock = Registry.BLOCK.get(AurorasDeco.id("bench/" + pathName));
var benchRestId = AurorasDeco.id("blockstates/bench/" + pathName + "_rest.json");
if (benchBlock != Blocks.AIR) {
try {
var resource = resourceManager.getResource(benchRestId);
var stateFactory = deserializationContext.getStateFactory();
deserializationContext.setStateFactory(benchBlock.getStateManager());
var map = ModelVariantMap.fromJson(deserializationContext, new InputStreamReader(resource.getInputStream()));
benchRest = map.getMultipartModel();
deserializationContext.setStateFactory(stateFactory);
resource.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return new RestModelEntry(AurorasDeco.id("bench/" + pathName + "_rest"), benchRest);
}
Aggregations