diff --git a/module.txt b/module.txt index 8d35feb..9958e37 100644 --- a/module.txt +++ b/module.txt @@ -1,11 +1,11 @@ { - "id" : "BiomesAPI", - "version" : "3.2.1", - "isReleaseManaged" : true, - "author" : "The Terasology Foundation", - "displayName" : "BiomesAPI", - "description" : "Provides API for working with biomes, i.e., thematic sections of world.", - "dependencies" : [], - "serverSideOnly" : false, - "isLibrary" : true + "id": "BiomesAPI", + "version": "4.0.0", + "isReleaseManaged": true, + "author": "The Terasology Foundation", + "displayName": "BiomesAPI", + "description": "Provides API for working with biomes, i.e., thematic sections of world.", + "dependencies": [], + "serverSideOnly": false, + "isLibrary": true } diff --git a/src/main/java/org/terasology/biomesAPI/Biome.java b/src/main/java/org/terasology/biomesAPI/Biome.java index 22833d6..912fb06 100644 --- a/src/main/java/org/terasology/biomesAPI/Biome.java +++ b/src/main/java/org/terasology/biomesAPI/Biome.java @@ -15,6 +15,8 @@ */ package org.terasology.biomesAPI; +import org.terasology.naming.Name; + /** * Biomes can be assigned to different blocks during worldgen as well as on runtime, to provide additional metadata * about player's surroundings usable to enhance player experience. @@ -29,12 +31,12 @@ public interface Biome { * @return An identifier that includes both the Module the biome originates from * and a unique biome id (unique to that module). */ - String getId(); + Name getId(); /** * Returns human readable name of the biome. */ - String getName(); + String getDisplayName(); /** * Biome hashCode must be deterministic, non-zero, and unique for every biome. @@ -47,7 +49,7 @@ public interface Biome { */ default short biomeHash() { short hash = 0; - char[] chars = getId().toCharArray(); + char[] chars = getId().toLowerCase().toCharArray(); for (char c : chars) { hash = (short) (c + 31 * hash); diff --git a/src/main/java/org/terasology/biomesAPI/BiomeManager.java b/src/main/java/org/terasology/biomesAPI/BiomeManager.java index e5d9f17..3417cfa 100644 --- a/src/main/java/org/terasology/biomesAPI/BiomeManager.java +++ b/src/main/java/org/terasology/biomesAPI/BiomeManager.java @@ -157,7 +157,7 @@ public void checkBiomeChangeEvent(MovedEvent event, EntityRef entity) { Biome oldBiome = oldBiomeOptional.get(); if (oldBiome != newBiome) { entity.send(new OnBiomeChangedEvent(oldBiome, newBiome)); - metricsMode.setBiome(newBiome.getId()); + metricsMode.setBiome(newBiome.getId().toString()); } } } @@ -166,7 +166,7 @@ public void checkBiomeChangeEvent(MovedEvent event, EntityRef entity) { public void checkPlayerSpawnedEvent(OnPlayerSpawnedEvent event, EntityRef entity, LocationComponent locationComponent) { Vector3i spawnPos = new Vector3i(locationComponent.getWorldPosition()); getBiome(spawnPos) - .ifPresent(spawnBiome -> metricsMode.setBiome(spawnBiome.getId())); + .ifPresent(spawnBiome -> metricsMode.setBiome(spawnBiome.getId().toString())); } }