diff --git a/src/main/java/com/dfsek/terra/biome/BiomeZone.java b/src/main/java/com/dfsek/terra/biome/BiomeZone.java index 1dd8ef3ae..84ec57aab 100644 --- a/src/main/java/com/dfsek/terra/biome/BiomeZone.java +++ b/src/main/java/com/dfsek/terra/biome/BiomeZone.java @@ -22,6 +22,7 @@ public class BiomeZone { private final ImageLoader imageLoader; private final boolean useImage; private final ImageLoader.Channel channel; + private BiomeZone(World w) { this.w = w; this.noise = new FastNoise((int) w.getSeed()+2); @@ -37,16 +38,15 @@ public class BiomeZone { } public void setZones(@NotNull BiomeGrid[] grids) { - if(grids.length != 32) throw new IllegalArgumentException("Illegal number of grids!"); this.grids = grids; } protected BiomeGrid getGrid(int x, int z) { - return grids[NormalizationUtil.normalize(useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z), 32)]; + return grids[NormalizationUtil.normalize(useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z), grids.length)]; } public int getNoise(int x, int z) { - return NormalizationUtil.normalize(useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z), 32); + return NormalizationUtil.normalize(useImage ? Objects.requireNonNull(imageLoader).getNoiseVal(x, z, channel) : noise.getNoise(x, z), grids.length); } public double getRawNoise(int x, int z) { diff --git a/src/main/java/com/dfsek/terra/config/ConfigUtil.java b/src/main/java/com/dfsek/terra/config/ConfigUtil.java index 5ed9c0065..e8ee87653 100644 --- a/src/main/java/com/dfsek/terra/config/ConfigUtil.java +++ b/src/main/java/com/dfsek/terra/config/ConfigUtil.java @@ -1,5 +1,6 @@ package com.dfsek.terra.config; +import com.dfsek.terra.config.genconfig.AbstractBiomeConfig; import com.dfsek.terra.config.genconfig.BiomeConfig; import com.dfsek.terra.config.genconfig.BiomeGridConfig; import com.dfsek.terra.config.genconfig.CarverConfig; @@ -8,6 +9,7 @@ import com.dfsek.terra.config.genconfig.OreConfig; import com.dfsek.terra.config.genconfig.PaletteConfig; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; import java.util.List; import java.util.logging.Logger; import java.util.stream.Collectors; @@ -25,6 +27,8 @@ public class ConfigUtil { new ConfigLoader("fauna").load(main, FaunaConfig.class); + new ConfigLoader("abstract" + File.separator + "biomes").load(main, AbstractBiomeConfig.class); + new ConfigLoader("biomes").load(main, BiomeConfig.class); new ConfigLoader("grids").load(main, BiomeGridConfig.class); diff --git a/src/main/java/com/dfsek/terra/config/WorldConfig.java b/src/main/java/com/dfsek/terra/config/WorldConfig.java index d53d03e2b..57ea899be 100644 --- a/src/main/java/com/dfsek/terra/config/WorldConfig.java +++ b/src/main/java/com/dfsek/terra/config/WorldConfig.java @@ -17,6 +17,7 @@ import org.polydev.gaea.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -73,6 +74,8 @@ public class WorldConfig { freq1 = 1f/config.getInt("frequencies.grid-1", 256); freq2 = 1f/config.getInt("frequencies.grid-2", 512); fromImage = config.getBoolean("image.use-image", false); + + // Load image stuff try { biomeXChannel = ImageLoader.Channel.valueOf(Objects.requireNonNull(config.getString("image.channels.biome-x", "red")).toUpperCase()); biomeZChannel = ImageLoader.Channel.valueOf(Objects.requireNonNull(config.getString("image.channels.biome-z", "green")).toUpperCase()); @@ -97,21 +100,21 @@ public class WorldConfig { configs.put(w, this); // WorldConfig must be included in map before Grids are loaded. - for(int i = 0; i < 32; i++) { - String partName = config.getStringList("grids").get(i); + // Load BiomeGrids from BiomeZone + List biomeList = config.getStringList("grids"); + for(int i = 0; i < biomeList.size(); i++) { + String partName = biomeList.get(i); if(partName.startsWith("BIOME:")) { - UserDefinedBiome[][] temp = new UserDefinedBiome[16][16]; + UserDefinedBiome[][] temp = new UserDefinedBiome[1][1]; UserDefinedBiome b = BiomeConfig.fromID(partName.substring(6)).getBiome(); - for(int x = 0; x < 16; x++) { - for(int z = 0; z < 16; z++) { - temp[x][z] = b; - } - } + temp[0][0] = b; definedGrids[i] = new UserDefinedGrid(w, freq1, freq2, temp); main.getLogger().info("Loaded single-biome grid " + partName); } else definedGrids[i] = BiomeGridConfig.getBiomeGrids().get(partName).getGrid(w); } + Bukkit.getLogger().info("Loaded " + biomeList.size() + " BiomeGrids from list."); + } catch(IOException | InvalidConfigurationException e) { e.printStackTrace(); main.getLogger().severe("Unable to load configuration for world " + w + "."); diff --git a/src/main/java/com/dfsek/terra/config/genconfig/AbstractBiomeConfig.java b/src/main/java/com/dfsek/terra/config/genconfig/AbstractBiomeConfig.java new file mode 100644 index 000000000..ca43cb774 --- /dev/null +++ b/src/main/java/com/dfsek/terra/config/genconfig/AbstractBiomeConfig.java @@ -0,0 +1,188 @@ +package com.dfsek.terra.config.genconfig; + +import com.dfsek.terra.MaxMin; +import com.dfsek.terra.TerraTree; +import com.dfsek.terra.config.TerraConfigObject; +import org.bukkit.Bukkit; +import org.bukkit.block.data.BlockData; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.InvalidConfigurationException; +import org.polydev.gaea.math.ProbabilityCollection; +import org.polydev.gaea.tree.Tree; +import org.polydev.gaea.tree.TreeType; +import org.polydev.gaea.world.Fauna; +import org.polydev.gaea.world.FaunaType; +import org.polydev.gaea.world.palette.BlockPalette; +import org.polydev.gaea.world.palette.RandomPalette; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Random; +import java.util.TreeMap; + +public class AbstractBiomeConfig extends TerraConfigObject { + private static final Map biomes = new HashMap<>(); + private String biomeID; + private Map ores; + private Map oreHeights; + private Map carvers; + private ProbabilityCollection fauna; + private ProbabilityCollection trees; + private int faunaChance = 0; + private int treeChance = 0; + private int treeDensity = 0; + private String equation; + private TreeMap paletteMap; + + public AbstractBiomeConfig(File file) throws IOException, InvalidConfigurationException { + super(file); + } + + @Override + public void init() throws InvalidConfigurationException { + if(!contains("id")) throw new InvalidConfigurationException("Abstract Biome ID unspecified!"); + this.biomeID = getString("id"); + + if(contains("palette")) { + paletteMap = new TreeMap<>(); + for(Map e : getMapList("palette")) { + for(Map.Entry entry : e.entrySet()) { + try { + if(((String) entry.getKey()).startsWith("BLOCK:")) { + try { + paletteMap.put((Integer) entry.getValue(), new RandomPalette(new Random(0)).addBlockData(new ProbabilityCollection().add(Bukkit.createBlockData(((String) entry.getKey()).substring(6)), 1), 1)); + } catch(IllegalArgumentException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in abstract biome, ID: " + biomeID + ". BlockData " + entry.getKey() + " is invalid!"); + } + } else { + try { + paletteMap.put((Integer) entry.getValue(), PaletteConfig.fromID((String) entry.getKey()).getPalette()); + } catch(NullPointerException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in abstract biome, ID: " + biomeID + "\n\nPalette " + entry.getKey() + " cannot be found!"); + } + } + } catch(ClassCastException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in abstract biome, ID: " + biomeID); + } + } + } + } + + if(contains("carving")) { + carvers = new HashMap<>(); + for(Map e : getMapList("carving")) { + for(Map.Entry entry : e.entrySet()) { + try { + //carvers.add(new UserDefinedCarver((Integer) entry.getValue(), ConfigUtil.getCarver((String) entry.getKey()))); + CarverConfig c = CarverConfig.fromID((String) entry.getKey()); + Bukkit.getLogger().info("Got carver " + c + ". Adding with weight " + entry.getValue()); + carvers.put(c, (Integer) entry.getValue()); + } catch(ClassCastException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for Carvers in abstract biom, ID: " + biomeID); + } catch(NullPointerException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for Carvers in abstract biome, ID: " + biomeID + "\n\n" + "No such carver " + entry.getKey()); + } + } + } + } + + if(contains("fauna")) { + fauna = new ProbabilityCollection<>(); + for(Map.Entry e : Objects.requireNonNull(getConfigurationSection("fauna")).getValues(false).entrySet()) { + try { + Bukkit.getLogger().info("[Terra] Adding " + e.getKey() + " to astract biome's fauna list with weight " + e.getValue()); + fauna.add(FaunaType.valueOf(e.getKey()), (Integer) e.getValue()); + } catch(IllegalArgumentException ex) { + try { + Bukkit.getLogger().info("[Terra] Is custom fauna: true"); + Fauna faunaCustom = FaunaConfig.fromID(e.getKey()); + fauna.add(faunaCustom, (Integer) e.getValue()); + } catch(NullPointerException ex2) { + throw new IllegalArgumentException("SEVERE configuration error for fauna in abstract biome, ID " + getID() + "\n\nFauna with ID " + e.getKey() + " cannot be found!"); + } + } + } + } + if(contains("trees")) { + trees = new ProbabilityCollection<>(); + for(Map.Entry e : Objects.requireNonNull(getConfigurationSection("trees")).getValues(false).entrySet()) { + if(e.getKey().startsWith("TERRA:")) { + trees.add(TerraTree.valueOf(e.getKey().substring(6)), (Integer) e.getValue()); + } else { + trees.add(TreeType.valueOf(e.getKey()), (Integer) e.getValue()); + } + } + } + faunaChance = getInt("fauna-chance", 0); + treeChance = getInt("tree-chance", 0); + treeDensity = getInt("tree-density", 0); + equation = getString("noise-equation"); + + if(contains("ores")) { + ores = new HashMap<>(); + oreHeights = new HashMap<>(); + for(Map.Entry m : Objects.requireNonNull(getConfigurationSection("ores")).getValues(false).entrySet()) { + ores.put(OreConfig.fromID(m.getKey()), new MaxMin(((ConfigurationSection) m.getValue()).getInt("min"), ((ConfigurationSection) m.getValue()).getInt("max"))); + oreHeights.put(OreConfig.fromID(m.getKey()), new MaxMin(((ConfigurationSection) m.getValue()).getInt("min-height"), ((ConfigurationSection) m.getValue()).getInt("max-height"))); + } + } + + biomes.put(biomeID, this); + } + + @Override + public String getID() { + return biomeID; + } + + public int getFaunaChance() { + return faunaChance; + } + + public int getTreeChance() { + return treeChance; + } + + public int getTreeDensity() { + return treeDensity; + } + + public Map getCarvers() { + return carvers; + } + + public Map getOreHeights() { + return oreHeights; + } + + public Map getOres() { + return ores; + } + + public static Map getBiomes() { + return biomes; + } + + public ProbabilityCollection getFauna() { + return fauna; + } + + public ProbabilityCollection getTrees() { + return trees; + } + + public String getEquation() { + return equation; + } + + public TreeMap getPaletteMap() { + return paletteMap; + } + + public static AbstractBiomeConfig fromID(String id) { + return biomes.get(id); + } +} diff --git a/src/main/java/com/dfsek/terra/config/genconfig/BiomeConfig.java b/src/main/java/com/dfsek/terra/config/genconfig/BiomeConfig.java index 6d2c69fd2..822b6ea2e 100644 --- a/src/main/java/com/dfsek/terra/config/genconfig/BiomeConfig.java +++ b/src/main/java/com/dfsek/terra/config/genconfig/BiomeConfig.java @@ -6,13 +6,11 @@ import com.dfsek.terra.biome.UserDefinedBiome; import com.dfsek.terra.biome.UserDefinedDecorator; import com.dfsek.terra.biome.UserDefinedGenerator; import com.dfsek.terra.carving.UserDefinedCarver; -import com.dfsek.terra.config.ConfigLoader; import com.dfsek.terra.config.TerraConfigObject; import org.bukkit.Bukkit; import org.bukkit.block.data.BlockData; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.plugin.java.JavaPlugin; import org.polydev.gaea.math.ProbabilityCollection; import org.polydev.gaea.math.parsii.tokenizer.ParseException; import org.polydev.gaea.tree.Tree; @@ -21,11 +19,11 @@ import org.polydev.gaea.world.Fauna; import org.polydev.gaea.world.FaunaType; import org.polydev.gaea.world.palette.BlockPalette; import org.polydev.gaea.world.palette.RandomPalette; +import scala.concurrent.impl.FutureConvertersImpl; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -40,10 +38,10 @@ public class BiomeConfig extends TerraConfigObject { private String biomeID; private String friendlyName; private org.bukkit.block.Biome vanillaBiome; - private boolean isEnabled = false; private Map ores; private Map oreHeights; private Map carvers; + private String eq; public BiomeConfig(File file) throws InvalidConfigurationException, IOException { super(file); @@ -51,47 +49,70 @@ public class BiomeConfig extends TerraConfigObject { @Override public void init() throws InvalidConfigurationException { - isEnabled = false; oreHeights = new HashMap<>(); ores = new HashMap<>(); - carvers = new HashMap<>(); ProbabilityCollection fauna = new ProbabilityCollection<>(); ProbabilityCollection trees = new ProbabilityCollection<>(); if(!contains("id")) throw new InvalidConfigurationException("Biome ID unspecified!"); this.biomeID = getString("id"); if(!contains("name")) throw new InvalidConfigurationException("Biome Name unspecified!"); this.friendlyName = getString("name"); - if(!contains("noise-equation")) throw new InvalidConfigurationException("No noise equation included in biome!"); + if(!contains("noise-equation") && !contains("extends")) throw new InvalidConfigurationException("Biomes must either include noise equation or extend biome containing an equation."); - TreeMap paletteMap = new TreeMap<>(); - for(Map e : getMapList("palette")) { - for(Map.Entry entry : e.entrySet()) { - try { - if(((String) entry.getKey()).startsWith("BLOCK:")) { - try { - paletteMap.put((Integer) entry.getValue(), new RandomPalette(new Random(0)).addBlockData(new ProbabilityCollection().add(Bukkit.createBlockData(((String) entry.getKey()).substring(6)), 1), 1)); - } catch(IllegalArgumentException ex) { - throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in biome " + getFriendlyName() + ", ID: " + biomeID + ". BlockData " + entry.getKey() + " is invalid!"); - } - } - else { - try { - paletteMap.put((Integer) entry.getValue(), PaletteConfig.fromID((String) entry.getKey()).getPalette()); - } catch(NullPointerException ex) { - throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in biome " + getFriendlyName() + ", ID: " + biomeID + "\n\nPalette " + entry.getKey() + " cannot be found!"); - } - } - } catch(ClassCastException ex) { - throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in biome " + getFriendlyName() + ", ID: " + biomeID); - } + AbstractBiomeConfig abstractBiome = null; + // Whether an abstract biome is to be extended. Default to false. + boolean extending = false; + // Check if biome extends an abstract biome, load abstract biome if so. + if(contains("extends")) { + try { + abstractBiome = AbstractBiomeConfig.fromID(getString("extends")); + extending = true; + Bukkit.getLogger().info("Extending biome " + getString("extends")); + } catch(NullPointerException e) { + throw new InvalidConfigurationException("No abstract biome, " +getString("extends") + ", found."); } } - if(contains("carving")) { + TreeMap paletteMap; + // Check if biome is extending abstract biome, only use abstract biome's palette if palette is NOT defined for current biome. + if(extending && abstractBiome.getPaletteMap() != null && !contains("palette")) { + paletteMap = abstractBiome.getPaletteMap(); + Bukkit.getLogger().info("Using super palette"); + } else if(contains("palette")) { + paletteMap = new TreeMap<>(); + for(Map e : getMapList("palette")) { + for(Map.Entry entry : e.entrySet()) { + try { + if(((String) entry.getKey()).startsWith("BLOCK:")) { + try { + paletteMap.put((Integer) entry.getValue(), new RandomPalette(new Random(0)).addBlockData(new ProbabilityCollection().add(Bukkit.createBlockData(((String) entry.getKey()).substring(6)), 1), 1)); + } catch(IllegalArgumentException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in biome " + getFriendlyName() + ", ID: " + biomeID + ". BlockData " + entry.getKey() + " is invalid!"); + } + } + else { + try { + paletteMap.put((Integer) entry.getValue(), PaletteConfig.fromID((String) entry.getKey()).getPalette()); + } catch(NullPointerException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in biome " + getFriendlyName() + ", ID: " + biomeID + "\n\nPalette " + entry.getKey() + " cannot be found!"); + } + } + } catch(ClassCastException ex) { + throw new InvalidConfigurationException("SEVERE configuration error for BlockPalettes in biome " + getFriendlyName() + ", ID: " + biomeID); + } + } + } + } else throw new InvalidConfigurationException("No palette specified in biome or super biome."); + + // Check if carving should be handled by super biome. + if(extending && abstractBiome.getCarvers() != null && !contains("carving")) { + carvers = abstractBiome.getCarvers(); + Bukkit.getLogger().info("Using super carvers"); + } else if(contains("carving")) { + carvers = new HashMap<>(); for(Map e : getMapList("carving")) { for(Map.Entry entry : e.entrySet()) { try { - //carvers.add(new UserDefinedCarver((Integer) entry.getValue(), ConfigUtil.getCarver((String) entry.getKey()))); CarverConfig c = CarverConfig.fromID((String) entry.getKey()); Bukkit.getLogger().info("Got carver " + c + ". Adding with weight " + entry.getValue()); carvers.put(c, (Integer) entry.getValue()); @@ -102,10 +123,14 @@ public class BiomeConfig extends TerraConfigObject { } } } - } + } else carvers = new HashMap<>(); - if(contains("fauna")) { - for(Map.Entry e : getConfigurationSection("fauna").getValues(false).entrySet()) { + // Check if fauna should be handled by super biome. + if(extending && abstractBiome.getFauna() != null && !contains("fauna")) { + fauna = abstractBiome.getFauna(); + Bukkit.getLogger().info("Using super fauna"); + } else if(contains("fauna")) { + for(Map.Entry e : Objects.requireNonNull(getConfigurationSection("fauna")).getValues(false).entrySet()) { try { Bukkit.getLogger().info("[Terra] Adding " + e.getKey() + " to biome's fauna list with weight " + e.getValue()); fauna.add(FaunaType.valueOf(e.getKey()), (Integer) e.getValue()); @@ -119,46 +144,76 @@ public class BiomeConfig extends TerraConfigObject { } } } - } - if(contains("trees")) { - for(Map.Entry e : getConfigurationSection("trees").getValues(false).entrySet()) { + } else fauna = new ProbabilityCollection<>(); + + if(extending && abstractBiome.getTrees() != null && !contains("trees")) { // Check if trees should be handled by super biome. + trees = abstractBiome.getTrees(); + Bukkit.getLogger().info("Using super trees"); + } else if(contains("trees")) { + for(Map.Entry e : Objects.requireNonNull(getConfigurationSection("trees")).getValues(false).entrySet()) { if(e.getKey().startsWith("TERRA:")) { trees.add(TerraTree.valueOf(e.getKey().substring(6)), (Integer) e.getValue()); } else { trees.add(TreeType.valueOf(e.getKey()), (Integer) e.getValue()); } } + } else trees = new ProbabilityCollection<>(); + + int faunaChance, treeChance, treeDensity; + + // Get various simple values using getOrDefault config methods. + try { + faunaChance = getInt("fauna-chance", Objects.requireNonNull(abstractBiome).getFaunaChance()); + treeChance = getInt("tree-chance", Objects.requireNonNull(abstractBiome).getTreeChance()); + treeDensity = getInt("tree-density", Objects.requireNonNull(abstractBiome).getTreeDensity()); + eq = getString("noise-equation", Objects.requireNonNull(abstractBiome).getEquation()); + } catch(NullPointerException e) { + faunaChance = getInt("fauna-chance", 0); + treeChance = getInt("tree-chance", 0); + treeDensity = getInt("tree-density", 0); + eq = getString("noise-equation", null); } - UserDefinedDecorator dec = new UserDefinedDecorator(fauna, trees, getInt("fauna-chance", 0), getInt("tree-chance", 0), getInt("tree-density", 0)); + //Make sure equation is non-null + if(eq == null) throw new InvalidConfigurationException("Noise equation must be specified in biome or super biome."); - String eq = Objects.requireNonNull(getString("noise-equation")); + // Create decorator for this config. + UserDefinedDecorator dec = new UserDefinedDecorator(fauna, trees, faunaChance, treeChance, treeDensity); + + // Get Vanilla biome, throw exception if it is invalid/unspecified. try { + if(!contains("vanilla")) throw new InvalidConfigurationException("Vanilla Biome unspecified!"); this.vanillaBiome = org.bukkit.block.Biome.valueOf(getString("vanilla")); } catch(IllegalArgumentException e) { throw new InvalidConfigurationException("Invalid Vanilla biome: " + getString("vanilla")); } try { + // Get UserDefinedBiome instance representing this config. this.biome = new UserDefinedBiome(vanillaBiome, dec, new UserDefinedGenerator(eq, Collections.emptyList(), paletteMap)); } catch(ParseException e) { e.printStackTrace(); throw new IllegalArgumentException("Unable to parse noise equation!"); } - if(contains("ores")) { + + // Check if ores should be handled by super biome. + if(extending && abstractBiome.getOres() != null && !contains("ores")) { + ores = abstractBiome.getOres(); + oreHeights = abstractBiome.getOreHeights(); + Bukkit.getLogger().info("Using super ores"); + } else if(contains("ores")) { ores.clear(); - for(Map.Entry m : getConfigurationSection("ores").getValues(false).entrySet()) { + for(Map.Entry m : Objects.requireNonNull(getConfigurationSection("ores")).getValues(false).entrySet()) { ores.put(OreConfig.fromID(m.getKey()), new MaxMin(((ConfigurationSection) m.getValue()).getInt("min"), ((ConfigurationSection) m.getValue()).getInt("max"))); oreHeights.put(OreConfig.fromID(m.getKey()), new MaxMin(((ConfigurationSection) m.getValue()).getInt("min-height"), ((ConfigurationSection) m.getValue()).getInt("max-height"))); } + } else { + ores = new HashMap<>(); + oreHeights = new HashMap<>(); } - if(!contains("vanilla")) throw new InvalidConfigurationException("Vanilla Biome unspecified!"); - if(!contains("palette")) throw new InvalidConfigurationException("Palette unspecified!"); - - isEnabled = true; biomes.put(biomeID, this); } @@ -166,10 +221,6 @@ public class BiomeConfig extends TerraConfigObject { return oreHeights.get(c); } - public boolean isEnabled() { - return isEnabled; - } - public UserDefinedBiome getBiome() { return biome; } @@ -207,7 +258,7 @@ public class BiomeConfig extends TerraConfigObject { @Override public String toString() { - return "Biome with name " + getFriendlyName() + ", ID " + getID() + " and noise equation " + get("noise-equation"); + return "Biome with name " + getFriendlyName() + ", ID " + getID() + " and noise equation " + eq; } public int getCarverChance(UserDefinedCarver c) { diff --git a/src/main/java/com/dfsek/terra/config/genconfig/CarverConfig.java b/src/main/java/com/dfsek/terra/config/genconfig/CarverConfig.java index 71ccc640c..1367b4199 100644 --- a/src/main/java/com/dfsek/terra/config/genconfig/CarverConfig.java +++ b/src/main/java/com/dfsek/terra/config/genconfig/CarverConfig.java @@ -172,12 +172,6 @@ public class CarverConfig extends TerraConfigObject { return new ArrayList<>(caveConfig.values()); } public static CarverConfig fromID(String id) { - Bukkit.getLogger().info("Accessing carvers..."); - for(Map.Entry e : caveConfig.entrySet()) { - Bukkit.getLogger().info("Carver ID " + e.getKey() + ", carver: " + e.getValue()); - } - Bukkit.getLogger().info("ID requested: " + id); - Bukkit.getLogger().info("Fetched " + caveConfig.get(id)); return caveConfig.get(id); } diff --git a/src/main/java/com/dfsek/terra/config/genconfig/PaletteConfig.java b/src/main/java/com/dfsek/terra/config/genconfig/PaletteConfig.java index 06be1b9a5..d22fcfd0e 100644 --- a/src/main/java/com/dfsek/terra/config/genconfig/PaletteConfig.java +++ b/src/main/java/com/dfsek/terra/config/genconfig/PaletteConfig.java @@ -71,8 +71,10 @@ public class PaletteConfig extends TerraConfigObject { for(Map m : maps) { try { ProbabilityCollection layer = new ProbabilityCollection<>(); - for(Map.Entry type : ((Map) m.get("materials")).entrySet()) { - layer.add(Bukkit.createBlockData(type.getKey()), type.getValue()); + for(Map entry : (List>) m.get("materials")) { + for(Map.Entry type : entry.entrySet()) { + layer.add(Bukkit.createBlockData((String) type.getKey()), (Integer) type.getValue()); + } } p.addBlockData(layer, (Integer) m.get("layers")); } catch(ClassCastException e) { diff --git a/src/main/java/com/dfsek/terra/population/CavePopulator.java b/src/main/java/com/dfsek/terra/population/CavePopulator.java index 103116bff..be4cf2332 100644 --- a/src/main/java/com/dfsek/terra/population/CavePopulator.java +++ b/src/main/java/com/dfsek/terra/population/CavePopulator.java @@ -63,7 +63,6 @@ public class CavePopulator extends BlockPopulator { b.setBlockData(Material.AIR.createBlockData(), true); b.setBlockData(orig, true); } - if(i > 0) System.out.println("Shifted " + i + " blocks. " + j + " successful shifts. " + updateNeeded.size() + " blocks updated."); } if(cave != null) cave.complete();