@@ -21,7 +21,17 @@ public class ModelLocationBuilder {
2121 private record PropertyData (ImmutableList <String > nameValuePairs , int maxPairLength ) {}
2222
2323 public void generateForBlock (Set <ResourceLocation > destinationSet , Block block , ResourceLocation baseLocation ) {
24- var props = block .getStateDefinition ().getProperties ();
24+ // Make sure to iterate over the properties in the order of the getValues() map rather than using
25+ // StateDefinition.getProperties(), to match the logic in BlockModelShaper.statePropertiesToString.
26+ // In vanilla, these have the same order, because the backing implementation of getValues() is a map
27+ // that preserves insertion order. However, in some versions of FerriteCore, getValues() may not
28+ // preserve insertion order, but instead rely on hash order of the keys. This results in BlockModelShape
29+ // and ModelLocationBuilder producing different MRLs. Using the keySet produces the same ordering as
30+ // BlockModelShaper, provided that all states were built with the keys inserted in the same order into the same
31+ // map implementation (which should always be true in practice).
32+ // The above issue only seems to affect versions of FerriteCore after the switch to fastutil maps, but it
33+ // is harmless to be consistent on older versions too, especially if another mod backports the fastutil change.
34+ var props = block .defaultBlockState ().getValues ().keySet ();
2535 List <ImmutableList <String >> optionsList = new ArrayList <>(props .size ());
2636 int requiredBuilderSize = Math .max (0 , props .size () - 1 ); // commas
2737 for (var prop : props ) {
0 commit comments