From ea77714908943f4b7deed5b1a235e9bf17c80d7a Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Tue, 8 Mar 2022 15:59:52 +0200 Subject: Fixed context world not being a ClientWorld crash Fixes #108 --- .../shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'defaults/src/main/java/shcm/shsupercm') diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java index aa4df72..bd490d3 100644 --- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java +++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java @@ -438,12 +438,13 @@ public class TypeItem extends CITType { } public BakedModel getItemModel(CITContext context, int seed) { + ClientWorld world = context.world instanceof ClientWorld clientWorld ? clientWorld : null; // get sub items or bakedModel if no sub item matches @Nullable - BakedModel bakedModel = bakedSubModels.apply(this.bakedModel, context.stack, (ClientWorld) context.world, context.entity, seed); + BakedModel bakedModel = bakedSubModels.apply(this.bakedModel, context.stack, world, context.entity, seed); // apply model overrides if (bakedModel != null && bakedModel.getOverrides() != null) - bakedModel = bakedModel.getOverrides().apply(bakedModel, context.stack, (ClientWorld) context.world, context.entity, seed); + bakedModel = bakedModel.getOverrides().apply(bakedModel, context.stack, world, context.entity, seed); return bakedModel; } -- cgit