diff --git a/engine/src/main/java/org/terasology/engine/world/block/loader/BlockFamilyDefinitionFormat.java b/engine/src/main/java/org/terasology/engine/world/block/loader/BlockFamilyDefinitionFormat.java index 5832e1ba8ed..d435b26b299 100644 --- a/engine/src/main/java/org/terasology/engine/world/block/loader/BlockFamilyDefinitionFormat.java +++ b/engine/src/main/java/org/terasology/engine/world/block/loader/BlockFamilyDefinitionFormat.java @@ -19,7 +19,9 @@ import com.google.gson.stream.JsonWriter; import org.joml.Vector3f; import org.joml.Vector4f; +import org.terasology.engine.registry.In; import org.terasology.engine.world.block.DefaultColorSource; +import org.terasology.engine.world.generator.internal.WorldGeneratorManager; import org.terasology.gestalt.assets.Asset; import org.terasology.gestalt.assets.ResourceUrn; import org.terasology.engine.entitySystem.prefab.Prefab; @@ -311,7 +313,10 @@ private BlockFamilyDefinitionData createBaseData(JsonObject jsonObject) { } } - private static class BlockFamilyHandler implements JsonDeserializer> { + private class BlockFamilyHandler implements JsonDeserializer> { + @In + private BlockFamilyLibrary library; + BlockFamilyHandler() { } @@ -319,7 +324,9 @@ private static class BlockFamilyHandler implements JsonDeserializer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - BlockFamilyLibrary library = CoreRegistry.get(BlockFamilyLibrary.class); + if (library == null) { + return null; + } return library.getBlockFamily(json.getAsString()); } }