mirror of
https://github.com/BentoBoxWorld/Greenhouses.git
synced 2025-02-08 08:11:23 +01:00
Renamed parameters
This commit is contained in:
parent
21ef0f3c10
commit
d990c7ac23
@ -74,41 +74,41 @@ public class RecipeManager {
|
|||||||
addon.log("Loaded " + biomeRecipes.size() + " biome recipes.");
|
addon.log("Loaded " + biomeRecipes.size() + " biome recipes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processEntries(String type, ConfigurationSection biomeSection) {
|
private void processEntries(String biomeType, ConfigurationSection biomeSection) {
|
||||||
try {
|
try {
|
||||||
ConfigurationSection biomeRecipe = biomeSection.getConfigurationSection(type);
|
ConfigurationSection biomeRecipeConfig = biomeSection.getConfigurationSection(biomeType);
|
||||||
Biome thisBiome;
|
Biome thisBiome;
|
||||||
if (biomeRecipe.contains("biome")) {
|
if (biomeRecipeConfig.contains("biome")) {
|
||||||
// Try and get the biome via the biome setting
|
// Try and get the biome via the biome setting
|
||||||
thisBiome = Biome.valueOf(biomeRecipe.getString("biome").toUpperCase());
|
thisBiome = Biome.valueOf(biomeRecipeConfig.getString("biome").toUpperCase());
|
||||||
} else {
|
} else {
|
||||||
// Old style, where type was the biome name
|
// Old style, where type was the biome name
|
||||||
thisBiome = Biome.valueOf(type);
|
thisBiome = Biome.valueOf(biomeType);
|
||||||
}
|
}
|
||||||
int priority = biomeRecipe.getInt("priority", 0);
|
int priority = biomeRecipeConfig.getInt("priority", 0);
|
||||||
|
|
||||||
// Create the biome recipe
|
// Create the biome recipe
|
||||||
BiomeRecipe b = getBiomeRecipe(biomeRecipe, type, thisBiome, priority);
|
BiomeRecipe biomeRecipe = getBiomeRecipe(biomeRecipeConfig, biomeType, thisBiome, priority);
|
||||||
|
|
||||||
// Set the needed blocks
|
// Set the needed blocks
|
||||||
ConfigurationSection reqContents = biomeRecipe.getConfigurationSection("contents");
|
ConfigurationSection reqContents = biomeRecipeConfig.getConfigurationSection("contents");
|
||||||
if (reqContents != null) {
|
if (reqContents != null) {
|
||||||
for (String rq : reqContents.getKeys(false)) {
|
for (String rq : reqContents.getKeys(false)) {
|
||||||
parseReqBlock(b, rq, reqContents);
|
parseReqBlock(biomeRecipe, rq, reqContents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load plants
|
// Load plants
|
||||||
loadPlants(biomeRecipe, b);
|
loadPlants(biomeRecipeConfig, biomeRecipe);
|
||||||
|
|
||||||
// Load mobs!
|
// Load mobs!
|
||||||
loadMobs(biomeRecipe, b);
|
loadMobs(biomeRecipeConfig, biomeRecipe);
|
||||||
|
|
||||||
// Load block conversions
|
// Load block conversions
|
||||||
loadBlockConversions(biomeRecipe, b);
|
loadBlockConversions(biomeRecipeConfig, biomeRecipe);
|
||||||
|
|
||||||
// Add the recipe to the list
|
// Add the recipe to the list
|
||||||
biomeRecipes.add(b);
|
biomeRecipes.add(biomeRecipe);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
addon.logError("Problem loading biome recipe - skipping! " + e.getMessage());
|
addon.logError("Problem loading biome recipe - skipping! " + e.getMessage());
|
||||||
StringBuilder validBiomes = new StringBuilder();
|
StringBuilder validBiomes = new StringBuilder();
|
||||||
@ -120,26 +120,26 @@ public class RecipeManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BiomeRecipe getBiomeRecipe(ConfigurationSection biomeRecipe, String type, Biome thisBiome, int priority) {
|
private BiomeRecipe getBiomeRecipe(ConfigurationSection biomeRecipeConfig, String biomeType, Biome thisBiome, int priority) {
|
||||||
BiomeRecipe b = new BiomeRecipe(addon, thisBiome, priority);
|
BiomeRecipe b = new BiomeRecipe(addon, thisBiome, priority);
|
||||||
// Set the name
|
// Set the name
|
||||||
b.setName(type);
|
b.setName(biomeType);
|
||||||
addon.log("Adding biome recipe for " + type);
|
addon.log("Adding biome recipe for " + biomeType);
|
||||||
// Set the permission
|
// Set the permission
|
||||||
b.setPermission(biomeRecipe.getString("permission",""));
|
b.setPermission(biomeRecipeConfig.getString("permission",""));
|
||||||
// Set the icon
|
// Set the icon
|
||||||
b.setIcon(Material.valueOf(biomeRecipe.getString("icon", "SAPLING")));
|
b.setIcon(Material.valueOf(biomeRecipeConfig.getString("icon", "SAPLING")));
|
||||||
b.setFriendlyName(ChatColor.translateAlternateColorCodes('&', biomeRecipe.getString("friendlyname", Util.prettifyText(type))));
|
b.setFriendlyName(ChatColor.translateAlternateColorCodes('&', biomeRecipeConfig.getString("friendlyname", Util.prettifyText(biomeType))));
|
||||||
// A value of zero on these means that there must be NO coverage, e.g., desert. If the value is not present, then the default is -1
|
// A value of zero on these means that there must be NO coverage, e.g., desert. If the value is not present, then the default is -1
|
||||||
b.setWatercoverage(biomeRecipe.getInt("watercoverage",-1));
|
b.setWatercoverage(biomeRecipeConfig.getInt("watercoverage",-1));
|
||||||
b.setLavacoverage(biomeRecipe.getInt("lavacoverage",-1));
|
b.setLavacoverage(biomeRecipeConfig.getInt("lavacoverage",-1));
|
||||||
b.setIcecoverage(biomeRecipe.getInt("icecoverage",-1));
|
b.setIcecoverage(biomeRecipeConfig.getInt("icecoverage",-1));
|
||||||
b.setMobLimit(biomeRecipe.getInt("moblimit", 9));
|
b.setMobLimit(biomeRecipeConfig.getInt("moblimit", 9));
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadPlants(ConfigurationSection biomeSection, BiomeRecipe b) {
|
private void loadPlants(ConfigurationSection biomeRecipeConfig, BiomeRecipe b) {
|
||||||
ConfigurationSection temp = biomeSection.getConfigurationSection("plants");
|
ConfigurationSection temp = biomeRecipeConfig.getConfigurationSection("plants");
|
||||||
// # Plant Material: Probability in %:Block Material on what they grow
|
// # Plant Material: Probability in %:Block Material on what they grow
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
HashMap<String,Object> plants = (HashMap<String,Object>)temp.getValues(false);
|
HashMap<String,Object> plants = (HashMap<String,Object>)temp.getValues(false);
|
||||||
@ -154,8 +154,8 @@ public class RecipeManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadBlockConversions(ConfigurationSection biomeSection, BiomeRecipe b) {
|
private void loadBlockConversions(ConfigurationSection biomeRecipeConfig, BiomeRecipe b) {
|
||||||
ConfigurationSection conversionSec = biomeSection.getConfigurationSection("conversions");
|
ConfigurationSection conversionSec = biomeRecipeConfig.getConfigurationSection("conversions");
|
||||||
if (conversionSec != null) {
|
if (conversionSec != null) {
|
||||||
for (String oldMat : conversionSec.getKeys(false)) {
|
for (String oldMat : conversionSec.getKeys(false)) {
|
||||||
try {
|
try {
|
||||||
@ -176,8 +176,8 @@ public class RecipeManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMobs(ConfigurationSection biomeSection, BiomeRecipe b) {
|
private void loadMobs(ConfigurationSection biomeRecipeConfig, BiomeRecipe b) {
|
||||||
ConfigurationSection temp = biomeSection.getConfigurationSection("mobs");
|
ConfigurationSection temp = biomeRecipeConfig.getConfigurationSection("mobs");
|
||||||
// Mob EntityType: Probability:Spawn on Material
|
// Mob EntityType: Probability:Spawn on Material
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
((HashMap<String,Object>)temp.getValues(false)).entrySet().forEach(s -> parseMob(s,b));
|
((HashMap<String,Object>)temp.getValues(false)).entrySet().forEach(s -> parseMob(s,b));
|
||||||
|
Loading…
Reference in New Issue
Block a user