diff --git a/gradle.properties b/gradle.properties index f96c586..4f579ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ satin_version=1.8.0 sodium_version=mc1.19-0.4.2 iris_version=1.19.x-v1.2.5 -mod_version = 6.2.1 +mod_version = 6.3.0 maven_group = net.ludocrypt archives_base_name = limlib \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/limlib/access/BakedModelAccess.java b/src/main/java/net/ludocrypt/limlib/access/BakedModelAccess.java index 05c4dcc..5b190b7 100644 --- a/src/main/java/net/ludocrypt/limlib/access/BakedModelAccess.java +++ b/src/main/java/net/ludocrypt/limlib/access/BakedModelAccess.java @@ -1,12 +1,19 @@ package net.ludocrypt.limlib.access; -import java.util.Map; +import java.util.List; +import org.jetbrains.annotations.Nullable; + +import com.mojang.datafixers.util.Pair; + +import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; import net.minecraft.util.Identifier; public interface BakedModelAccess { - public Map getSubModels(); + public List> getModels(@Nullable BlockState state); + + public void addModel(Identifier rendererId, @Nullable BlockState state, BakedModel model); } diff --git a/src/main/java/net/ludocrypt/limlib/access/UnbakedModelAccess.java b/src/main/java/net/ludocrypt/limlib/access/UnbakedModelAccess.java index 9b13c6d..5012f20 100644 --- a/src/main/java/net/ludocrypt/limlib/access/UnbakedModelAccess.java +++ b/src/main/java/net/ludocrypt/limlib/access/UnbakedModelAccess.java @@ -2,11 +2,10 @@ import java.util.Map; -import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.Identifier; public interface UnbakedModelAccess { - public Map getSubModels(); + public Map getSubModels(); } diff --git a/src/main/java/net/ludocrypt/limlib/api/render/LiminalQuadRenderer.java b/src/main/java/net/ludocrypt/limlib/api/render/LiminalQuadRenderer.java index 50e4cf8..7912146 100644 --- a/src/main/java/net/ludocrypt/limlib/api/render/LiminalQuadRenderer.java +++ b/src/main/java/net/ludocrypt/limlib/api/render/LiminalQuadRenderer.java @@ -51,7 +51,7 @@ public void renderModel(BakedModel model, World world, BlockPos pos, BlockState Random random = Random.create(state.getRenderingSeed(pos)); for (Direction dir : Direction.values()) { - model.getQuads(state, dir, random).stream().filter((quad) -> Block.shouldDrawSide(state, world, pos, dir, pos)).forEach((quad) -> this.renderQuad(quad, bufferBuilder, matrix, camera, world, matrices, model, state, dir, random)); + model.getQuads(state, dir, random).stream().filter((quad) -> Block.shouldDrawSide(state, world, pos, dir, pos.offset(dir))).forEach((quad) -> this.renderQuad(quad, bufferBuilder, matrix, camera, world, matrices, model, state, dir, random)); } model.getQuads(state, null, random).forEach((quad) -> this.renderQuad(quad, bufferBuilder, matrix, camera, world, matrices, model, state, null, random)); diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java index d284c92..f0fbe57 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/WorldRendererMixin.java @@ -177,7 +177,7 @@ public void renderBlocks(Framebuffer framebuffer, float tickDelta, MatrixStack m matrices.push(); matrices.translate(pos.getX() - camera.getPos().getX(), pos.getY() - camera.getPos().getY(), pos.getZ() - camera.getPos().getZ()); - ((BakedModelAccess) MinecraftClient.getInstance().getBlockRenderManager().getModel(state)).getSubModels().forEach((id, quads) -> LimlibRendering.LIMINAL_QUAD_RENDERER.get(id).renderModel(quads, world, pos, state, matrices, camera)); + ((BakedModelAccess) MinecraftClient.getInstance().getBlockRenderManager().getModel(state)).getModels(state).forEach((renderPair) -> LimlibRendering.LIMINAL_QUAD_RENDERER.get(renderPair.getFirst()).renderModel(renderPair.getSecond(), world, pos, state, matrices, camera)); matrices.pop(); }); diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/ChunkBuilderBuiltChunkRebuildTaskMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/ChunkBuilderBuiltChunkRebuildTaskMixin.java index 39a204a..f94c1f7 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/ChunkBuilderBuiltChunkRebuildTaskMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/ChunkBuilderBuiltChunkRebuildTaskMixin.java @@ -40,7 +40,7 @@ public class ChunkBuilderBuiltChunkRebuildTaskMixin { @Inject(method = "Lnet/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask;render(FFFLnet/minecraft/client/render/chunk/BlockBufferBuilderStorage;)Lnet/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask$RenderData;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/chunk/ChunkRendererRegion;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;", ordinal = 0, shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) private void limlib$render(float cameraX, float cameraY, float cameraZ, BlockBufferBuilderStorage blockBufferBuilderStorage, CallbackInfoReturnable ci, RenderData renderData, int i, BlockPos blockPos, BlockPos blockPos2, ChunkOcclusionDataBuilder chunkOcclusionDataBuilder, ChunkRendererRegion chunkRendererRegion, MatrixStack matrixStack, Set set, Random random, BlockRenderManager blockRenderManager, Iterator var15, BlockPos blockPos3) { BlockState blockState = chunkRendererRegion.getBlockState(blockPos3); - if (!((BakedModelAccess) blockRenderManager.getModel(blockState)).getSubModels().isEmpty()) { + if (!((BakedModelAccess) blockRenderManager.getModel(blockState)).getModels(blockState).isEmpty()) { ((RenderDataAccess) (Object) renderData).getCustomQuadData().put(blockPos3.toImmutable(), blockState); } } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/sodium/ChunkRenderRebuildTaskMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/sodium/ChunkRenderRebuildTaskMixin.java index ee053a0..51a3cb4 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/sodium/ChunkRenderRebuildTaskMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/chunk/sodium/ChunkRenderRebuildTaskMixin.java @@ -32,7 +32,7 @@ public class ChunkRenderRebuildTaskMixin { @Inject(method = "Lme/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask;performBuild(Lme/jellysquid/mods/sodium/client/gl/compile/ChunkBuildContext;Lme/jellysquid/mods/sodium/client/util/task/CancellationSource;)Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/BlockPos$Mutable;set(III)Lnet/minecraft/util/math/BlockPos$Mutable;", ordinal = 1, shift = Shift.AFTER, remap = false), locals = LocalCapture.CAPTURE_FAILHARD, remap = false, require = 0) private void limlib$performBuild$mapped(ChunkBuildContext buildContext, CancellationSource cancellationSource, CallbackInfoReturnable ci, ChunkRenderData.Builder renderData, ChunkOcclusionDataBuilder occluder, ChunkRenderBounds.Builder bounds, ChunkBuildBuffers buffers, ChunkRenderCacheLocal cache, WorldSlice slice, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Mutable blockPos, Mutable offset) { BlockState blockState = slice.getBlockState(blockPos); - if (!((BakedModelAccess) cache.getBlockModels().getModel(blockState)).getSubModels().isEmpty()) { + if (!((BakedModelAccess) cache.getBlockModels().getModel(blockState)).getModels(blockState).isEmpty()) { ((RenderDataAccess) (Object) renderData).getCustomQuadData().put(blockPos.toImmutable(), blockState); } } @@ -41,7 +41,7 @@ public class ChunkRenderRebuildTaskMixin { @Inject(method = "Lme/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask;performBuild(Lme/jellysquid/mods/sodium/client/gl/compile/ChunkBuildContext;Lme/jellysquid/mods/sodium/client/util/task/CancellationSource;)Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildResult;", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_2338$class_2339;method_10103(III)Lnet/minecraft/class_2338$class_2339;", ordinal = 1, shift = Shift.AFTER, remap = false), locals = LocalCapture.CAPTURE_FAILHARD, remap = false, require = 0) private void limlib$performBuild$unmapped(ChunkBuildContext buildContext, CancellationSource cancellationSource, CallbackInfoReturnable ci, ChunkRenderData.Builder renderData, ChunkOcclusionDataBuilder occluder, ChunkRenderBounds.Builder bounds, ChunkBuildBuffers buffers, ChunkRenderCacheLocal cache, WorldSlice slice, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Mutable blockPos, Mutable offset) { BlockState blockState = slice.getBlockState(blockPos); - if (!((BakedModelAccess) cache.getBlockModels().getModel(blockState)).getSubModels().isEmpty()) { + if (!((BakedModelAccess) cache.getBlockModels().getModel(blockState)).getModels(blockState).isEmpty()) { ((RenderDataAccess) (Object) renderData).getCustomQuadData().put(blockPos.toImmutable(), blockState); } } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java index 4b79987..cc7c420 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/gui/ItemRendererMixin.java @@ -40,7 +40,9 @@ public class ItemRendererMixin implements ItemRendererAccess { MatrixStack matrixStack = new MatrixStack(); matrixStack.multiplyPositionMatrix(matrices.peek().getPositionMatrix().copy()); List immediateRenderer = Lists.newArrayList(); - ((BakedModelAccess) model).getSubModels().forEach((id, subModel) -> (isHandRendering ? LimlibRendering.LIMINAL_QUAD_RENDERER.get(id).heldItemRenderQueue : isItemRendering ? LimlibRendering.LIMINAL_QUAD_RENDERER.get(id).itemRenderQueue : immediateRenderer).add(() -> LimlibRendering.LIMINAL_QUAD_RENDERER.get(id).renderItemModel(subModel, client.world, stack.copy(), matrixStack, client.gameRenderer.getCamera(), inGui))); + + ((BakedModelAccess) model).getModels(null).forEach((renderPair) -> (isHandRendering ? LimlibRendering.LIMINAL_QUAD_RENDERER.get(renderPair.getFirst()).heldItemRenderQueue : isItemRendering ? LimlibRendering.LIMINAL_QUAD_RENDERER.get(renderPair.getFirst()).itemRenderQueue : immediateRenderer).add(() -> LimlibRendering.LIMINAL_QUAD_RENDERER.get(renderPair.getFirst()).renderItemModel(renderPair.getSecond(), client.world, stack.copy(), matrixStack, client.gameRenderer.getCamera(), inGui))); + immediateRenderer.forEach(Runnable::run); immediateRenderer.clear(); } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/BakedModelMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/BakedModelMixin.java index 993ec9e..e41718f 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/BakedModelMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/BakedModelMixin.java @@ -1,12 +1,15 @@ package net.ludocrypt.limlib.mixin.client.render.model; -import java.util.Map; +import java.util.List; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import com.google.common.collect.Maps; +import com.google.common.collect.Lists; +import com.mojang.datafixers.util.Pair; import net.ludocrypt.limlib.access.BakedModelAccess; +import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; import net.minecraft.util.Identifier; @@ -14,8 +17,12 @@ public interface BakedModelMixin extends BakedModelAccess { @Override - default Map getSubModels() { - return Maps.newHashMap(); + default List> getModels(@Nullable BlockState state) { + return Lists.newArrayList(); + } + + @Override + default void addModel(Identifier rendererId, @Nullable BlockState state, BakedModel model) { } } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/GeneralBakedModelMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/GeneralBakedModelMixin.java index 14f958e..d661dc4 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/GeneralBakedModelMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/GeneralBakedModelMixin.java @@ -1,25 +1,44 @@ package net.ludocrypt.limlib.mixin.client.render.model; +import java.util.List; import java.util.Map; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.mojang.datafixers.util.Pair; import net.ludocrypt.limlib.access.BakedModelAccess; +import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; import net.minecraft.util.Identifier; -@Mixin(targets = { "net/minecraft/client/render/model/BasicBakedModel", "net/minecraft/client/render/model/BuiltinBakedModel", "net/minecraft/client/render/model/MultipartBakedModel", "net/minecraft/client/render/model/WeightedBakedModel", "net/fabricmc/fabric/api/renderer/v1/model/ForwardingBakedModel" }) +@Mixin(targets = { "net/minecraft/client/render/model/BasicBakedModel", "net/minecraft/client/render/model/BuiltinBakedModel", "net/minecraft/client/render/model/WeightedBakedModel", "net/fabricmc/fabric/api/renderer/v1/model/ForwardingBakedModel" }) public class GeneralBakedModelMixin implements BakedModelAccess { - @Unique - private Map subQuads = Maps.newHashMap(); + private final Map>> modelsMap = Maps.newHashMap(); + private List> defaultModels = Lists.newArrayList(); @Override - public Map getSubModels() { - return subQuads; + public List> getModels(@Nullable BlockState state) { + return modelsMap.getOrDefault(state, defaultModels); + } + + @Override + public void addModel(Identifier rendererId, @Nullable BlockState state, BakedModel model) { + if (state == null) { + defaultModels.add(Pair.of(rendererId, model)); + } else { + List> list = modelsMap.get(state); + if (list == null) { + list = Lists.newArrayList(); + modelsMap.put(state, list); + } + + list.add(Pair.of(rendererId, model)); + } } } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelDeserializerMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelDeserializerMixin.java index 6bb3c69..0d800dd 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelDeserializerMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelDeserializerMixin.java @@ -16,7 +16,6 @@ import net.ludocrypt.limlib.access.UnbakedModelAccess; import net.ludocrypt.limlib.impl.LimlibRendering; import net.minecraft.client.render.model.json.JsonUnbakedModel; -import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.Identifier; @Mixin(JsonUnbakedModel.Deserializer.class) @@ -24,13 +23,13 @@ public abstract class JsonUnbakedModelDeserializerMixin { @Inject(method = "Lnet/minecraft/client/render/model/json/JsonUnbakedModel$Deserializer;deserialize(Lcom/google/gson/JsonElement;Ljava/lang/reflect/Type;Lcom/google/gson/JsonDeserializationContext;)Lnet/minecraft/client/render/model/json/JsonUnbakedModel;", at = @At("RETURN"), cancellable = true) private void limlib$deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext, CallbackInfoReturnable ci) { - Map map = Maps.newHashMap(); + Map map = Maps.newHashMap(); JsonObject jsonObject = jsonElement.getAsJsonObject(); if (jsonObject.has("limlib_extra")) { LimlibRendering.LIMINAL_QUAD_RENDERER.getEntrySet().forEach((entry) -> { JsonObject limlibExtra = jsonObject.get("limlib_extra").getAsJsonObject(); if (limlibExtra.has(entry.getKey().getValue().toString())) { - map.put(entry.getKey().getValue(), new ModelIdentifier(limlibExtra.get(entry.getKey().getValue().toString()).getAsString())); + map.put(entry.getKey().getValue(), new Identifier(limlibExtra.get(entry.getKey().getValue().toString()).getAsString())); } }); } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java index 097a861..bf4daf8 100644 --- a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/JsonUnbakedModelMixin.java @@ -1,7 +1,6 @@ package net.ludocrypt.limlib.mixin.client.render.model; import java.util.Collection; -import java.util.HashSet; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -19,7 +18,6 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import com.mojang.datafixers.util.Pair; import net.ludocrypt.limlib.access.BakedModelAccess; @@ -30,7 +28,6 @@ import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.render.model.json.JsonUnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.util.ModelIdentifier; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; @@ -42,21 +39,7 @@ public abstract class JsonUnbakedModelMixin implements UnbakedModelAccess { private static Logger LOGGER; @Unique - private Map subModels = Maps.newHashMap(); - - @Shadow - public String id; - - @Shadow - protected JsonUnbakedModel parent; - - @Inject(method = "Lnet/minecraft/client/render/model/json/JsonUnbakedModel;getModelDependencies()Ljava/util/Collection;", at = @At("RETURN"), cancellable = true) - private void limlib$getModelDependencies(CallbackInfoReturnable> ci) { - HashSet set = Sets.newHashSet(); - set.addAll(ci.getReturnValue()); - set.addAll(subModels.values()); - ci.setReturnValue(set); - } + private Map subModels = Maps.newHashMap(); @Inject(method = "Lnet/minecraft/client/render/model/json/JsonUnbakedModel;getTextureDependencies(Ljava/util/function/Function;Ljava/util/Set;)Ljava/util/Collection;", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", ordinal = 0, shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) private void limlib$getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences, CallbackInfoReturnable> ci, Set set, JsonUnbakedModel jsonUnbakedModel, Set set2) { @@ -70,13 +53,17 @@ public abstract class JsonUnbakedModelMixin implements UnbakedModelAccess { @Inject(method = "Lnet/minecraft/client/render/model/json/JsonUnbakedModel;bake(Lnet/minecraft/client/render/model/ModelLoader;Lnet/minecraft/client/render/model/json/JsonUnbakedModel;Ljava/util/function/Function;Lnet/minecraft/client/render/model/ModelBakeSettings;Lnet/minecraft/util/Identifier;Z)Lnet/minecraft/client/render/model/BakedModel;", at = @At("RETURN"), cancellable = true) private void limlib$bake(ModelLoader loader, JsonUnbakedModel parent, Function textureGetter, ModelBakeSettings settings, Identifier id, boolean hasDepth, CallbackInfoReturnable ci) { - Map subModels = Maps.newHashMap(); - this.getSubModels().forEach((rendererId, modelId) -> subModels.put(rendererId, loader.getOrLoadModel(modelId).bake(loader, textureGetter, settings, modelId))); - ((BakedModelAccess) ci.getReturnValue()).getSubModels().putAll(subModels); + this.getSubModels().forEach((rendererId, modelId) -> { + if (!modelId.equals(id)) { + ((BakedModelAccess) ci.getReturnValue()).addModel(rendererId, null, loader.bake(modelId, settings)); + } else { + LOGGER.warn("Model '{}' caught in chain! Renderer '{}' caught model '{}'", id, rendererId, modelId); + } + }); } @Override - public Map getSubModels() { + public Map getSubModels() { return subModels; } diff --git a/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/MultipartBakedModelMixin.java b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/MultipartBakedModelMixin.java new file mode 100644 index 0000000..d899b73 --- /dev/null +++ b/src/main/java/net/ludocrypt/limlib/mixin/client/render/model/MultipartBakedModelMixin.java @@ -0,0 +1,65 @@ +package net.ludocrypt.limlib.mixin.client.render.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; + +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; + +import com.google.common.collect.Lists; +import com.mojang.datafixers.util.Pair; + +import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; +import net.ludocrypt.limlib.access.BakedModelAccess; +import net.minecraft.block.BlockState; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.MultipartBakedModel; +import net.minecraft.util.Identifier; + +@Mixin(MultipartBakedModel.class) +public class MultipartBakedModelMixin implements BakedModelAccess { + + @Shadow + @Final + private List, BakedModel>> components; + + @Unique + private final Map>> subModelCache = new Reference2ReferenceOpenHashMap<>(); + + @Override + public List> getModels(@Nullable BlockState state) { + if (state == null) { + return Lists.newArrayList(); + } + + List> models; + synchronized (this.subModelCache) { + models = this.subModelCache.get(state); + + if (models == null) { + models = new ArrayList<>(this.components.size()); + + for (org.apache.commons.lang3.tuple.Pair, BakedModel> pair : this.components) { + if ((pair.getLeft()).test(state)) { + models.addAll(((BakedModelAccess) pair.getRight()).getModels(state)); + } + } + + this.subModelCache.put(state, models); + } + } + + return models; + } + + @Override + public void addModel(Identifier rendererId, @Nullable BlockState state, BakedModel model) { + + } + +} diff --git a/src/main/resources/limlib.mixins.json b/src/main/resources/limlib.mixins.json index 30e4dd6..c07e0de 100644 --- a/src/main/resources/limlib.mixins.json +++ b/src/main/resources/limlib.mixins.json @@ -34,6 +34,7 @@ "client.render.model.GeneralBakedModelMixin", "client.render.model.JsonUnbakedModelDeserializerMixin", "client.render.model.JsonUnbakedModelMixin", + "client.render.model.MultipartBakedModelMixin", "client.sound.SoundSystemMixin", "client.sound.SourceAccessor" ],