/* * Decompiled with CFR 0.152. */ package net.minecraft.client.resources.model; import java.util.List; import net.minecraft.client.renderer.block.model.BlockModelPart; import net.minecraft.client.renderer.block.model.BlockStateModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ResolvableModel; import net.minecraft.util.RandomSource; import net.minecraft.util.random.WeightedList; public class WeightedVariants implements BlockStateModel { private final WeightedList list; private final TextureAtlasSprite particleIcon; public WeightedVariants(WeightedList list) { this.list = list; BlockStateModel firstModel = list.unwrap().getFirst().value(); this.particleIcon = firstModel.particleIcon(); } @Override public TextureAtlasSprite particleIcon() { return this.particleIcon; } @Override public void collectParts(RandomSource random, List output) { this.list.getRandomOrThrow(random).collectParts(random, output); } public record Unbaked(WeightedList entries) implements BlockStateModel.Unbaked { @Override public BlockStateModel bake(ModelBaker modelBakery) { return new WeightedVariants(this.entries.map(m -> m.bake(modelBakery))); } @Override public void resolveDependencies(ResolvableModel.Resolver resolver) { this.entries.unwrap().forEach(v -> ((BlockStateModel.Unbaked)v.value()).resolveDependencies(resolver)); } } }