Implement abstract biomes, rework BlockPalette configs.

This commit is contained in:
dfsek 2020-09-23 01:20:21 -07:00
parent aa326d95e9
commit c4b0057f3e
8 changed files with 310 additions and 69 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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<String> 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 + ".");

View File

@ -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<String, AbstractBiomeConfig> biomes = new HashMap<>();
private String biomeID;
private Map<OreConfig, MaxMin> ores;
private Map<OreConfig, MaxMin> oreHeights;
private Map<CarverConfig, Integer> carvers;
private ProbabilityCollection<Fauna> fauna;
private ProbabilityCollection<Tree> trees;
private int faunaChance = 0;
private int treeChance = 0;
private int treeDensity = 0;
private String equation;
private TreeMap<Integer, BlockPalette> 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<BlockData>().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<String, Object> 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<String, Object> 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<String, Object> 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<CarverConfig, Integer> getCarvers() {
return carvers;
}
public Map<OreConfig, MaxMin> getOreHeights() {
return oreHeights;
}
public Map<OreConfig, MaxMin> getOres() {
return ores;
}
public static Map<String, AbstractBiomeConfig> getBiomes() {
return biomes;
}
public ProbabilityCollection<Fauna> getFauna() {
return fauna;
}
public ProbabilityCollection<Tree> getTrees() {
return trees;
}
public String getEquation() {
return equation;
}
public TreeMap<Integer, BlockPalette> getPaletteMap() {
return paletteMap;
}
public static AbstractBiomeConfig fromID(String id) {
return biomes.get(id);
}
}

View File

@ -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<OreConfig, MaxMin> ores;
private Map<OreConfig, MaxMin> oreHeights;
private Map<CarverConfig, Integer> 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> fauna = new ProbabilityCollection<>();
ProbabilityCollection<Tree> 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<Integer, BlockPalette> 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<BlockData>().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<Integer, BlockPalette> 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<BlockData>().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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> m : getConfigurationSection("ores").getValues(false).entrySet()) {
for(Map.Entry<String, Object> 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) {

View File

@ -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<String, CarverConfig> 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);
}

View File

@ -71,8 +71,10 @@ public class PaletteConfig extends TerraConfigObject {
for(Map<?, ?> m : maps) {
try {
ProbabilityCollection<BlockData> layer = new ProbabilityCollection<>();
for(Map.Entry<String, Integer> type : ((Map<String, Integer>) m.get("materials")).entrySet()) {
layer.add(Bukkit.createBlockData(type.getKey()), type.getValue());
for(Map<?, ?> entry : (List<Map<?, ?>>) 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) {

View File

@ -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();