/* * Decompiled with CFR 0.152. */ package net.minecraft.client.data.models; import java.util.List; import net.minecraft.client.renderer.block.model.BlockStateModel; import net.minecraft.client.renderer.block.model.SingleVariant; import net.minecraft.client.renderer.block.model.Variant; import net.minecraft.client.renderer.block.model.VariantMutator; import net.minecraft.client.resources.model.WeightedVariants; import net.minecraft.util.random.Weighted; import net.minecraft.util.random.WeightedList; public record MultiVariant(WeightedList variants) { public MultiVariant { if (variants.isEmpty()) { throw new IllegalArgumentException("Variant list must contain at least one element"); } } public MultiVariant with(VariantMutator mutator) { return new MultiVariant(this.variants.map(mutator)); } public BlockStateModel.Unbaked toUnbaked() { List> entries = this.variants.unwrap(); return entries.size() == 1 ? new SingleVariant.Unbaked(entries.getFirst().value()) : new WeightedVariants.Unbaked(this.variants.map(SingleVariant.Unbaked::new)); } }