/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.google.common.collect.ImmutableMap * com.google.common.collect.ImmutableMap$Builder */ package net.minecraft.client.data.models.blockstates; import com.google.common.collect.ImmutableMap; import java.util.List; import java.util.Map; import java.util.stream.Stream; import net.minecraft.client.renderer.block.model.multipart.Condition; import net.minecraft.client.renderer.block.model.multipart.KeyValueCondition; import net.minecraft.world.level.block.state.properties.Property; public class ConditionBuilder { private final ImmutableMap.Builder terms = ImmutableMap.builder(); private > void putValue(Property property, KeyValueCondition.Terms term) { this.terms.put((Object)property.getName(), (Object)term); } public final > ConditionBuilder term(Property property, T value) { this.putValue(property, new KeyValueCondition.Terms(List.of(new KeyValueCondition.Term(property.getName(value), false)))); return this; } @SafeVarargs public final > ConditionBuilder term(Property property, T value, T ... values) { List terms = Stream.concat(Stream.of(value), Stream.of(values)).map(property::getName).sorted().distinct().map(v -> new KeyValueCondition.Term((String)v, false)).toList(); this.putValue(property, new KeyValueCondition.Terms(terms)); return this; } public final > ConditionBuilder negatedTerm(Property property, T value) { this.putValue(property, new KeyValueCondition.Terms(List.of(new KeyValueCondition.Term(property.getName(value), true)))); return this; } public Condition build() { return new KeyValueCondition((Map)this.terms.buildOrThrow()); } }