diff --git a/src/main/java/world/bentobox/greenhouses/managers/RecipeManager.java b/src/main/java/world/bentobox/greenhouses/managers/RecipeManager.java index 13c7104..a982155 100644 --- a/src/main/java/world/bentobox/greenhouses/managers/RecipeManager.java +++ b/src/main/java/world/bentobox/greenhouses/managers/RecipeManager.java @@ -126,11 +126,11 @@ public class RecipeManager { String name = biomeRecipeConfig.getString("biome").toUpperCase(); if (Enums.getIfPresent(Biome.class, name).isPresent()) { return Biome.valueOf(name); - } + } // Special case for nether if (name.equals("NETHER") || name.equals("NETHER_WASTES")) { return Enums.getIfPresent(Biome.class, "NETHER").or(Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.PLAINS)); - } + } addon.logError("Biome " + name + " is invalid! Use one of these..."); addon.logError(Arrays.stream(Biome.values()).map(Biome::name).collect(Collectors.joining(","))); return null; @@ -190,6 +190,21 @@ public class RecipeManager { } } + // Get the list of conversions + for (String oldMat : biomeRecipeConfig.getStringList("conversion-list")) { + try { + // Split the string + String[] split = oldMat.split(":"); + Material oldMaterial = Material.valueOf(split[0].toUpperCase()); + int convChance = Integer.parseInt(split[1]); + Material newMaterial = Material.valueOf(split[2]); + Material localMaterial = Material.valueOf(split[3]); + b.addConvBlocks(oldMaterial, newMaterial, convChance, localMaterial); + } catch (Exception e) { + addon.logError("Could not parse " + oldMat); + } + + } } private void loadMobs(ConfigurationSection biomeRecipeConfig, BiomeRecipe b) { diff --git a/src/main/resources/biomes.yml b/src/main/resources/biomes.yml index 637517b..1524223 100644 --- a/src/main/resources/biomes.yml +++ b/src/main/resources/biomes.yml @@ -94,12 +94,13 @@ biomes: plants: DEAD_BUSH: 10:SAND CACTUS: 10:SAND - # Conversions + # Conversion list # Format is: - # Original Block: % chance:New Block:Adjacent Block + # Original Block:% chance:New Block:Adjacent Block # So, for below, dirt has a 30% chance of changing into SAND if it is next to SAND! - conversions: - DIRT: 30:SAND:SAND + # Multiple conversions can be listed + conversion-list: + - DIRT:30:SAND:SAND FOREST: friendlyname: "Flowery forest" biome: FLOWER_FOREST @@ -188,12 +189,12 @@ biomes: SAND: 1 # 50% water required watercoverage: 50 - # Conversions - in this case, an adjacent block is required to convert + # Conversion list - in this case, an adjacent block is required to convert # Format is: - # Original Block: % chance:New Block:Adjacent Block + # Original Block:% chance:New Block:Adjacent Block # So, for below, dirt has a 50% chance of changing into clay if it is next to water! - conversions: - DIRT: 50:CLAY:WATER + conversion-list: + - DIRT:50:CLAY:WATER SAVANNA: biome: SAVANNA icon: ACACIA_LEAVES