|
9 | 9 |
|
10 | 10 | import java.util.ArrayList; |
11 | 11 | import java.util.List; |
| 12 | +import java.util.Locale; |
| 13 | +import java.util.Map; |
12 | 14 | import java.util.Set; |
13 | 15 |
|
14 | 16 | public class ModelLocationBuilder { |
15 | | - private final Object2ObjectOpenHashMap<Property<?>, PropertyData> propertyToOptionStrings = new Object2ObjectOpenHashMap<>(); |
| 17 | + private final Map<Property<?>, PropertyData> propertyToOptionStrings = new Object2ObjectOpenHashMap<>(); |
16 | 18 | private final StringBuilder builder = new StringBuilder(); |
17 | 19 |
|
18 | 20 | private record PropertyData(List<String> nameValuePairs, int maxPairLength) {} |
19 | 21 |
|
20 | 22 | public void generateForBlock(Set<ResourceLocation> destinationSet, Block block, ResourceLocation baseLocation) { |
21 | 23 | var props = block.getStateDefinition().getProperties(); |
22 | | - List<List<String>> optionsList = new ArrayList<>(); |
| 24 | + List<List<String>> optionsList = new ArrayList<>(props.size()); |
23 | 25 | int requiredBuilderSize = Math.max(0, props.size() - 1); // commas |
24 | 26 | for (var prop : props) { |
25 | 27 | var data = propertyToOptionStrings.computeIfAbsent(prop, ModelLocationBuilder::computePropertyOptions); |
@@ -49,7 +51,7 @@ private static PropertyData computePropertyOptions(Property<?> prop) { |
49 | 51 | int maxLength = 0; |
50 | 52 | for (var val : prop.getPossibleValues()) { |
51 | 53 | String pair = prop.getName() + "=" + getValueName(prop, val); |
52 | | - valuesList.add(pair); |
| 54 | + valuesList.add(pair.toLowerCase(Locale.ROOT)); |
53 | 55 | maxLength = Math.max(pair.length(), maxLength); |
54 | 56 | } |
55 | 57 | return new PropertyData(List.copyOf(valuesList), maxLength); |
|
0 commit comments