Keep order of block properties (#1053)

This commit is contained in:
PureGero 2021-05-07 21:12:58 +10:00 committed by GitHub
parent 22be7410fc
commit 1c9015531f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -62,7 +63,8 @@ public class BlockTypesCache {
this.propertiesMapArr = new AbstractProperty[maxOrdinal + 1];
int prop_arr_i = 0;
this.propertiesArr = new AbstractProperty[properties.size()];
HashMap<String, AbstractProperty<?>> propMap = new HashMap<>();
// Preserve properties order with LinkedHashMap
HashMap<String, AbstractProperty<?>> propMap = new LinkedHashMap<>();
int bitOffset = 0;
for (Map.Entry<String, ? extends Property<?>> entry : properties.entrySet()) {