API Surface (6) record PropertyValueList(List<Value<?>> values)
PropertyValueList extend(final Value<?> element)
PropertyValueList extend(final PropertyValueList other)
PropertyValueList of(final Value<?>... values)
String getKey()
String toString()
Code Graph: Dependencies (2) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
PropertyValueList.java 38 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.client.data.models.blockstates;
2
3 import com.google.common.collect.ImmutableList;
4 import java.util.Comparator;
5 import java.util.List;
6 import java.util.stream.Collectors;
7 import net.fabricmc.api.EnvType;
8 import net.fabricmc.api.Environment;
9 import net.minecraft.util.Util;
10 import net.minecraft.world.level.block.state.properties.Property.Value;
11
12 @Environment(EnvType.CLIENT)
13 public record PropertyValueList(List<Value<?>> values) {
14 public static final PropertyValueList EMPTY = new PropertyValueList(List.of());
15 private static final Comparator<Value<?>> COMPARE_BY_NAME = Comparator.comparing(p -> p.property().getName());
16
17 public PropertyValueList extend(final Value<?> element) {
18 return new PropertyValueList(Util.copyAndAdd(this.values, element));
19 }
20
21 public PropertyValueList extend(final PropertyValueList other) {
22 return new PropertyValueList(ImmutableList.<Value<?>>builder().addAll(this.values).addAll(other.values).build());
23 }
24
25 public static PropertyValueList of(final Value<?>... values) {
26 return new PropertyValueList(List.of(values));
27 }
28
29 public String getKey() {
30 return this.values.stream().sorted(COMPARE_BY_NAME).map(Value::toString).collect(Collectors.joining(","));
31 }
32
33 @Override
34 public String toString() {
35 return this.getKey();
36 }
37 }
38
Decompiled Minecraft 26.3 source of PropertyValueList (net/minecraft/client/data/models/blockstates/PropertyValueList.java) with Mojang official mappings, stored verbatim on the site.