Use vanilla height profiles for existing planet ores
This commit is contained in:
parent
6cbe5a6380
commit
b54c277568
1 changed files with 723 additions and 56 deletions
|
|
@ -633,34 +633,8 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Arrakis now permits only its explicitly configured coal and emerald deposits.
|
||||
org.bukkit.configuration.ConfigurationSection ores = plugin.getConfig().getConfigurationSection(path + "ores");
|
||||
if (ores == null) return;
|
||||
int minY = Math.max(minWorldY + 1, plugin.getConfig().getInt(path + "ores.min-y", -48));
|
||||
int maxY = Math.min(maxWorldY - 4, plugin.getConfig().getInt(path + "ores.max-y", 48));
|
||||
int veinSize = Math.max(1, Math.min(16, plugin.getConfig().getInt(path + "ores.vein-size", 5)));
|
||||
if (maxY < minY) return;
|
||||
for (String key : ores.getKeys(false)) {
|
||||
Material ore = Material.matchMaterial(key);
|
||||
if (ore == null || (!key.endsWith("_ORE") && !(planet.equals("giedi_prime") && ore == Material.ANCIENT_DEBRIS))) continue;
|
||||
if(planet.equals("arrakis")&&ore!=Material.COAL_ORE&&ore!=Material.EMERALD_ORE)continue;
|
||||
int attempts = Math.max(0, Math.min(64, ores.getInt(key, 0)));
|
||||
int effectiveVeinSize = ore == Material.ANCIENT_DEBRIS
|
||||
? Math.max(1, Math.min(16, plugin.getConfig().getInt(path + "ancient-debris.vein-size", 5))) : veinSize;
|
||||
int oreMinY = ore == Material.ANCIENT_DEBRIS ? Math.max(minWorldY + 1, plugin.getConfig().getInt(path + "ancient-debris.min-y", -59)) : minY;
|
||||
int oreMaxY = ore == Material.ANCIENT_DEBRIS ? Math.min(maxWorldY - 4, plugin.getConfig().getInt(path + "ancient-debris.max-y", 16)) : maxY;
|
||||
if (oreMaxY < oreMinY) continue;
|
||||
for (int attempt = 0; attempt < attempts; attempt++) {
|
||||
int x = random.nextInt(16), z = random.nextInt(16), y = oreMinY + random.nextInt(oreMaxY - oreMinY + 1);
|
||||
for (int n = 0; n < effectiveVeinSize; n++) {
|
||||
int vx = Math.max(0, Math.min(15, x + random.nextInt(3) - 1));
|
||||
int vz = Math.max(0, Math.min(15, z + random.nextInt(3) - 1));
|
||||
int vy = Math.max(oreMinY, Math.min(oreMaxY, y + random.nextInt(3) - 1));
|
||||
Material existing = data.getType(vx, vy, vz);
|
||||
if (existing == Material.STONE || existing == Material.DEEPSLATE || existing == Material.TUFF) data.setBlock(vx, vy, vz, ore);
|
||||
}
|
||||
}
|
||||
}
|
||||
OreHeights.place(plugin.getConfig().getConfigurationSection(path + "ores"),
|
||||
data, random, path, planet, minWorldY, maxWorldY);
|
||||
}
|
||||
private void placeJungleTree(ChunkData data, int x, int y, int z, Random random, int maxY) {
|
||||
int height = 4 + random.nextInt(4);
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff