From 4530fd7aba852b0ad47866ecef1f52764b5a4dfc Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Fri, 15 Oct 2021 18:01:22 +0300 Subject: Global Properties' enchantment cap --- .../shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java index 2458646..b3b344a 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITEnchantment.java @@ -4,6 +4,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.*; import net.minecraft.resource.ResourceType; import net.minecraft.util.Identifier; +import shcm.shsupercm.fabric.citresewn.CITResewn; import shcm.shsupercm.fabric.citresewn.ex.CITParseException; import shcm.shsupercm.fabric.citresewn.mixin.citenchantment.BufferBuilderStorageAccessor; import shcm.shsupercm.fabric.citresewn.mixin.citenchantment.RenderPhaseAccessor; @@ -161,13 +162,14 @@ public class CITEnchantment extends CIT { if (!shouldApply || appliedContext == null) return null; - VertexConsumer applied = VertexConsumers.union(appliedContext.stream() - .map(cit -> provider.getBuffer(cit.renderLayers.get(GlintRenderLayer.this))) - .toArray(VertexConsumer[]::new)); + VertexConsumer[] layers = new VertexConsumer[Math.min(appliedContext.size(), CITResewn.INSTANCE.activeCITs.effectiveGlobalProperties.cap)]; + + for (int i = 0; i < layers.length; i++) + layers[i] = provider.getBuffer(appliedContext.get(i).renderLayers.get(GlintRenderLayer.this)); provider.getBuffer(baseLayer); // refresh base layer for armor consumer - return base == null ? applied : VertexConsumers.union(applied, base); + return base == null ? VertexConsumers.union(layers) : VertexConsumers.union(VertexConsumers.union(layers), base); } } -- cgit