diff --git a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Block.java b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Block.java index d05916889..3240f3c45 100644 --- a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Block.java +++ b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Block.java @@ -61,10 +61,10 @@ public class Block { for (Map.Entry property : properties.entrySet()) { String key = property.getKey(); String value = property.getValue().getAsString(); - if (BlockProperties.propertiesMapping.containsKey(key)) { - this.properties.add(BlockProperties.propertiesMapping.get(key).get(value)); - } else if (BlockRotations.rotationMapping.containsKey(key)) { - rotation = BlockRotations.rotationMapping.get(value); + if (BlockProperties.PROPERTIES_MAPPING.containsKey(key)) { + this.properties.add(BlockProperties.PROPERTIES_MAPPING.get(key).get(value)); + } else if (BlockRotations.ROTATION_MAPPING.containsKey(key)) { + rotation = BlockRotations.ROTATION_MAPPING.get(value); } } this.rotation = rotation; diff --git a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockProperties.java b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockProperties.java index c3e7fb0dd..55a60fc4b 100644 --- a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockProperties.java +++ b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockProperties.java @@ -419,15 +419,15 @@ public enum BlockProperties { BUTTON_FACE_WALL, BUTTON_FACE_CEILING; - public static final HashMap> propertiesMapping = new HashMap<>(); + public static final HashMap> PROPERTIES_MAPPING = new HashMap<>(); static { // add all to hashmap for (BlockProperties property : values()) { - if (!propertiesMapping.containsKey(property.getGroup())) { - propertiesMapping.put(property.getGroup(), new HashMap<>()); + if (!PROPERTIES_MAPPING.containsKey(property.getGroup())) { + PROPERTIES_MAPPING.put(property.getGroup(), new HashMap<>()); } - propertiesMapping.get(property.getGroup()).put(property.getValue(), property); + PROPERTIES_MAPPING.get(property.getGroup()).put(property.getValue(), property); } } diff --git a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockRotations.java b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockRotations.java index 2c199575d..11cdccca7 100644 --- a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockRotations.java +++ b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/BlockRotations.java @@ -67,13 +67,13 @@ public enum BlockRotations { AXIS_Y("y"), AXIS_Z("z"); - public static final HashMap rotationMapping = new HashMap<>(); + public static final HashMap ROTATION_MAPPING = new HashMap<>(); static { // add all to hashmap for (BlockRotations rotation : values()) { - rotationMapping.put(rotation.name().toLowerCase(), rotation); - rotation.getAliases().forEach((alias) -> rotationMapping.put(alias, rotation)); + ROTATION_MAPPING.put(rotation.name().toLowerCase(), rotation); + rotation.getAliases().forEach((alias) -> ROTATION_MAPPING.put(alias, rotation)); } } diff --git a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Blocks.java b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Blocks.java index 97ac24571..07ae291de 100644 --- a/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Blocks.java +++ b/src/main/java/de/bixilon/minosoft/data/mappings/blocks/Blocks.java @@ -35,28 +35,28 @@ public class Blocks { JsonObject propertiesJSON = statesJSON.getAsJsonObject("properties"); BlockRotations rotation = BlockRotations.NONE; if (propertiesJSON.has("facing")) { - rotation = BlockRotations.rotationMapping.get(propertiesJSON.get("facing").getAsString()); + rotation = BlockRotations.ROTATION_MAPPING.get(propertiesJSON.get("facing").getAsString()); propertiesJSON.remove("facing"); } else if (propertiesJSON.has("rotation")) { - rotation = BlockRotations.rotationMapping.get(propertiesJSON.get("rotation").getAsString()); + rotation = BlockRotations.ROTATION_MAPPING.get(propertiesJSON.get("rotation").getAsString()); propertiesJSON.remove("rotation"); } else if (propertiesJSON.has("orientation")) { - rotation = BlockRotations.rotationMapping.get(propertiesJSON.get("orientation").getAsString()); + rotation = BlockRotations.ROTATION_MAPPING.get(propertiesJSON.get("orientation").getAsString()); propertiesJSON.remove("orientation"); } else if (propertiesJSON.has("axis")) { - rotation = BlockRotations.rotationMapping.get(propertiesJSON.get("axis").getAsString()); + rotation = BlockRotations.ROTATION_MAPPING.get(propertiesJSON.get("axis").getAsString()); propertiesJSON.remove("axis"); } HashSet properties = new HashSet<>(); for (String propertyName : propertiesJSON.keySet()) { - if (BlockProperties.propertiesMapping.get(propertyName) == null) { + if (BlockProperties.PROPERTIES_MAPPING.get(propertyName) == null) { throw new RuntimeException(String.format("Unknown block property: %s (identifier=%s)", propertyName, identifierName)); } - if (BlockProperties.propertiesMapping.get(propertyName).get(propertiesJSON.get(propertyName).getAsString()) == null) { + if (BlockProperties.PROPERTIES_MAPPING.get(propertyName).get(propertiesJSON.get(propertyName).getAsString()) == null) { throw new RuntimeException(String.format("Unknown block property: %s -> %s (identifier=%s)", propertyName, propertiesJSON.get(propertyName).getAsString(), identifierName)); } - properties.add(BlockProperties.propertiesMapping.get(propertyName).get(propertiesJSON.get(propertyName).getAsString())); + properties.add(BlockProperties.PROPERTIES_MAPPING.get(propertyName).get(propertiesJSON.get(propertyName).getAsString())); } block = new Block(mod, identifierName, properties, rotation); diff --git a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockCondition.java b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockCondition.java index 14b050aea..746369fb4 100644 --- a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockCondition.java +++ b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockCondition.java @@ -38,11 +38,11 @@ public class BlockCondition { rotation = BlockRotations.NONE; for (Map.Entry entry : json.entrySet()) { String value = entry.getValue().getAsString(); - if (BlockProperties.propertiesMapping.containsKey(entry.getKey())) { - properties.add(BlockProperties.propertiesMapping.get(entry.getKey()).get(value)); + if (BlockProperties.PROPERTIES_MAPPING.containsKey(entry.getKey())) { + properties.add(BlockProperties.PROPERTIES_MAPPING.get(entry.getKey()).get(value)); continue; } - rotation = BlockRotations.rotationMapping.get(value); + rotation = BlockRotations.ROTATION_MAPPING.get(value); } } diff --git a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModel.java b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModel.java index 79dd3c874..57e94637b 100644 --- a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModel.java +++ b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModel.java @@ -43,10 +43,10 @@ public class BlockModel implements BlockModelInterface { HashSet model = blockModels.get(state.get("model").getAsString()).stream().map(SubBlock::new).collect(Collectors.toCollection(HashSet::new)); HashSet properties = new HashSet<>(); for (Map.Entry property : state.getAsJsonObject("properties").entrySet()) { - if (BlockProperties.propertiesMapping.containsKey(property.getKey())) { - properties.add(BlockProperties.propertiesMapping.get(property.getKey()).get(property.getValue().getAsString()).name()); - } else if (BlockRotations.rotationMapping.containsKey(property.getValue().getAsString())) { - properties.add(BlockRotations.rotationMapping.get(property.getValue().getAsString()).name()); + if (BlockProperties.PROPERTIES_MAPPING.containsKey(property.getKey())) { + properties.add(BlockProperties.PROPERTIES_MAPPING.get(property.getKey()).get(property.getValue().getAsString()).name()); + } else if (BlockRotations.ROTATION_MAPPING.containsKey(property.getValue().getAsString())) { + properties.add(BlockRotations.ROTATION_MAPPING.get(property.getValue().getAsString()).name()); } } for (Axis axis : Axis.values()) {