mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-27 06:20:05 +00:00
Clean up imports
This commit is contained in:
1 parent
f198b371e0
commit
224dfbe638
108 files changed
+831
-635
No files matched your search
@@ -13,6 +13,7 @@ public class Debug {
|
|||||||
public static void info(String message) {
|
public static void info(String message) {
|
||||||
if(ConfigUtil.debug) main.getLogger().info(message);
|
if(ConfigUtil.debug) main.getLogger().info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String message) {
|
public static void warn(String message) {
|
||||||
if(ConfigUtil.debug) main.getLogger().warning(message);
|
if(ConfigUtil.debug) main.getLogger().warning(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class EventListener implements Listener {
|
|||||||
public EventListener(GaeaPlugin main) {
|
public EventListener(GaeaPlugin main) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onEnderEye(EntitySpawnEvent e) {
|
public void onEnderEye(EntitySpawnEvent e) {
|
||||||
Entity entity = e.getEntity();
|
Entity entity = e.getEntity();
|
||||||
@@ -29,21 +30,25 @@ public class EventListener implements Listener {
|
|||||||
TerraWorld tw = TerraWorld.getWorld(e.getEntity().getWorld());
|
TerraWorld tw = TerraWorld.getWorld(e.getEntity().getWorld());
|
||||||
EnderSignal signal = (EnderSignal) entity;
|
EnderSignal signal = (EnderSignal) entity;
|
||||||
StructureConfig config = tw.getConfig().getLocatable().get(StructureTypeEnum.STRONGHOLD);
|
StructureConfig config = tw.getConfig().getLocatable().get(StructureTypeEnum.STRONGHOLD);
|
||||||
if(config!= null) {
|
if(config != null) {
|
||||||
Debug.info("Overriding Ender Signal...");
|
Debug.info("Overriding Ender Signal...");
|
||||||
AsyncStructureFinder finder = new AsyncStructureFinder(tw.getGrid(), config, e.getLocation(), 0, 500, location -> {
|
AsyncStructureFinder finder = new AsyncStructureFinder(tw.getGrid(), config, e.getLocation(), 0, 500, location -> {
|
||||||
if(location != null) signal.setTargetLocation(location.toLocation(signal.getWorld()));
|
if(location != null) signal.setTargetLocation(location.toLocation(signal.getWorld()));
|
||||||
Debug.info("Location: " + location);
|
Debug.info("Location: " + location);
|
||||||
});
|
});
|
||||||
finder.run(); // Do this synchronously so eye doesn't change direction several ticks after spawning.
|
finder.run(); // Do this synchronously so eye doesn't change direction several ticks after spawning.
|
||||||
} else main.getLogger().warning("No overrides are defined for Strongholds. Ender Signals will not work correctly.");
|
} else
|
||||||
|
main.getLogger().warning("No overrides are defined for Strongholds. Ender Signals will not work correctly.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCartographerChange(VillagerAcquireTradeEvent e) {
|
public void onCartographerChange(VillagerAcquireTradeEvent e) {
|
||||||
if(!(e.getEntity() instanceof Villager)) return;
|
if(! (e.getEntity() instanceof Villager)) return;
|
||||||
if(((Villager) e.getEntity()).getProfession().equals(Villager.Profession.CARTOGRAPHER)) e.setCancelled(true); // Cancel leveling if the villager is a Cartographer, to prevent crashing server.
|
if(((Villager) e.getEntity()).getProfession().equals(Villager.Profession.CARTOGRAPHER))
|
||||||
|
e.setCancelled(true); // Cancel leveling if the villager is a Cartographer, to prevent crashing server.
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCartographerLevel(VillagerCareerChangeEvent e) {
|
public void onCartographerLevel(VillagerCareerChangeEvent e) {
|
||||||
if(e.getProfession().equals(Villager.Profession.CARTOGRAPHER)) {
|
if(e.getProfession().equals(Villager.Profession.CARTOGRAPHER)) {
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import com.dfsek.terra.generation.TerraChunkGenerator;
|
|||||||
import com.dfsek.terra.util.PaperUtil;
|
import com.dfsek.terra.util.PaperUtil;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.polydev.gaea.GaeaPlugin;
|
import org.polydev.gaea.GaeaPlugin;
|
||||||
@@ -19,10 +17,8 @@ import org.polydev.gaea.generation.GaeaChunkGenerator;
|
|||||||
import org.polydev.gaea.lang.Language;
|
import org.polydev.gaea.lang.Language;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class Terra extends GaeaPlugin {
|
public class Terra extends GaeaPlugin {
|
||||||
private static Terra instance;
|
private static Terra instance;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class TerraProfiler extends WorldProfiler {
|
public class TerraProfiler extends WorldProfiler {
|
||||||
private static final Map<World, TerraProfiler> profilerMap = new HashMap<>();
|
private static final Map<World, TerraProfiler> profilerMap = new HashMap<>();
|
||||||
|
|
||||||
public TerraProfiler(World w) {
|
public TerraProfiler(World w) {
|
||||||
super(w);
|
super(w);
|
||||||
this
|
this
|
||||||
@@ -23,6 +24,7 @@ public class TerraProfiler extends WorldProfiler {
|
|||||||
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "CaveBlockUpdate");
|
.addMeasurement(new Measurement(1500000, DataType.PERIOD_MILLISECONDS), "CaveBlockUpdate");
|
||||||
profilerMap.put(w, this);
|
profilerMap.put(w, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TerraProfiler fromWorld(World w) {
|
public static TerraProfiler fromWorld(World w) {
|
||||||
if(w.getGenerator() instanceof TerraChunkGenerator) {
|
if(w.getGenerator() instanceof TerraChunkGenerator) {
|
||||||
if(profilerMap.containsKey(w)) return profilerMap.get(w);
|
if(profilerMap.containsKey(w)) return profilerMap.get(w);
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import com.dfsek.terra.biome.TerraBiomeGrid;
|
|||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.biome.UserDefinedGrid;
|
import com.dfsek.terra.biome.UserDefinedGrid;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
|
||||||
import com.dfsek.terra.config.base.WorldConfig;
|
import com.dfsek.terra.config.base.WorldConfig;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
|
||||||
import com.dfsek.terra.config.genconfig.BiomeGridConfig;
|
import com.dfsek.terra.config.genconfig.BiomeGridConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ public class AsyncBiomeFinder implements Runnable {
|
|||||||
int z = centerZ;
|
int z = centerZ;
|
||||||
int run = 1;
|
int run = 1;
|
||||||
boolean toggle = true;
|
boolean toggle = true;
|
||||||
main: for(int i = startRadius; i < maxRadius; i++) {
|
main:
|
||||||
|
for(int i = startRadius; i < maxRadius; i++) {
|
||||||
for(int j = 0; j < run; j++) {
|
for(int j = 0; j < run; j++) {
|
||||||
if(checkBiome(x, z).equals(target)) break main;
|
if(checkBiome(x, z).equals(target)) break main;
|
||||||
if(toggle) x++;
|
if(toggle) x++;
|
||||||
@@ -51,7 +52,7 @@ public class AsyncBiomeFinder implements Runnable {
|
|||||||
else z--;
|
else z--;
|
||||||
}
|
}
|
||||||
run++;
|
run++;
|
||||||
toggle = !toggle;
|
toggle = ! toggle;
|
||||||
}
|
}
|
||||||
if(p.isOnline()) {
|
if(p.isOnline()) {
|
||||||
if(checkBiome(x, z).equals(target)) {
|
if(checkBiome(x, z).equals(target)) {
|
||||||
@@ -67,6 +68,7 @@ public class AsyncBiomeFinder implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to get biome at location
|
* Helper method to get biome at location
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return Biome at coordinates
|
* @return Biome at coordinates
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.dfsek.terra.structure.Structure;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -46,15 +45,16 @@ public class AsyncStructureFinder implements Runnable {
|
|||||||
int x = centerX;
|
int x = centerX;
|
||||||
int z = centerZ;
|
int z = centerZ;
|
||||||
|
|
||||||
final int wid = target.getSpawn().getWidth() + 2*target.getSpawn().getSeparation();
|
final int wid = target.getSpawn().getWidth() + 2 * target.getSpawn().getSeparation();
|
||||||
x/=wid;
|
x /= wid;
|
||||||
z/=wid;
|
z /= wid;
|
||||||
|
|
||||||
int run = 1;
|
int run = 1;
|
||||||
boolean toggle = true;
|
boolean toggle = true;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
Vector spawn = null;
|
Vector spawn = null;
|
||||||
main: for(int i = startRadius; i < maxRadius; i++) {
|
main:
|
||||||
|
for(int i = startRadius; i < maxRadius; i++) {
|
||||||
for(int j = 0; j < run; j++) {
|
for(int j = 0; j < run; j++) {
|
||||||
spawn = target.getSpawn().getChunkSpawn(x, z, seed);
|
spawn = target.getSpawn().getChunkSpawn(x, z, seed);
|
||||||
if(isValidSpawn(spawn.getBlockX(), spawn.getBlockZ())) {
|
if(isValidSpawn(spawn.getBlockX(), spawn.getBlockZ())) {
|
||||||
@@ -74,26 +74,28 @@ public class AsyncStructureFinder implements Runnable {
|
|||||||
else z -= 1;
|
else z -= 1;
|
||||||
}
|
}
|
||||||
run++;
|
run++;
|
||||||
toggle = !toggle;
|
toggle = ! toggle;
|
||||||
}
|
}
|
||||||
final Vector finalSpawn = found ? spawn: null;
|
final Vector finalSpawn = found ? spawn : null;
|
||||||
Bukkit.getScheduler().runTask(Terra.getInstance(), () -> callback.accept(finalSpawn));
|
Bukkit.getScheduler().runTask(Terra.getInstance(), () -> callback.accept(finalSpawn));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if coordinate pair is a valid structure spawn
|
* Check if coordinate pair is a valid structure spawn
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return Whether location is a valid spawn for StructureConfig
|
* @return Whether location is a valid spawn for StructureConfig
|
||||||
*/
|
*/
|
||||||
private boolean isValidSpawn(int x, int z) {
|
private boolean isValidSpawn(int x, int z) {
|
||||||
Location spawn = target.getSpawn().getNearestSpawn(x, z, world.getSeed()).toLocation(world);
|
Location spawn = target.getSpawn().getNearestSpawn(x, z, world.getSeed()).toLocation(world);
|
||||||
if(! TerraWorld.getWorld(world).getConfig().getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(target)) return false;
|
if(! TerraWorld.getWorld(world).getConfig().getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(target))
|
||||||
|
return false;
|
||||||
Random r2 = new Random(spawn.hashCode());
|
Random r2 = new Random(spawn.hashCode());
|
||||||
Structure struc = target.getStructure(r2);
|
Structure struc = target.getStructure(r2);
|
||||||
Structure.Rotation rotation = Structure.Rotation.fromDegrees(r2.nextInt(4) * 90);
|
Structure.Rotation rotation = Structure.Rotation.fromDegrees(r2.nextInt(4) * 90);
|
||||||
for(int y = target.getSearchStart().get(r2); y > 0; y--) {
|
for(int y = target.getSearchStart().get(r2); y > 0; y--) {
|
||||||
if(!target.getBound().isInRange(y)) return false;
|
if(! target.getBound().isInRange(y)) return false;
|
||||||
spawn.setY(y);
|
spawn.setY(y);
|
||||||
if(! struc.checkSpawns(spawn, rotation)) continue;
|
if(! struc.checkSpawns(spawn, rotation)) continue;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class BiomeZone {
|
|||||||
private final ImageLoader.Channel channel;
|
private final ImageLoader.Channel channel;
|
||||||
|
|
||||||
public BiomeZone(World w, WorldConfig wc, BiomeGrid[] grids) {
|
public BiomeZone(World w, WorldConfig wc, BiomeGrid[] grids) {
|
||||||
this.noise = new FastNoiseLite((int) w.getSeed()+2);
|
this.noise = new FastNoiseLite((int) w.getSeed() + 2);
|
||||||
this.noise.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
this.noise.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
this.noise.setFractalType(FastNoiseLite.FractalType.FBm);
|
this.noise.setFractalType(FastNoiseLite.FractalType.FBm);
|
||||||
this.noise.setFractalOctaves(4);
|
this.noise.setFractalOctaves(4);
|
||||||
@@ -35,6 +35,7 @@ public class BiomeZone {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get BiomeGrid at location
|
* Get BiomeGrid at location
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return BiomeGrid at coordinates.
|
* @return BiomeGrid at coordinates.
|
||||||
@@ -45,6 +46,7 @@ public class BiomeZone {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of BiomeGrids this BiomeZone holds.
|
* Get the number of BiomeGrids this BiomeZone holds.
|
||||||
|
*
|
||||||
* @return Number of grids
|
* @return Number of grids
|
||||||
*/
|
*/
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
@@ -53,6 +55,7 @@ public class BiomeZone {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the normalized grid noise at location
|
* Get the normalized grid noise at location
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return Normalized noise at coordinates
|
* @return Normalized noise at coordinates
|
||||||
@@ -63,6 +66,7 @@ public class BiomeZone {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get raw grid noise at location
|
* Get raw grid noise at location
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return Raw noise at coordinates
|
* @return Raw noise at coordinates
|
||||||
|
|||||||
@@ -13,15 +13,16 @@ public class CoordinatePerturb {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a CoordinatePerturb object with a given frequency, amplitude, and seed.
|
* Create a CoordinatePerturb object with a given frequency, amplitude, and seed.
|
||||||
|
*
|
||||||
* @param frequency Noise frequency
|
* @param frequency Noise frequency
|
||||||
* @param amplitude Offset amplitude
|
* @param amplitude Offset amplitude
|
||||||
* @param seed Noise seed
|
* @param seed Noise seed
|
||||||
*/
|
*/
|
||||||
public CoordinatePerturb(float frequency, int amplitude, long seed) {
|
public CoordinatePerturb(float frequency, int amplitude, long seed) {
|
||||||
perturbX = new FastNoiseLite((int) seed);
|
perturbX = new FastNoiseLite((int) seed);
|
||||||
perturbX.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
perturbX.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
perturbX.setFrequency(frequency);
|
perturbX.setFrequency(frequency);
|
||||||
perturbZ = new FastNoiseLite((int) seed+1);
|
perturbZ = new FastNoiseLite((int) seed + 1);
|
||||||
perturbZ.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
perturbZ.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
perturbZ.setFrequency(frequency);
|
perturbZ.setFrequency(frequency);
|
||||||
this.amplitude = amplitude;
|
this.amplitude = amplitude;
|
||||||
@@ -29,11 +30,12 @@ public class CoordinatePerturb {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset a coordinate pair
|
* Offset a coordinate pair
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return Vector2 containing offset coordinates
|
* @return Vector2 containing offset coordinates
|
||||||
*/
|
*/
|
||||||
public Vector2 getShiftedCoords(int x, int z) {
|
public Vector2 getShiftedCoords(int x, int z) {
|
||||||
return new Vector2(perturbX.getNoise(x, z)*amplitude+x, perturbZ.getNoise(x, z)*amplitude+z);
|
return new Vector2(perturbX.getNoise(x, z) * amplitude + x, perturbZ.getNoise(x, z) * amplitude + z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,8 +8,9 @@ import org.polydev.gaea.math.FastNoiseLite;
|
|||||||
public class ErosionNoise {
|
public class ErosionNoise {
|
||||||
private final double thresh;
|
private final double thresh;
|
||||||
private final FastNoiseLite noise;
|
private final FastNoiseLite noise;
|
||||||
|
|
||||||
public ErosionNoise(float freq1, double thresh, int octaves, long seed) {
|
public ErosionNoise(float freq1, double thresh, int octaves, long seed) {
|
||||||
FastNoiseLite main = new FastNoiseLite((int) (seed+1));
|
FastNoiseLite main = new FastNoiseLite((int) (seed + 1));
|
||||||
main.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
main.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
main.setFractalType(FastNoiseLite.FractalType.FBm);
|
main.setFractalType(FastNoiseLite.FractalType.FBm);
|
||||||
main.setFractalOctaves(octaves);
|
main.setFractalOctaves(octaves);
|
||||||
@@ -20,6 +21,7 @@ public class ErosionNoise {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether a location is eroded
|
* Get whether a location is eroded
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
* @return Whether location is eroded
|
* @return Whether location is eroded
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ public class TerraBiomeGrid extends BiomeGrid {
|
|||||||
b = (UserDefinedBiome) zone.getGrid(xp, zp).getBiome(xp, zp, phase);
|
b = (UserDefinedBiome) zone.getGrid(xp, zp).getBiome(xp, zp, phase);
|
||||||
} catch(NullPointerException e) {
|
} catch(NullPointerException e) {
|
||||||
if(ConfigUtil.debug) e.printStackTrace();
|
if(ConfigUtil.debug) e.printStackTrace();
|
||||||
if(failNum % 256 == 0) LangUtil.log("error.severe-config", Level.SEVERE, String.valueOf(x), String.valueOf(z));
|
if(failNum % 256 == 0)
|
||||||
|
LangUtil.log("error.severe-config", Level.SEVERE, String.valueOf(x), String.valueOf(z));
|
||||||
failNum++;
|
failNum++;
|
||||||
return ConfigUtil.failType.fail();
|
return ConfigUtil.failType.fail();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package com.dfsek.terra.biome;
|
|||||||
import com.dfsek.terra.generation.UserDefinedDecorator;
|
import com.dfsek.terra.generation.UserDefinedDecorator;
|
||||||
import com.dfsek.terra.generation.UserDefinedGenerator;
|
import com.dfsek.terra.generation.UserDefinedGenerator;
|
||||||
import org.polydev.gaea.biome.Biome;
|
import org.polydev.gaea.biome.Biome;
|
||||||
import org.polydev.gaea.biome.Generator;
|
|
||||||
import org.polydev.gaea.biome.Decorator;
|
import org.polydev.gaea.biome.Decorator;
|
||||||
|
import org.polydev.gaea.biome.Generator;
|
||||||
import org.polydev.gaea.structures.features.Feature;
|
import org.polydev.gaea.structures.features.Feature;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class UserDefinedGrid extends BiomeGrid {
|
|||||||
private final boolean fromImage;
|
private final boolean fromImage;
|
||||||
private final ImageLoader.Channel channelX;
|
private final ImageLoader.Channel channelX;
|
||||||
private final ImageLoader.Channel channelZ;
|
private final ImageLoader.Channel channelZ;
|
||||||
|
|
||||||
public UserDefinedGrid(World w, float freq1, float freq2, UserDefinedBiome[][] b, WorldConfig c) {
|
public UserDefinedGrid(World w, float freq1, float freq2, UserDefinedBiome[][] b, WorldConfig c) {
|
||||||
super(w, freq1, freq2, b.length, b[0].length);
|
super(w, freq1, freq2, b.length, b[0].length);
|
||||||
super.setGrid(b);
|
super.setGrid(b);
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public enum FailType {
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns null, hard crashing the server, but not generating any corrupted terrain.<br>
|
* Returns null, hard crashing the server, but not generating any corrupted terrain.<br>
|
||||||
* This option is <br>NOT</br> stable, but it has the least risk of blank chunks being generated.
|
* This option is <br>NOT</br> stable, but it has the least risk of blank chunks being generated.
|
||||||
* However, it has the highest risk of corruption!
|
* However, it has the highest risk of corruption!
|
||||||
*/
|
*/
|
||||||
CRASH {
|
CRASH {
|
||||||
@Override
|
@Override
|
||||||
@@ -53,6 +53,7 @@ public enum FailType {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the action specified by the enum type to occur on failure of terrain generation.
|
* Performs the action specified by the enum type to occur on failure of terrain generation.
|
||||||
|
*
|
||||||
* @return Failover biome, if specified, null if not.
|
* @return Failover biome, if specified, null if not.
|
||||||
*/
|
*/
|
||||||
public abstract Biome fail();
|
public abstract Biome fail();
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.dfsek.terra.biome.failsafe;
|
|||||||
|
|
||||||
import com.dfsek.terra.generation.UserDefinedDecorator;
|
import com.dfsek.terra.generation.UserDefinedDecorator;
|
||||||
import org.polydev.gaea.math.ProbabilityCollection;
|
import org.polydev.gaea.math.ProbabilityCollection;
|
||||||
import org.polydev.gaea.tree.Tree;
|
|
||||||
import org.polydev.gaea.world.Flora;
|
|
||||||
|
|
||||||
public final class FailoverDecorator extends UserDefinedDecorator {
|
public final class FailoverDecorator extends UserDefinedDecorator {
|
||||||
public FailoverDecorator() {
|
public FailoverDecorator() {
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
public final class FailoverGenerator extends UserDefinedGenerator {
|
public final class FailoverGenerator extends UserDefinedGenerator {
|
||||||
private static final TreeMap<Integer, Palette<BlockData>> palette = new TreeMap<>();
|
private static final TreeMap<Integer, Palette<BlockData>> palette = new TreeMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
palette.put(255, new RandomPalette<BlockData>(new Random(2403)).add(Material.STONE.createBlockData(), 1));
|
palette.put(255, new RandomPalette<BlockData>(new Random(2403)).add(Material.STONE.createBlockData(), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FailoverGenerator() throws ParseException {
|
public FailoverGenerator() throws ParseException {
|
||||||
super("0", Collections.emptyList(), palette, false);
|
super("0", Collections.emptyList(), palette, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,40 +9,44 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
import org.polydev.gaea.math.MathUtil;
|
import org.polydev.gaea.math.MathUtil;
|
||||||
import org.polydev.gaea.world.carving.CarvingData;
|
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class Cavern {
|
public class Cavern {
|
||||||
private final Node node;
|
private final Node node;
|
||||||
private final long seed;
|
private final long seed;
|
||||||
|
|
||||||
public Cavern(World w) {
|
public Cavern(World w) {
|
||||||
this.node = new Node(w);
|
this.node = new Node(w);
|
||||||
this.seed = w.getSeed();
|
this.seed = w.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoxelGeometry carveChunk(int chunkX, int chunkZ) {
|
public VoxelGeometry carveChunk(int chunkX, int chunkZ) {
|
||||||
long seedC = MathUtil.getCarverChunkSeed(chunkX, chunkZ, seed);
|
long seedC = MathUtil.getCarverChunkSeed(chunkX, chunkZ, seed);
|
||||||
Random chunk = new Random(seedC);
|
Random chunk = new Random(seedC);
|
||||||
Vector org = node.getNodeLocation((chunkX << 4)+8, (chunkZ << 4)+8).clone().setY(chunk.nextInt(128));
|
Vector org = node.getNodeLocation((chunkX << 4) + 8, (chunkZ << 4) + 8).clone().setY(chunk.nextInt(128));
|
||||||
VoxelGeometry carve = VoxelGeometry.getBlank();
|
VoxelGeometry carve = VoxelGeometry.getBlank();
|
||||||
|
|
||||||
FastNoiseLite smpl = new FastNoiseLite((int) seedC);
|
FastNoiseLite smpl = new FastNoiseLite((int) seedC);
|
||||||
smpl.setFrequency(0.01f);
|
smpl.setFrequency(0.01f);
|
||||||
smpl.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
smpl.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
Bukkit.getLogger().info("Cavern: " + org.toString());
|
Bukkit.getLogger().info("Cavern: " + org.toString());
|
||||||
carve.merge(new DeformedSphere(org.clone(), chunk.nextInt(4)+3, 0.75, smpl));
|
carve.merge(new DeformedSphere(org.clone(), chunk.nextInt(4) + 3, 0.75, smpl));
|
||||||
|
|
||||||
Vector _00 = new Vector(org.getX()+16, new Random(MathUtil.getCarverChunkSeed(chunkX+1, chunkZ, seed)).nextInt(128), org.getZ());
|
Vector _00 = new Vector(org.getX() + 16, new Random(MathUtil.getCarverChunkSeed(chunkX + 1, chunkZ, seed)).nextInt(128), org.getZ());
|
||||||
|
|
||||||
carve.merge(new Tube(org, _00, 4));
|
carve.merge(new Tube(org, _00, 4));
|
||||||
return carve;
|
return carve;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Node {
|
public static class Node {
|
||||||
private final long seed;
|
private final long seed;
|
||||||
private final GridSpawn spawn = new GridSpawn(16, 0);
|
private final GridSpawn spawn = new GridSpawn(16, 0);
|
||||||
|
|
||||||
public Node(World w) {
|
public Node(World w) {
|
||||||
this.seed = w.getSeed();
|
this.seed = w.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector getNodeLocation(int x, int z) {
|
public Vector getNodeLocation(int x, int z) {
|
||||||
return spawn.getNearestSpawn(x, z, seed);
|
return spawn.getNearestSpawn(x, z, seed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ public class SimplexCarver extends Carver {
|
|||||||
private final FastNoiseLite height;
|
private final FastNoiseLite height;
|
||||||
private final FastNoiseLite column;
|
private final FastNoiseLite column;
|
||||||
private final FastNoiseLite hasCaves;
|
private final FastNoiseLite hasCaves;
|
||||||
private final double root2inverse = 1D/Math.sqrt(2);
|
private final double root2inverse = 1D / Math.sqrt(2);
|
||||||
|
|
||||||
public SimplexCarver(int minY, int maxY) {
|
public SimplexCarver(int minY, int maxY) {
|
||||||
super(minY, maxY);
|
super(minY, maxY);
|
||||||
noise = new FastNoiseLite(2403);
|
noise = new FastNoiseLite(2403);
|
||||||
@@ -53,19 +54,19 @@ public class SimplexCarver extends Carver {
|
|||||||
CarvingData c = new CarvingData(chunkX, chunkZ);
|
CarvingData c = new CarvingData(chunkX, chunkZ);
|
||||||
int ox = chunkX << 4;
|
int ox = chunkX << 4;
|
||||||
int oz = chunkZ << 4;
|
int oz = chunkZ << 4;
|
||||||
for(int x = ox; x < ox+16; x++) {
|
for(int x = ox; x < ox + 16; x++) {
|
||||||
for(int z = oz; z < oz+16; z++) {
|
for(int z = oz; z < oz + 16; z++) {
|
||||||
double heightNoise = height.getNoise(x, z);
|
double heightNoise = height.getNoise(x, z);
|
||||||
double mainNoise = noise.getNoise(x, z)*2;
|
double mainNoise = noise.getNoise(x, z) * 2;
|
||||||
double columnNoise = Math.pow(Math.max(column.getNoise(x, z), 0)*2, 3);
|
double columnNoise = Math.pow(Math.max(column.getNoise(x, z), 0) * 2, 3);
|
||||||
double hc = (acot(16*(hasCaves.getNoise(x, z)-0.2))/Math.PI)-0.1;
|
double hc = (acot(16 * (hasCaves.getNoise(x, z) - 0.2)) / Math.PI) - 0.1;
|
||||||
CarvingData.CarvingType type = CarvingData.CarvingType.BOTTOM;
|
CarvingData.CarvingType type = CarvingData.CarvingType.BOTTOM;
|
||||||
double simplex = (Math.pow(mainNoise + root2inverse, 3)/2 + columnNoise) * hc;
|
double simplex = (Math.pow(mainNoise + root2inverse, 3) / 2 + columnNoise) * hc;
|
||||||
for(int y = 0; y < 64; y++) {
|
for(int y = 0; y < 64; y++) {
|
||||||
double finalNoise = (-0.05*Math.abs(y-(heightNoise*16 + 24))+1 - simplex) * hc;
|
double finalNoise = (- 0.05 * Math.abs(y - (heightNoise * 16 + 24)) + 1 - simplex) * hc;
|
||||||
if(finalNoise > 0.5) {
|
if(finalNoise > 0.5) {
|
||||||
c.carve(x-ox, y, z-oz, type);
|
c.carve(x - ox, y, z - oz, type);
|
||||||
double finalNoiseUp = (-0.05*Math.abs((y+1)-(heightNoise*16 + 24))+1 - simplex) * hc;
|
double finalNoiseUp = (- 0.05 * Math.abs((y + 1) - (heightNoise * 16 + 24)) + 1 - simplex) * hc;
|
||||||
if(finalNoiseUp > 0.5) {
|
if(finalNoiseUp > 0.5) {
|
||||||
type = CarvingData.CarvingType.CENTER;
|
type = CarvingData.CarvingType.CENTER;
|
||||||
} else type = CarvingData.CarvingType.TOP;
|
} else type = CarvingData.CarvingType.TOP;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.dfsek.terra.carving;
|
package com.dfsek.terra.carving;
|
||||||
|
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import org.polydev.gaea.math.Range;
|
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.polydev.gaea.generation.GenerationPhase;
|
import org.polydev.gaea.generation.GenerationPhase;
|
||||||
|
import org.polydev.gaea.math.Range;
|
||||||
import org.polydev.gaea.world.carving.Carver;
|
import org.polydev.gaea.world.carving.Carver;
|
||||||
import org.polydev.gaea.world.carving.Worm;
|
import org.polydev.gaea.world.carving.Worm;
|
||||||
|
|
||||||
@@ -36,37 +36,38 @@ public class UserDefinedCarver extends Carver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Worm getWorm(long l, Vector vector) {
|
public Worm getWorm(long l, Vector vector) {
|
||||||
Random r = new Random(l+hash);
|
Random r = new Random(l + hash);
|
||||||
return new UserDefinedWorm((int) (length.get(r)/2), r, vector, radius.getMax(), topCut, bottomCut);
|
return new UserDefinedWorm((int) (length.get(r) / 2), r, vector, radius.getMax(), topCut, bottomCut);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChunkCarved(World w, int chunkX, int chunkZ, Random random) {
|
public boolean isChunkCarved(World w, int chunkX, int chunkZ, Random random) {
|
||||||
ConfigPack c = TerraWorld.getWorld(w).getConfig();
|
ConfigPack c = TerraWorld.getWorld(w).getConfig();
|
||||||
return new Random(random.nextLong()+hash).nextInt(100) < c.getBiome((UserDefinedBiome) TerraWorld.getWorld(w).getGrid().getBiome(chunkX << 4, chunkZ << 4, GenerationPhase.POPULATE)).getCarverChance(this);
|
return new Random(random.nextLong() + hash).nextInt(100) < c.getBiome((UserDefinedBiome) TerraWorld.getWorld(w).getGrid().getBiome(chunkX << 4, chunkZ << 4, GenerationPhase.POPULATE)).getCarverChance(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UserDefinedWorm extends Worm {
|
private class UserDefinedWorm extends Worm {
|
||||||
private final Vector direction;
|
private final Vector direction;
|
||||||
private final int maxRad;
|
private final int maxRad;
|
||||||
private double runningRadius;
|
private double runningRadius;
|
||||||
|
|
||||||
public UserDefinedWorm(int length, Random r, Vector origin, int maxRad, int topCut, int bottomCut) {
|
public UserDefinedWorm(int length, Random r, Vector origin, int maxRad, int topCut, int bottomCut) {
|
||||||
super(length, r, origin);
|
super(length, r, origin);
|
||||||
super.setTopCut(topCut);
|
super.setTopCut(topCut);
|
||||||
super.setBottomCut(bottomCut);
|
super.setBottomCut(bottomCut);
|
||||||
runningRadius = radius.get(r);
|
runningRadius = radius.get(r);
|
||||||
this.maxRad = maxRad;
|
this.maxRad = maxRad;
|
||||||
direction = new Vector((r.nextDouble()-0.5D)*start[0], (r.nextDouble()-0.5D)*start[1], (r.nextDouble()-0.5D)*start[2]).normalize().multiply(2);
|
direction = new Vector((r.nextDouble() - 0.5D) * start[0], (r.nextDouble() - 0.5D) * start[1], (r.nextDouble() - 0.5D) * start[2]).normalize().multiply(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void step() {
|
public void step() {
|
||||||
setRadius(new int[] {(int) (runningRadius*radiusMultiplier[0]), (int) (runningRadius*radiusMultiplier[1]), (int) (runningRadius*radiusMultiplier[2])});
|
setRadius(new int[] {(int) (runningRadius * radiusMultiplier[0]), (int) (runningRadius * radiusMultiplier[1]), (int) (runningRadius * radiusMultiplier[2])});
|
||||||
runningRadius += (getRandom().nextDouble()-0.5)*mutate[3];
|
runningRadius += (getRandom().nextDouble() - 0.5) * mutate[3];
|
||||||
runningRadius = Math.max(Math.min(runningRadius, maxRad), 1);
|
runningRadius = Math.max(Math.min(runningRadius, maxRad), 1);
|
||||||
direction.rotateAroundX(Math.toRadians(getRandom().nextDouble()*mutate[0]*2));
|
direction.rotateAroundX(Math.toRadians(getRandom().nextDouble() * mutate[0] * 2));
|
||||||
direction.rotateAroundY(Math.toRadians(getRandom().nextDouble()*mutate[1]*2));
|
direction.rotateAroundY(Math.toRadians(getRandom().nextDouble() * mutate[1] * 2));
|
||||||
direction.rotateAroundZ(Math.toRadians(getRandom().nextDouble()*mutate[2]*2));
|
direction.rotateAroundZ(Math.toRadians(getRandom().nextDouble() * mutate[2] * 2));
|
||||||
getRunning().add(direction);
|
getRunning().add(direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.command;
|
|||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.config.genconfig.OreConfig;
|
import com.dfsek.terra.config.genconfig.OreConfig;
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class BiomeInfoCommand extends WorldCommand {
|
|||||||
compHeight = i;
|
compHeight = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!changed) {
|
if(! changed) {
|
||||||
snowMessage.append("Y=0")
|
snowMessage.append("Y=0")
|
||||||
.append("-255")
|
.append("-255")
|
||||||
.append(": ")
|
.append(": ")
|
||||||
@@ -104,9 +104,11 @@ public class BiomeInfoCommand extends WorldCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||||
if(!(sender instanceof Player) || !(((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator)) return Collections.emptyList();
|
if(! (sender instanceof Player) || ! (((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||||
|
return Collections.emptyList();
|
||||||
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getBiomeIDs();
|
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getBiomeIDs();
|
||||||
if(args.length == 1) return ids.stream().filter(string -> string.toUpperCase().startsWith(args[0].toUpperCase())).collect(Collectors.toList());
|
if(args.length == 1)
|
||||||
|
return ids.stream().filter(string -> string.toUpperCase().startsWith(args[0].toUpperCase())).collect(Collectors.toList());
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,10 +20,12 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class BiomeLocateCommand extends WorldCommand {
|
public class BiomeLocateCommand extends WorldCommand {
|
||||||
private final boolean tp;
|
private final boolean tp;
|
||||||
|
|
||||||
public BiomeLocateCommand(org.polydev.gaea.command.Command parent, boolean teleport) {
|
public BiomeLocateCommand(org.polydev.gaea.command.Command parent, boolean teleport) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.tp = teleport;
|
this.tp = teleport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||||
String id = args[0];
|
String id = args[0];
|
||||||
@@ -62,9 +64,11 @@ public class BiomeLocateCommand extends WorldCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||||
if(!(sender instanceof Player) || !(((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator)) return Collections.emptyList();
|
if(! (sender instanceof Player) || ! (((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||||
|
return Collections.emptyList();
|
||||||
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getBiomeIDs();
|
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getBiomeIDs();
|
||||||
if(args.length == 1) return ids.stream().filter(string -> string.toUpperCase().startsWith(args[0].toUpperCase())).collect(Collectors.toList());
|
if(args.length == 1)
|
||||||
|
return ids.stream().filter(string -> string.toUpperCase().startsWith(args[0].toUpperCase())).collect(Collectors.toList());
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,9 @@ package com.dfsek.terra.command.structure;
|
|||||||
|
|
||||||
import com.dfsek.terra.Terra;
|
import com.dfsek.terra.Terra;
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import com.dfsek.terra.util.structure.WorldEditUtil;
|
|
||||||
import com.dfsek.terra.structure.Structure;
|
|
||||||
import com.dfsek.terra.structure.InitializationException;
|
import com.dfsek.terra.structure.InitializationException;
|
||||||
|
import com.dfsek.terra.structure.Structure;
|
||||||
|
import com.dfsek.terra.util.structure.WorldEditUtil;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class LocateCommand extends WorldCommand {
|
public class LocateCommand extends WorldCommand {
|
||||||
private final boolean tp;
|
private final boolean tp;
|
||||||
|
|
||||||
public LocateCommand(org.polydev.gaea.command.Command parent, boolean tp) {
|
public LocateCommand(org.polydev.gaea.command.Command parent, boolean tp) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.tp = tp;
|
this.tp = tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||||
String id = args[0];
|
String id = args[0];
|
||||||
@@ -52,8 +54,7 @@ public class LocateCommand extends WorldCommand {
|
|||||||
int finalZ = location.getBlockZ();
|
int finalZ = location.getBlockZ();
|
||||||
Bukkit.getScheduler().runTask(Terra.getInstance(), () -> sender.teleport(new Location(sender.getWorld(), finalX, sender.getLocation().getY(), finalZ)));
|
Bukkit.getScheduler().runTask(Terra.getInstance(), () -> sender.teleport(new Location(sender.getWorld(), finalX, sender.getLocation().getY(), finalZ)));
|
||||||
}
|
}
|
||||||
}
|
} else sender.sendMessage("Unable to locate structure. ");
|
||||||
else sender.sendMessage("Unable to locate structure. ");
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
return true;
|
return true;
|
||||||
@@ -76,9 +77,11 @@ public class LocateCommand extends WorldCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
|
||||||
if(!(sender instanceof Player) || !(((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator)) return Collections.emptyList();
|
if(! (sender instanceof Player) || ! (((Player) sender).getWorld().getGenerator() instanceof TerraChunkGenerator))
|
||||||
|
return Collections.emptyList();
|
||||||
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getStructureIDs();
|
List<String> ids = TerraWorld.getWorld(((Player) sender).getWorld()).getConfig().getStructureIDs();
|
||||||
if(args.length == 1) return ids.stream().filter(string -> string.toUpperCase().startsWith(args[0].toUpperCase())).collect(Collectors.toList());
|
if(args.length == 1)
|
||||||
|
return ids.stream().filter(string -> string.toUpperCase().startsWith(args[0].toUpperCase())).collect(Collectors.toList());
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,18 +19,19 @@ import java.util.logging.Level;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ConfigLoader {
|
public class ConfigLoader {
|
||||||
public static <T extends TerraConfig> Map<String, T> load(Path file, ConfigPack config, Class<T> clazz) {
|
public static <T extends TerraConfig> Map<String, T> load(Path file, ConfigPack config, Class<T> clazz) {
|
||||||
long l = System.nanoTime();
|
long l = System.nanoTime();
|
||||||
Map<String, T> configs = new HashMap<>();
|
Map<String, T> configs = new HashMap<>();
|
||||||
file.toFile().mkdirs();
|
file.toFile().mkdirs();
|
||||||
List<String> ids = new ArrayList<>();
|
List<String> ids = new ArrayList<>();
|
||||||
try (Stream<Path> paths = Files.walk(file)) {
|
try(Stream<Path> paths = Files.walk(file)) {
|
||||||
paths.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
paths.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||||
.forEach(path -> {
|
.forEach(path -> {
|
||||||
try {
|
try {
|
||||||
Constructor<T> c = clazz.getConstructor(File.class, ConfigPack.class);
|
Constructor<T> c = clazz.getConstructor(File.class, ConfigPack.class);
|
||||||
T o = c.newInstance(path.toFile(), config);
|
T o = c.newInstance(path.toFile(), config);
|
||||||
if(ids.contains(o.getID())) LangUtil.log("config.error.duplicate", Level.SEVERE, path.toString());
|
if(ids.contains(o.getID()))
|
||||||
|
LangUtil.log("config.error.duplicate", Level.SEVERE, path.toString());
|
||||||
ids.add(o.getID());
|
ids.add(o.getID());
|
||||||
configs.put(o.getID(), o);
|
configs.put(o.getID(), o);
|
||||||
LangUtil.log("config.loaded", Level.INFO, o.toString(), path.toString());
|
LangUtil.log("config.loaded", Level.INFO, o.toString(), path.toString());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public abstract class TerraConfig extends YamlConfiguration {
|
public abstract class TerraConfig extends YamlConfiguration {
|
||||||
private final ConfigPack config;
|
private final ConfigPack config;
|
||||||
|
|
||||||
public TerraConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public TerraConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
load(file);
|
load(file);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public abstract class TerraConfigSection {
|
public abstract class TerraConfigSection {
|
||||||
private final TerraConfig parent;
|
private final TerraConfig parent;
|
||||||
|
|
||||||
public TerraConfigSection(@NotNull TerraConfig parent) {
|
public TerraConfigSection(@NotNull TerraConfig parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public TerraConfig getParent() {
|
public TerraConfig getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
|
|||||||
@@ -5,19 +5,17 @@ import com.dfsek.terra.carving.UserDefinedCarver;
|
|||||||
import com.dfsek.terra.config.ConfigLoader;
|
import com.dfsek.terra.config.ConfigLoader;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import com.dfsek.terra.config.exception.NotFoundException;
|
import com.dfsek.terra.config.exception.NotFoundException;
|
||||||
import com.dfsek.terra.config.genconfig.TreeConfig;
|
|
||||||
import com.dfsek.terra.config.genconfig.biome.AbstractBiomeConfig;
|
|
||||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
|
||||||
import com.dfsek.terra.config.genconfig.BiomeGridConfig;
|
import com.dfsek.terra.config.genconfig.BiomeGridConfig;
|
||||||
import com.dfsek.terra.config.genconfig.CarverConfig;
|
import com.dfsek.terra.config.genconfig.CarverConfig;
|
||||||
import com.dfsek.terra.config.genconfig.FloraConfig;
|
import com.dfsek.terra.config.genconfig.FloraConfig;
|
||||||
import com.dfsek.terra.config.genconfig.OreConfig;
|
import com.dfsek.terra.config.genconfig.OreConfig;
|
||||||
import com.dfsek.terra.config.genconfig.PaletteConfig;
|
import com.dfsek.terra.config.genconfig.PaletteConfig;
|
||||||
import com.dfsek.terra.config.genconfig.StructureConfig;
|
import com.dfsek.terra.config.genconfig.StructureConfig;
|
||||||
|
import com.dfsek.terra.config.genconfig.TreeConfig;
|
||||||
|
import com.dfsek.terra.config.genconfig.biome.AbstractBiomeConfig;
|
||||||
|
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import com.dfsek.terra.util.StructureTypeEnum;
|
import com.dfsek.terra.util.StructureTypeEnum;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.StructureType;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@@ -83,7 +81,7 @@ public class ConfigPack extends YamlConfiguration {
|
|||||||
load(new File(file, "pack.yml"));
|
load(new File(file, "pack.yml"));
|
||||||
dataFolder = file;
|
dataFolder = file;
|
||||||
|
|
||||||
if(!contains("id")) throw new ConfigException("No ID specified!", "null");
|
if(! contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||||
this.id = getString("id");
|
this.id = getString("id");
|
||||||
|
|
||||||
ores = ConfigLoader.load(new File(file, "ores").toPath(), this, OreConfig.class);
|
ores = ConfigLoader.load(new File(file, "ores").toPath(), this, OreConfig.class);
|
||||||
@@ -104,9 +102,9 @@ public class ConfigPack extends YamlConfiguration {
|
|||||||
|
|
||||||
grids = ConfigLoader.load(new File(file, "grids").toPath(), this, BiomeGridConfig.class);
|
grids = ConfigLoader.load(new File(file, "grids").toPath(), this, BiomeGridConfig.class);
|
||||||
|
|
||||||
zoneFreq = 1f/getInt("frequencies.zone", 1536);
|
zoneFreq = 1f / getInt("frequencies.zone", 1536);
|
||||||
freq1 = 1f/getInt("frequencies.grid-x", 256);
|
freq1 = 1f / getInt("frequencies.grid-x", 256);
|
||||||
freq2 = 1f/getInt("frequencies.grid-z", 512);
|
freq2 = 1f / getInt("frequencies.grid-z", 512);
|
||||||
|
|
||||||
biomeBlend = getBoolean("blend.enable", false);
|
biomeBlend = getBoolean("blend.enable", false);
|
||||||
blendAmp = getInt("blend.amplitude", 8);
|
blendAmp = getInt("blend.amplitude", 8);
|
||||||
@@ -118,7 +116,7 @@ public class ConfigPack extends YamlConfiguration {
|
|||||||
erosionOctaves = getInt("erode.octaves", 3);
|
erosionOctaves = getInt("erode.octaves", 3);
|
||||||
|
|
||||||
octaves = getInt("noise.octaves", 4);
|
octaves = getInt("noise.octaves", 4);
|
||||||
frequency = (float) getDouble("noise.frequency", 1f/96);
|
frequency = (float) getDouble("noise.frequency", 1f / 96);
|
||||||
|
|
||||||
erosionName = getString("erode.grid");
|
erosionName = getString("erode.grid");
|
||||||
|
|
||||||
@@ -152,7 +150,7 @@ public class ConfigPack extends YamlConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LangUtil.log("config-pack.loaded", Level.INFO, getID(), String.valueOf((System.nanoTime() - l)/1000000D));
|
LangUtil.log("config-pack.loaded", Level.INFO, getID(), String.valueOf((System.nanoTime() - l) / 1000000D));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<StructureTypeEnum, StructureConfig> getLocatable() {
|
public Map<StructureTypeEnum, StructureConfig> getLocatable() {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public final class ConfigUtil {
|
|||||||
public static long dataSave; // Period of population data saving, in ticks.
|
public static long dataSave; // Period of population data saving, in ticks.
|
||||||
public static boolean masterDisableCaves;
|
public static boolean masterDisableCaves;
|
||||||
public static FailType failType;
|
public static FailType failType;
|
||||||
|
|
||||||
public static void loadConfig(JavaPlugin main) {
|
public static void loadConfig(JavaPlugin main) {
|
||||||
main.saveDefaultConfig();
|
main.saveDefaultConfig();
|
||||||
main.reloadConfig();
|
main.reloadConfig();
|
||||||
@@ -38,7 +39,7 @@ public final class ConfigUtil {
|
|||||||
LangUtil.load(config.getString("language", "en_us"), main);
|
LangUtil.load(config.getString("language", "en_us"), main);
|
||||||
|
|
||||||
debug = config.getBoolean("debug", false);
|
debug = config.getBoolean("debug", false);
|
||||||
dataSave = Duration.parse(Objects.requireNonNull(config.getString("data-save", "PT6M"))).toMillis()/20L;
|
dataSave = Duration.parse(Objects.requireNonNull(config.getString("data-save", "PT6M"))).toMillis() / 20L;
|
||||||
masterDisableCaves = config.getBoolean("master-disable.caves", false);
|
masterDisableCaves = config.getBoolean("master-disable.caves", false);
|
||||||
|
|
||||||
if(config.getBoolean("dump-default", true)) {
|
if(config.getBoolean("dump-default", true)) {
|
||||||
@@ -70,7 +71,8 @@ public final class ConfigUtil {
|
|||||||
Set<Material> bl = new HashSet<>();
|
Set<Material> bl = new HashSet<>();
|
||||||
for(String s : list) {
|
for(String s : list) {
|
||||||
try {
|
try {
|
||||||
if(bl.contains(Bukkit.createBlockData(s).getMaterial())) Bukkit.getLogger().warning("Duplicate material in " + phase + " list: " + s);
|
if(bl.contains(Bukkit.createBlockData(s).getMaterial()))
|
||||||
|
Bukkit.getLogger().warning("Duplicate material in " + phase + " list: " + s);
|
||||||
bl.add(Bukkit.createBlockData(s).getMaterial());
|
bl.add(Bukkit.createBlockData(s).getMaterial());
|
||||||
} catch(NullPointerException | IllegalArgumentException e) {
|
} catch(NullPointerException | IllegalArgumentException e) {
|
||||||
throw new ConfigException("Could not load BlockData data for \"" + s + "\"", id);
|
throw new ConfigException("Could not load BlockData data for \"" + s + "\"", id);
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ package com.dfsek.terra.config.base;
|
|||||||
import com.dfsek.terra.Debug;
|
import com.dfsek.terra.Debug;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import com.dfsek.terra.config.lang.LangUtil;
|
import com.dfsek.terra.config.lang.LangUtil;
|
||||||
import com.dfsek.terra.debug.gui.DebugGUI;
|
|
||||||
import com.dfsek.terra.image.ImageLoader;
|
import com.dfsek.terra.image.ImageLoader;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.polydev.gaea.GaeaPlugin;
|
import org.polydev.gaea.GaeaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -51,7 +48,8 @@ public class WorldConfig {
|
|||||||
FileConfiguration config = new YamlConfiguration();
|
FileConfiguration config = new YamlConfiguration();
|
||||||
Debug.info("Loading config " + configID + " for world " + worldID);
|
Debug.info("Loading config " + configID + " for world " + worldID);
|
||||||
try { // Load/create world config file
|
try { // Load/create world config file
|
||||||
if(configID == null || configID.equals("")) throw new ConfigException("Config pack unspecified in bukkit.yml!", worldID);
|
if(configID == null || configID.equals(""))
|
||||||
|
throw new ConfigException("Config pack unspecified in bukkit.yml!", worldID);
|
||||||
File configFile = new File(main.getDataFolder() + File.separator + "worlds", worldID + ".yml");
|
File configFile = new File(main.getDataFolder() + File.separator + "worlds", worldID + ".yml");
|
||||||
if(! configFile.exists()) {
|
if(! configFile.exists()) {
|
||||||
configFile.getParentFile().mkdirs();
|
configFile.getParentFile().mkdirs();
|
||||||
@@ -65,7 +63,8 @@ public class WorldConfig {
|
|||||||
|
|
||||||
tConfig = ConfigPack.fromID(configID);
|
tConfig = ConfigPack.fromID(configID);
|
||||||
|
|
||||||
if(tConfig == null) throw new ConfigException("No such config pack: \"" + configID + "\". This pack either does not exist, or failed to load due to configuration errors.", worldID);
|
if(tConfig == null)
|
||||||
|
throw new ConfigException("No such config pack: \"" + configID + "\". This pack either does not exist, or failed to load due to configuration errors.", worldID);
|
||||||
|
|
||||||
// Load image stuff
|
// Load image stuff
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.bukkit.configuration.InvalidConfigurationException;
|
|||||||
public class ConfigException extends InvalidConfigurationException {
|
public class ConfigException extends InvalidConfigurationException {
|
||||||
private final String message;
|
private final String message;
|
||||||
private final String id;
|
private final String id;
|
||||||
|
|
||||||
public ConfigException(String message, String id) {
|
public ConfigException(String message, String id) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -16,6 +17,6 @@ public class ConfigException extends InvalidConfigurationException {
|
|||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
String ex = getStackTrace()[0].getClassName();
|
String ex = getStackTrace()[0].getClassName();
|
||||||
return "Configuration error for " + ex.substring(ex.lastIndexOf(".")+1) + " with ID \"" + id + "\": \n\n" + message;
|
return "Configuration error for " + ex.substring(ex.lastIndexOf(".") + 1) + " with ID \"" + id + "\": \n\n" + message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@ package com.dfsek.terra.config.genconfig;
|
|||||||
|
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.biome.UserDefinedGrid;
|
import com.dfsek.terra.biome.UserDefinedGrid;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.WorldConfig;
|
import com.dfsek.terra.config.base.WorldConfig;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import com.dfsek.terra.config.exception.NotFoundException;
|
import com.dfsek.terra.config.exception.NotFoundException;
|
||||||
@@ -25,9 +25,9 @@ public class BiomeGridConfig extends TerraConfig {
|
|||||||
public BiomeGridConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public BiomeGridConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
load(file);
|
load(file);
|
||||||
if(!contains("id")) throw new ConfigException("Grid ID unspecified!", "null");
|
if(! contains("id")) throw new ConfigException("Grid ID unspecified!", "null");
|
||||||
this.gridID = getString("id");
|
this.gridID = getString("id");
|
||||||
if(!contains("grid")) throw new ConfigException("Grid key not found!", getID());
|
if(! contains("grid")) throw new ConfigException("Grid key not found!", getID());
|
||||||
this.sizeX = Objects.requireNonNull(getList("grid")).size();
|
this.sizeX = Objects.requireNonNull(getList("grid")).size();
|
||||||
this.sizeZ = ((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(0).size();
|
this.sizeZ = ((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(0).size();
|
||||||
gridRaw = new UserDefinedBiome[sizeX][sizeZ];
|
gridRaw = new UserDefinedBiome[sizeX][sizeZ];
|
||||||
@@ -37,11 +37,11 @@ public class BiomeGridConfig extends TerraConfig {
|
|||||||
try {
|
try {
|
||||||
gridRaw[x][z] = config.getBiome(((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(x).get(z)).getBiome();
|
gridRaw[x][z] = config.getBiome(((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(x).get(z)).getBiome();
|
||||||
} catch(NullPointerException e) {
|
} catch(NullPointerException e) {
|
||||||
throw new NotFoundException("Biome",((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(x).get(z), getID());
|
throw new NotFoundException("Biome", ((List<List<String>>) Objects.requireNonNull(getList("grid"))).get(x).get(z), getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(ClassCastException |NullPointerException e) {
|
} catch(ClassCastException | NullPointerException e) {
|
||||||
throw new ConfigException("Malformed grid! Ensure all dimensions are correct.", getID());
|
throw new ConfigException("Malformed grid! Ensure all dimensions are correct.", getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package com.dfsek.terra.config.genconfig;
|
|||||||
|
|
||||||
import com.dfsek.terra.Debug;
|
import com.dfsek.terra.Debug;
|
||||||
import com.dfsek.terra.carving.UserDefinedCarver;
|
import com.dfsek.terra.carving.UserDefinedCarver;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -46,7 +46,7 @@ public class CarverConfig extends TerraConfig {
|
|||||||
public CarverConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public CarverConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
load(file);
|
load(file);
|
||||||
if(!contains("id")) throw new ConfigException("No ID specified for Carver!", "null");
|
if(! contains("id")) throw new ConfigException("No ID specified for Carver!", "null");
|
||||||
id = getString("id");
|
id = getString("id");
|
||||||
|
|
||||||
inner = getBlocks("palette.inner.layers");
|
inner = getBlocks("palette.inner.layers");
|
||||||
@@ -105,7 +105,7 @@ public class CarverConfig extends TerraConfig {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Map<Integer, ProbabilityCollection<BlockData>> getBlocks(String key) throws InvalidConfigurationException {
|
private Map<Integer, ProbabilityCollection<BlockData>> getBlocks(String key) throws InvalidConfigurationException {
|
||||||
if(!contains(key)) throw new ConfigException("Missing Carver Palette!", getID());
|
if(! contains(key)) throw new ConfigException("Missing Carver Palette!", getID());
|
||||||
Map<Integer, ProbabilityCollection<BlockData>> result = new TreeMap<>();
|
Map<Integer, ProbabilityCollection<BlockData>> result = new TreeMap<>();
|
||||||
for(Map<?, ?> m : getMapList(key)) {
|
for(Map<?, ?> m : getMapList(key)) {
|
||||||
try {
|
try {
|
||||||
@@ -133,56 +133,56 @@ public class CarverConfig extends TerraConfig {
|
|||||||
|
|
||||||
public boolean isReplaceableInner(Material m) {
|
public boolean isReplaceableInner(Material m) {
|
||||||
if(replaceIsBlacklistInner) {
|
if(replaceIsBlacklistInner) {
|
||||||
return !replaceableInner.contains(m);
|
return ! replaceableInner.contains(m);
|
||||||
}
|
}
|
||||||
return replaceableInner.contains(m);
|
return replaceableInner.contains(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReplaceableOuter(Material m) {
|
public boolean isReplaceableOuter(Material m) {
|
||||||
if(replaceIsBlacklistOuter) {
|
if(replaceIsBlacklistOuter) {
|
||||||
return !replaceableOuter.contains(m);
|
return ! replaceableOuter.contains(m);
|
||||||
}
|
}
|
||||||
return replaceableOuter.contains(m);
|
return replaceableOuter.contains(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReplaceableTop(Material m) {
|
public boolean isReplaceableTop(Material m) {
|
||||||
if(replaceIsBlacklistTop) {
|
if(replaceIsBlacklistTop) {
|
||||||
return !replaceableTop.contains(m);
|
return ! replaceableTop.contains(m);
|
||||||
}
|
}
|
||||||
return replaceableTop.contains(m);
|
return replaceableTop.contains(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReplaceableBottom(Material m) {
|
public boolean isReplaceableBottom(Material m) {
|
||||||
if(replaceIsBlacklistBottom) {
|
if(replaceIsBlacklistBottom) {
|
||||||
return !replaceableBottom.contains(m);
|
return ! replaceableBottom.contains(m);
|
||||||
}
|
}
|
||||||
return replaceableBottom.contains(m);
|
return replaceableBottom.contains(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProbabilityCollection<BlockData> getPaletteInner(int y) {
|
public ProbabilityCollection<BlockData> getPaletteInner(int y) {
|
||||||
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : inner.entrySet()) {
|
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : inner.entrySet()) {
|
||||||
if(e.getKey() >= y ) return e.getValue();
|
if(e.getKey() >= y) return e.getValue();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProbabilityCollection<BlockData> getPaletteOuter(int y) {
|
public ProbabilityCollection<BlockData> getPaletteOuter(int y) {
|
||||||
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : outer.entrySet()) {
|
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : outer.entrySet()) {
|
||||||
if(e.getKey() >= y ) return e.getValue();
|
if(e.getKey() >= y) return e.getValue();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProbabilityCollection<BlockData> getPaletteBottom(int y) {
|
public ProbabilityCollection<BlockData> getPaletteBottom(int y) {
|
||||||
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : bottom.entrySet()) {
|
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : bottom.entrySet()) {
|
||||||
if(e.getKey() >= y ) return e.getValue();
|
if(e.getKey() >= y) return e.getValue();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProbabilityCollection<BlockData> getPaletteTop(int y) {
|
public ProbabilityCollection<BlockData> getPaletteTop(int y) {
|
||||||
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : top.entrySet()) {
|
for(Map.Entry<Integer, ProbabilityCollection<BlockData>> e : top.entrySet()) {
|
||||||
if(e.getKey() >= y ) return e.getValue();
|
if(e.getKey() >= y) return e.getValue();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.dfsek.terra.config.genconfig;
|
package com.dfsek.terra.config.genconfig;
|
||||||
|
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@@ -34,10 +34,10 @@ public class FloraConfig extends TerraConfig implements Flora {
|
|||||||
public FloraConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public FloraConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
load(file);
|
load(file);
|
||||||
if(!contains("id")) throw new ConfigException("Flora ID unspecified!", "null");
|
if(! contains("id")) throw new ConfigException("Flora ID unspecified!", "null");
|
||||||
this.id = getString("id");
|
this.id = getString("id");
|
||||||
if(!contains("layers")) throw new ConfigException("No blocks defined in custom flora!", getID());
|
if(! contains("layers")) throw new ConfigException("No blocks defined in custom flora!", getID());
|
||||||
if(!contains("spawnable")) throw new ConfigException("Flora spawnable blocks unspecified!", getID());
|
if(! contains("spawnable")) throw new ConfigException("Flora spawnable blocks unspecified!", getID());
|
||||||
|
|
||||||
spawnable = ConfigUtil.toBlockData(getStringList("spawnable"), "spawnable", getID());
|
spawnable = ConfigUtil.toBlockData(getStringList("spawnable"), "spawnable", getID());
|
||||||
replaceable = ConfigUtil.toBlockData(getStringList("replaceable"), "replaceable", getID());
|
replaceable = ConfigUtil.toBlockData(getStringList("replaceable"), "replaceable", getID());
|
||||||
@@ -46,7 +46,7 @@ public class FloraConfig extends TerraConfig implements Flora {
|
|||||||
|
|
||||||
Palette<BlockData> p = new RandomPalette<>(new Random(getInt("seed", 4)));
|
Palette<BlockData> p = new RandomPalette<>(new Random(getInt("seed", 4)));
|
||||||
|
|
||||||
floraPalette = PaletteConfig.getPalette(getMapList("layers"), p);
|
floraPalette = PaletteConfig.getPalette(getMapList("layers"), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
@@ -59,14 +59,15 @@ public class FloraConfig extends TerraConfig implements Flora {
|
|||||||
if(ceiling) for(int y : range) {
|
if(ceiling) for(int y : range) {
|
||||||
if(y > 255 || y < 1) continue;
|
if(y > 255 || y < 1) continue;
|
||||||
Block check = chunk.getBlock(x, y, z);
|
Block check = chunk.getBlock(x, y, z);
|
||||||
Block other = chunk.getBlock(x, y-1, z);
|
Block other = chunk.getBlock(x, y - 1, z);
|
||||||
if(spawnable.contains(check.getType()) && replaceable.contains(other.getType())) {
|
if(spawnable.contains(check.getType()) && replaceable.contains(other.getType())) {
|
||||||
blocks.add(check);
|
blocks.add(check);
|
||||||
}
|
}
|
||||||
} else for(int y : range) {
|
}
|
||||||
|
else for(int y : range) {
|
||||||
if(y > 254 || y < 0) continue;
|
if(y > 254 || y < 0) continue;
|
||||||
Block check = chunk.getBlock(x, y, z);
|
Block check = chunk.getBlock(x, y, z);
|
||||||
Block other = chunk.getBlock(x, y+1, z);
|
Block other = chunk.getBlock(x, y + 1, z);
|
||||||
if(spawnable.contains(check.getType()) && replaceable.contains(other.getType())) {
|
if(spawnable.contains(check.getType()) && replaceable.contains(other.getType())) {
|
||||||
blocks.add(check);
|
blocks.add(check);
|
||||||
}
|
}
|
||||||
@@ -77,14 +78,14 @@ public class FloraConfig extends TerraConfig implements Flora {
|
|||||||
@Override
|
@Override
|
||||||
public boolean plant(Location location) {
|
public boolean plant(Location location) {
|
||||||
int size = floraPalette.getSize();
|
int size = floraPalette.getSize();
|
||||||
int c = ceiling ? -1 : 1;
|
int c = ceiling ? - 1 : 1;
|
||||||
for(int i = 0; Math.abs(i) < size; i+= c) { // Down if ceiling, up if floor
|
for(int i = 0; Math.abs(i) < size; i += c) { // Down if ceiling, up if floor
|
||||||
if(i+1 > 255) return false;
|
if(i + 1 > 255) return false;
|
||||||
if(!replaceable.contains(location.clone().add(0, i+c, 0).getBlock().getType())) return false;
|
if(! replaceable.contains(location.clone().add(0, i + c, 0).getBlock().getType())) return false;
|
||||||
}
|
}
|
||||||
for(int i = 0; Math.abs(i) < size; i+=c) { // Down if ceiling, up if floor
|
for(int i = 0; Math.abs(i) < size; i += c) { // Down if ceiling, up if floor
|
||||||
int lvl = (Math.abs(i));
|
int lvl = (Math.abs(i));
|
||||||
location.clone().add(0, i+c, 0).getBlock().setBlockData(floraPalette.get((ceiling ? lvl : size-lvl-1), location.getBlockX(), location.getBlockZ()), physics);
|
location.clone().add(0, i + c, 0).getBlock().setBlockData(floraPalette.get((ceiling ? lvl : size - lvl - 1), location.getBlockX(), location.getBlockZ()), physics);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.dfsek.terra.config.genconfig;
|
package com.dfsek.terra.config.genconfig;
|
||||||
|
|
||||||
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@@ -34,13 +33,14 @@ public class OreConfig extends TerraConfig {
|
|||||||
private final boolean crossChunks;
|
private final boolean crossChunks;
|
||||||
private final int chunkEdgeOffset;
|
private final int chunkEdgeOffset;
|
||||||
Set<Material> replaceable;
|
Set<Material> replaceable;
|
||||||
|
|
||||||
public OreConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public OreConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
if(!contains("id")) throw new ConfigException("Ore ID not found!", "null");
|
if(! contains("id")) throw new ConfigException("Ore ID not found!", "null");
|
||||||
this.id = getString("id");
|
this.id = getString("id");
|
||||||
if(!contains("material")) throw new ConfigException("Ore material not found!", getID());
|
if(! contains("material")) throw new ConfigException("Ore material not found!", getID());
|
||||||
if(!contains("deform")) throw new ConfigException("Ore vein deformation not found!", getID());
|
if(! contains("deform")) throw new ConfigException("Ore vein deformation not found!", getID());
|
||||||
if(!contains("replace")) throw new ConfigException("Ore replaceable materials not found!", getID());
|
if(! contains("replace")) throw new ConfigException("Ore replaceable materials not found!", getID());
|
||||||
min = getInt("radius.min", 1);
|
min = getInt("radius.min", 1);
|
||||||
max = getInt("radius.max", 1);
|
max = getInt("radius.max", 1);
|
||||||
deform = getDouble("deform", 0.75);
|
deform = getDouble("deform", 0.75);
|
||||||
@@ -49,7 +49,8 @@ public class OreConfig extends TerraConfig {
|
|||||||
crossChunks = getBoolean("cross-chunks", true);
|
crossChunks = getBoolean("cross-chunks", true);
|
||||||
chunkEdgeOffset = getInt("edge-offset", 1);
|
chunkEdgeOffset = getInt("edge-offset", 1);
|
||||||
|
|
||||||
if(chunkEdgeOffset > 7 || chunkEdgeOffset < 0) throw new ConfigException("Edge offset is too high/low!", getID());
|
if(chunkEdgeOffset > 7 || chunkEdgeOffset < 0)
|
||||||
|
throw new ConfigException("Edge offset is too high/low!", getID());
|
||||||
|
|
||||||
replaceable = ConfigUtil.toBlockData(getStringList("replace"), "replaceable", getID());
|
replaceable = ConfigUtil.toBlockData(getStringList("replace"), "replaceable", getID());
|
||||||
|
|
||||||
@@ -61,8 +62,9 @@ public class OreConfig extends TerraConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int randomInRange(Random r) {
|
private int randomInRange(Random r) {
|
||||||
return r.nextInt(max-min+1)+min;
|
return r.nextInt(max - min + 1) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doVein(Vector l, Chunk chunk, Random r) {
|
public void doVein(Vector l, Chunk chunk, Random r) {
|
||||||
FastNoiseLite ore = new FastNoiseLite(r.nextInt());
|
FastNoiseLite ore = new FastNoiseLite(r.nextInt());
|
||||||
ore.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
ore.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
@@ -71,35 +73,39 @@ public class OreConfig extends TerraConfig {
|
|||||||
Map<ChunkCoordinate, Chunk> chunks = new HashMap<>(); // Cache chunks to prevent re-loading chunks every time one is needed.
|
Map<ChunkCoordinate, Chunk> chunks = new HashMap<>(); // Cache chunks to prevent re-loading chunks every time one is needed.
|
||||||
chunks.put(new ChunkCoordinate(chunk), chunk);
|
chunks.put(new ChunkCoordinate(chunk), chunk);
|
||||||
Vector orig = new Vector(l.getBlockX() + (chunk.getX() << 4), l.getBlockY(), l.getBlockZ() + (chunk.getZ() << 4));
|
Vector orig = new Vector(l.getBlockX() + (chunk.getX() << 4), l.getBlockY(), l.getBlockZ() + (chunk.getZ() << 4));
|
||||||
for(int x = -rad; x <= rad; x++) {
|
for(int x = - rad; x <= rad; x++) {
|
||||||
for(int y = -rad; y <= rad; y++) {
|
for(int y = - rad; y <= rad; y++) {
|
||||||
for(int z = -rad; z <= rad; z++) {
|
for(int z = - rad; z <= rad; z++) {
|
||||||
Vector oreLoc = orig.clone().add(new Vector(x, y, z));
|
Vector oreLoc = orig.clone().add(new Vector(x, y, z));
|
||||||
Vector source = l.clone().add(new Vector(x, y, z));
|
Vector source = l.clone().add(new Vector(x, y, z));
|
||||||
if(oreLoc.getBlockY() > 255 || oreLoc.getBlockY() < 0) continue;
|
if(oreLoc.getBlockY() > 255 || oreLoc.getBlockY() < 0) continue;
|
||||||
if(source.distance(l) < (rad + 0.5) * ((ore.getNoise(x, y, z)+1)*deform)) {
|
if(source.distance(l) < (rad + 0.5) * ((ore.getNoise(x, y, z) + 1) * deform)) {
|
||||||
ChunkCoordinate coord = new ChunkCoordinate(Math.floorDiv(oreLoc.getBlockX(), 16), Math.floorDiv(oreLoc.getBlockZ(), 16), chunk.getWorld().getUID());
|
ChunkCoordinate coord = new ChunkCoordinate(Math.floorDiv(oreLoc.getBlockX(), 16), Math.floorDiv(oreLoc.getBlockZ(), 16), chunk.getWorld().getUID());
|
||||||
Block b = chunks.computeIfAbsent(coord, k -> chunk.getWorld().getChunkAt(oreLoc.toLocation(chunk.getWorld())))
|
Block b = chunks.computeIfAbsent(coord, k -> chunk.getWorld().getChunkAt(oreLoc.toLocation(chunk.getWorld())))
|
||||||
.getBlock(Math.floorMod(source.getBlockX(), 16), source.getBlockY(), Math.floorMod(source.getBlockZ(), 16)); // Chunk caching conditional computation
|
.getBlock(Math.floorMod(source.getBlockX(), 16), source.getBlockY(), Math.floorMod(source.getBlockZ(), 16)); // Chunk caching conditional computation
|
||||||
if(replaceable.contains(b.getType()) && b.getLocation().getY() >= 0) b.setBlockData(oreData, update);
|
if(replaceable.contains(b.getType()) && b.getLocation().getY() >= 0)
|
||||||
|
b.setBlockData(oreData, update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doVeinSingle(Vector l, Chunk chunk, Random r) {
|
public void doVeinSingle(Vector l, Chunk chunk, Random r) {
|
||||||
FastNoiseLite ore = new FastNoiseLite(r.nextInt());
|
FastNoiseLite ore = new FastNoiseLite(r.nextInt());
|
||||||
ore.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
ore.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
ore.setFrequency((float) deformFrequency);
|
ore.setFrequency((float) deformFrequency);
|
||||||
int rad = randomInRange(r);
|
int rad = randomInRange(r);
|
||||||
for(int x = -rad; x <= rad; x++) {
|
for(int x = - rad; x <= rad; x++) {
|
||||||
for(int y = -rad; y <= rad; y++) {
|
for(int y = - rad; y <= rad; y++) {
|
||||||
for(int z = -rad; z <= rad; z++) {
|
for(int z = - rad; z <= rad; z++) {
|
||||||
Vector oreLoc = l.clone().add(new Vector(x, y, z));
|
Vector oreLoc = l.clone().add(new Vector(x, y, z));
|
||||||
if(oreLoc.getBlockX() > 15 || oreLoc.getBlockZ() > 15 || oreLoc.getBlockY() > 255 || oreLoc.getBlockX() < 0 || oreLoc.getBlockZ() < 0 || oreLoc.getBlockY() < 0) continue;
|
if(oreLoc.getBlockX() > 15 || oreLoc.getBlockZ() > 15 || oreLoc.getBlockY() > 255 || oreLoc.getBlockX() < 0 || oreLoc.getBlockZ() < 0 || oreLoc.getBlockY() < 0)
|
||||||
if(oreLoc.distance(l) < (rad + 0.5) * ((ore.getNoise(x, y, z)+1)*deform)) {
|
continue;
|
||||||
|
if(oreLoc.distance(l) < (rad + 0.5) * ((ore.getNoise(x, y, z) + 1) * deform)) {
|
||||||
Block b = chunk.getBlock(oreLoc.getBlockX(), oreLoc.getBlockY(), oreLoc.getBlockZ());
|
Block b = chunk.getBlock(oreLoc.getBlockX(), oreLoc.getBlockY(), oreLoc.getBlockZ());
|
||||||
if(replaceable.contains(b.getType()) && b.getLocation().getY() >= 0) b.setBlockData(oreData, update);
|
if(replaceable.contains(b.getType()) && b.getLocation().getY() >= 0)
|
||||||
|
b.setBlockData(oreData, update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.dfsek.terra.config.genconfig;
|
package com.dfsek.terra.config.genconfig;
|
||||||
|
|
||||||
import com.dfsek.terra.Debug;
|
import com.dfsek.terra.Debug;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@@ -23,9 +23,10 @@ public class PaletteConfig extends TerraConfig {
|
|||||||
private final Palette<BlockData> palette;
|
private final Palette<BlockData> palette;
|
||||||
private final String paletteID;
|
private final String paletteID;
|
||||||
private boolean useNoise = false;
|
private boolean useNoise = false;
|
||||||
|
|
||||||
public PaletteConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public PaletteConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
if(!contains("id")) throw new ConfigException("Palette ID unspecified!", "null");
|
if(! contains("id")) throw new ConfigException("Palette ID unspecified!", "null");
|
||||||
this.paletteID = getString("id");
|
this.paletteID = getString("id");
|
||||||
Palette<BlockData> pal;
|
Palette<BlockData> pal;
|
||||||
if(getBoolean("simplex", false)) {
|
if(getBoolean("simplex", false)) {
|
||||||
@@ -63,7 +64,7 @@ public class PaletteConfig extends TerraConfig {
|
|||||||
} else {
|
} else {
|
||||||
Debug.info("One-block palette layer!");
|
Debug.info("One-block palette layer!");
|
||||||
String data = "null";
|
String data = "null";
|
||||||
for(Map.Entry<?, ?> e: map.get(0).entrySet()) {
|
for(Map.Entry<?, ?> e : map.get(0).entrySet()) {
|
||||||
data = (String) e.getKey();
|
data = (String) e.getKey();
|
||||||
}
|
}
|
||||||
p.add(Bukkit.createBlockData(data), (Integer) m.get("layers"));
|
p.add(Bukkit.createBlockData(data), (Integer) m.get("layers"));
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.dfsek.terra.config.genconfig;
|
package com.dfsek.terra.config.genconfig;
|
||||||
|
|
||||||
import com.dfsek.terra.Debug;
|
import com.dfsek.terra.Debug;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import com.dfsek.terra.config.exception.NotFoundException;
|
import com.dfsek.terra.config.exception.NotFoundException;
|
||||||
@@ -32,11 +32,12 @@ public class StructureConfig extends TerraConfig {
|
|||||||
private final Range bound;
|
private final Range bound;
|
||||||
private final Map<Integer, LootTable> loot = new HashMap<>();
|
private final Map<Integer, LootTable> loot = new HashMap<>();
|
||||||
StructurePopulator.SearchType type;
|
StructurePopulator.SearchType type;
|
||||||
|
|
||||||
public StructureConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public StructureConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
if(!contains("id")) throw new ConfigException("No ID specified!", "null");
|
if(! contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||||
id = getString("id");
|
id = getString("id");
|
||||||
if(!contains("files")) throw new ConfigException("No files specified!", getID());
|
if(! contains("files")) throw new ConfigException("No files specified!", getID());
|
||||||
try {
|
try {
|
||||||
for(Map.Entry<String, Object> e : Objects.requireNonNull(getConfigurationSection("files")).getValues(false).entrySet()) {
|
for(Map.Entry<String, Object> e : Objects.requireNonNull(getConfigurationSection("files")).getValues(false).entrySet()) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ public class TreeConfig extends TerraConfig implements Tree {
|
|||||||
private final String id;
|
private final String id;
|
||||||
private final int yOffset;
|
private final int yOffset;
|
||||||
private final ProbabilityCollection<Structure> structure = new ProbabilityCollection<>();
|
private final ProbabilityCollection<Structure> structure = new ProbabilityCollection<>();
|
||||||
|
|
||||||
public TreeConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public TreeConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
spawnable = ConfigUtil.toBlockData(getStringList("spawnable"), "spawnable", getID());
|
spawnable = ConfigUtil.toBlockData(getStringList("spawnable"), "spawnable", getID());
|
||||||
if(!contains("id")) throw new ConfigException("No ID specified!", "null");
|
if(! contains("id")) throw new ConfigException("No ID specified!", "null");
|
||||||
id = getString("id");
|
id = getString("id");
|
||||||
if(!contains("files")) throw new ConfigException("No files specified!", getID());
|
if(! contains("files")) throw new ConfigException("No files specified!", getID());
|
||||||
yOffset = getInt("y-offset", 0);
|
yOffset = getInt("y-offset", 0);
|
||||||
try {
|
try {
|
||||||
for(Map.Entry<String, Object> e : Objects.requireNonNull(getConfigurationSection("files")).getValues(false).entrySet()) {
|
for(Map.Entry<String, Object> e : Objects.requireNonNull(getConfigurationSection("files")).getValues(false).entrySet()) {
|
||||||
@@ -64,10 +65,10 @@ public class TreeConfig extends TerraConfig implements Tree {
|
|||||||
public boolean plant(Location location, Random random, JavaPlugin javaPlugin) {
|
public boolean plant(Location location, Random random, JavaPlugin javaPlugin) {
|
||||||
location.subtract(0, 1, 0);
|
location.subtract(0, 1, 0);
|
||||||
Location mut = location.clone().subtract(0, yOffset, 0);
|
Location mut = location.clone().subtract(0, yOffset, 0);
|
||||||
if(!spawnable.contains(location.getBlock().getType())) return false;
|
if(! spawnable.contains(location.getBlock().getType())) return false;
|
||||||
Structure struc = structure.get(random);
|
Structure struc = structure.get(random);
|
||||||
Structure.Rotation rotation = Structure.Rotation.fromDegrees(random.nextInt(4) * 90);
|
Structure.Rotation rotation = Structure.Rotation.fromDegrees(random.nextInt(4) * 90);
|
||||||
if(!struc.checkSpawns(mut, rotation)) return false;
|
if(! struc.checkSpawns(mut, rotation)) return false;
|
||||||
struc.paste(mut, rotation);
|
struc.paste(mut, rotation);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.dfsek.terra.config.genconfig.biome;
|
package com.dfsek.terra.config.genconfig.biome;
|
||||||
|
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class AbstractBiomeConfig extends TerraConfig {
|
public class AbstractBiomeConfig extends TerraConfig {
|
||||||
private final String biomeID;
|
private final String biomeID;
|
||||||
@@ -27,7 +26,7 @@ public class AbstractBiomeConfig extends TerraConfig {
|
|||||||
public AbstractBiomeConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
public AbstractBiomeConfig(File file, ConfigPack config) throws IOException, InvalidConfigurationException {
|
||||||
super(file, config);
|
super(file, config);
|
||||||
load(file);
|
load(file);
|
||||||
if(!contains("id")) throw new ConfigException("Abstract Biome ID unspecified!", "null");
|
if(! contains("id")) throw new ConfigException("Abstract Biome ID unspecified!", "null");
|
||||||
this.biomeID = getString("id");
|
this.biomeID = getString("id");
|
||||||
|
|
||||||
equation = getString("noise-equation");
|
equation = getString("noise-equation");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BiomeCarverConfig extends TerraConfigSection {
|
public class BiomeCarverConfig extends TerraConfigSection {
|
||||||
private final Map<CarverConfig, Integer> carvers = new HashMap<>();
|
private final Map<CarverConfig, Integer> carvers = new HashMap<>();
|
||||||
|
|
||||||
public BiomeCarverConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeCarverConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
ConfigurationSection configurationSection = parent.getConfigurationSection("carving");
|
ConfigurationSection configurationSection = parent.getConfigurationSection("carving");
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
super(file, config);
|
super(file, config);
|
||||||
load(file);
|
load(file);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
if(!contains("id")) throw new ConfigException("Biome ID unspecified!", "null");
|
if(! contains("id")) throw new ConfigException("Biome ID unspecified!", "null");
|
||||||
this.biomeID = getString("id");
|
this.biomeID = getString("id");
|
||||||
|
|
||||||
AbstractBiomeConfig abstractBiome = null;
|
AbstractBiomeConfig abstractBiome = null;
|
||||||
@@ -76,7 +76,8 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
} else palette = new BiomePaletteConfig(this);
|
} else palette = new BiomePaletteConfig(this);
|
||||||
|
|
||||||
// Palette must not be null
|
// Palette must not be null
|
||||||
if(palette.getPaletteMap() == null) throw new ConfigException("No Palette specified in biome or super biome.", getID());
|
if(palette.getPaletteMap() == null)
|
||||||
|
throw new ConfigException("No Palette specified in biome or super biome.", getID());
|
||||||
|
|
||||||
// Check if carving should be handled by super biome.
|
// Check if carving should be handled by super biome.
|
||||||
if(extending && abstractBiome.getCarving() != null && ! contains("carving")) {
|
if(extending && abstractBiome.getCarving() != null && ! contains("carving")) {
|
||||||
@@ -103,7 +104,7 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
} else ore = new BiomeOreConfig(this);
|
} else ore = new BiomeOreConfig(this);
|
||||||
|
|
||||||
// Get slab stuff
|
// Get slab stuff
|
||||||
if(extending && abstractBiome.getSlabs() != null && !contains("slabs")) {
|
if(extending && abstractBiome.getSlabs() != null && ! contains("slabs")) {
|
||||||
slab = abstractBiome.getSlabs();
|
slab = abstractBiome.getSlabs();
|
||||||
Debug.info("Using super slabs");
|
Debug.info("Using super slabs");
|
||||||
} else slab = new BiomeSlabConfig(this);
|
} else slab = new BiomeSlabConfig(this);
|
||||||
@@ -121,7 +122,8 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
} else snow = new BiomeSnowConfig(this);
|
} else snow = new BiomeSnowConfig(this);
|
||||||
|
|
||||||
//Make sure equation is non-null
|
//Make sure equation is non-null
|
||||||
if(eq == null || eq.equals("")) throw new ConfigException("Could not find noise equation! Biomes must include a noise equation, or extend an abstract biome with one.", getID());
|
if(eq == null || eq.equals(""))
|
||||||
|
throw new ConfigException("Could not find noise equation! Biomes must include a noise equation, or extend an abstract biome with one.", getID());
|
||||||
|
|
||||||
// Create decorator for this config.
|
// Create decorator for this config.
|
||||||
UserDefinedDecorator dec = new UserDefinedDecorator(flora.getFlora(), tree.getTrees(), flora.getFloraChance(), tree.getTreeDensity());
|
UserDefinedDecorator dec = new UserDefinedDecorator(flora.getFlora(), tree.getTrees(), flora.getFloraChance(), tree.getTreeDensity());
|
||||||
@@ -129,7 +131,7 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
// Get Vanilla biome, throw exception if it is invalid/unspecified.
|
// Get Vanilla biome, throw exception if it is invalid/unspecified.
|
||||||
org.bukkit.block.Biome vanillaBiome;
|
org.bukkit.block.Biome vanillaBiome;
|
||||||
try {
|
try {
|
||||||
if(!contains("vanilla")) throw new ConfigException("Vanilla Biome unspecified!", getID());
|
if(! contains("vanilla")) throw new ConfigException("Vanilla Biome unspecified!", getID());
|
||||||
vanillaBiome = org.bukkit.block.Biome.valueOf(getString("vanilla"));
|
vanillaBiome = org.bukkit.block.Biome.valueOf(getString("vanilla"));
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
throw new ConfigException("Invalid Vanilla biome: \"" + getString("vanilla") + "\"", getID());
|
throw new ConfigException("Invalid Vanilla biome: \"" + getString("vanilla") + "\"", getID());
|
||||||
@@ -138,7 +140,8 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
// Structure stuff
|
// Structure stuff
|
||||||
structures = new ArrayList<>();
|
structures = new ArrayList<>();
|
||||||
List<String> st = new ArrayList<>();
|
List<String> st = new ArrayList<>();
|
||||||
if(abstractBiome != null && abstractBiome.getStructureConfigs() != null) st = abstractBiome.getStructureConfigs();
|
if(abstractBiome != null && abstractBiome.getStructureConfigs() != null)
|
||||||
|
st = abstractBiome.getStructureConfigs();
|
||||||
if(contains("structures")) st = getStringList("structures");
|
if(contains("structures")) st = getStringList("structures");
|
||||||
for(String s : st) {
|
for(String s : st) {
|
||||||
try {
|
try {
|
||||||
@@ -170,7 +173,7 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Range getFloraHeights(Flora f) {
|
public Range getFloraHeights(Flora f) {
|
||||||
return flora.getFloraHeights().computeIfAbsent(f, input -> new Range(-1, -1));
|
return flora.getFloraHeights().computeIfAbsent(f, input -> new Range(- 1, - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -199,7 +202,7 @@ public class BiomeConfig extends TerraConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Range getTreeRange(Tree t) {
|
public Range getTreeRange(Tree t) {
|
||||||
return tree.getTreeHeights().getOrDefault(t, new Range(-1, -1));
|
return tree.getTreeHeights().getOrDefault(t, new Range(- 1, - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeSnowConfig getSnow() {
|
public BiomeSnowConfig getSnow() {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class BiomeFloraConfig extends TerraConfigSection {
|
|||||||
private int floraChance;
|
private int floraChance;
|
||||||
private boolean floraSimplex;
|
private boolean floraSimplex;
|
||||||
private FastNoiseLite floraNoise;
|
private FastNoiseLite floraNoise;
|
||||||
|
|
||||||
public BiomeFloraConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeFloraConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
ConfigurationSection cfg = parent.getConfigurationSection("flora.items");
|
ConfigurationSection cfg = parent.getConfigurationSection("flora.items");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class BiomeOceanConfig extends TerraConfigSection {
|
|||||||
private final Palette<BlockData> ocean;
|
private final Palette<BlockData> ocean;
|
||||||
private final int seaLevel;
|
private final int seaLevel;
|
||||||
private static final Palette<BlockData> oceanDefault = new RandomPalette<BlockData>(new Random(0)).add(Material.WATER.createBlockData(), 1);
|
private static final Palette<BlockData> oceanDefault = new RandomPalette<BlockData>(new Random(0)).add(Material.WATER.createBlockData(), 1);
|
||||||
|
|
||||||
public BiomeOceanConfig(@NotNull TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeOceanConfig(@NotNull TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
seaLevel = parent.getInt("ocean.level", 62);
|
seaLevel = parent.getInt("ocean.level", 62);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import java.util.Map;
|
|||||||
public class BiomeOreConfig extends TerraConfigSection {
|
public class BiomeOreConfig extends TerraConfigSection {
|
||||||
private final Map<OreConfig, Range> ores = new HashMap<>();
|
private final Map<OreConfig, Range> ores = new HashMap<>();
|
||||||
private final Map<OreConfig, Range> oreHeights = new HashMap<>();
|
private final Map<OreConfig, Range> oreHeights = new HashMap<>();
|
||||||
|
|
||||||
public BiomeOreConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeOreConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
ConfigurationSection c = parent.getConfigurationSection("ores");
|
ConfigurationSection c = parent.getConfigurationSection("ores");
|
||||||
@@ -25,8 +26,8 @@ public class BiomeOreConfig extends TerraConfigSection {
|
|||||||
for(Map.Entry<String, Object> m : cfg.entrySet()) {
|
for(Map.Entry<String, Object> m : cfg.entrySet()) {
|
||||||
OreConfig ore = parent.getConfig().getOre(m.getKey());
|
OreConfig ore = parent.getConfig().getOre(m.getKey());
|
||||||
if(ore == null) throw new NotFoundException("Ore", m.getKey(), parent.getID());
|
if(ore == null) throw new NotFoundException("Ore", m.getKey(), parent.getID());
|
||||||
ores.put(ore, new Range(((ConfigurationSection) m.getValue()).getInt("min"), ((ConfigurationSection) m.getValue()).getInt("max")));
|
ores.put(ore, new Range(((ConfigurationSection) m.getValue()).getInt("min"), ((ConfigurationSection) m.getValue()).getInt("max")));
|
||||||
oreHeights.put(ore, new Range(((ConfigurationSection) m.getValue()).getInt("min-height"), ((ConfigurationSection) m.getValue()).getInt("max-height")));
|
oreHeights.put(ore, new Range(((ConfigurationSection) m.getValue()).getInt("min-height"), ((ConfigurationSection) m.getValue()).getInt("max-height")));
|
||||||
}
|
}
|
||||||
} catch(ClassCastException e) {
|
} catch(ClassCastException e) {
|
||||||
if(ConfigUtil.debug) e.printStackTrace();
|
if(ConfigUtil.debug) e.printStackTrace();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.dfsek.terra.config.exception.ConfigException;
|
|||||||
import com.dfsek.terra.config.exception.NotFoundException;
|
import com.dfsek.terra.config.exception.NotFoundException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.polydev.gaea.math.ProbabilityCollection;
|
import org.polydev.gaea.math.ProbabilityCollection;
|
||||||
import org.polydev.gaea.world.palette.Palette;
|
import org.polydev.gaea.world.palette.Palette;
|
||||||
@@ -19,6 +18,7 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
public class BiomePaletteConfig extends TerraConfigSection {
|
public class BiomePaletteConfig extends TerraConfigSection {
|
||||||
private TreeMap<Integer, Palette<BlockData>> paletteMap;
|
private TreeMap<Integer, Palette<BlockData>> paletteMap;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public BiomePaletteConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomePaletteConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
@@ -34,8 +34,7 @@ public class BiomePaletteConfig extends TerraConfigSection {
|
|||||||
} catch(IllegalArgumentException ex) {
|
} catch(IllegalArgumentException ex) {
|
||||||
throw new ConfigException("BlockData " + entry.getKey() + " is invalid! (Palettes)", parent.getID());
|
throw new ConfigException("BlockData " + entry.getKey() + " is invalid! (Palettes)", parent.getID());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
paletteMap.put((Integer) entry.getValue(), parent.getConfig().getPalette((String) entry.getKey()).getPalette());
|
paletteMap.put((Integer) entry.getValue(), parent.getConfig().getPalette((String) entry.getKey()).getPalette());
|
||||||
} catch(NullPointerException ex) {
|
} catch(NullPointerException ex) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public class BiomeSlabConfig extends TerraConfigSection {
|
|||||||
private final Map<Material, Palette<BlockData>> slabs;
|
private final Map<Material, Palette<BlockData>> slabs;
|
||||||
private final Map<Material, Palette<BlockData>> stairs;
|
private final Map<Material, Palette<BlockData>> stairs;
|
||||||
private double slabThreshold;
|
private double slabThreshold;
|
||||||
|
|
||||||
public BiomeSlabConfig(@NotNull TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeSlabConfig(@NotNull TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
slabThreshold = parent.getDouble("slabs.threshold", 0.1D);
|
slabThreshold = parent.getDouble("slabs.threshold", 0.1D);
|
||||||
@@ -31,6 +32,7 @@ public class BiomeSlabConfig extends TerraConfigSection {
|
|||||||
stairs = getSlabPalettes(parent.getMapList("slabs.stair-palettes"));
|
stairs = getSlabPalettes(parent.getMapList("slabs.stair-palettes"));
|
||||||
} else stairs = new HashMap<>();
|
} else stairs = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<Material, Palette<BlockData>> getSlabPalettes(List<Map<?, ?>> paletteConfigSection) throws InvalidConfigurationException {
|
protected Map<Material, Palette<BlockData>> getSlabPalettes(List<Map<?, ?>> paletteConfigSection) throws InvalidConfigurationException {
|
||||||
Map<Material, Palette<BlockData>> paletteMap = new HashMap<>();
|
Map<Material, Palette<BlockData>> paletteMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -47,7 +49,8 @@ public class BiomeSlabConfig extends TerraConfigSection {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Palette<BlockData> p = getParent().getConfig().getPalette((String) entry.getValue()).getPalette();
|
Palette<BlockData> p = getParent().getConfig().getPalette((String) entry.getValue()).getPalette();
|
||||||
if(p.getSize() != 1) throw new InvalidConfigurationException("Slab palette must hold only one layer. Palette " + entry.getValue() + " is too large/small");
|
if(p.getSize() != 1)
|
||||||
|
throw new InvalidConfigurationException("Slab palette must hold only one layer. Palette " + entry.getValue() + " is too large/small");
|
||||||
paletteMap.put(Bukkit.createBlockData((String) entry.getKey()).getMaterial(), p);
|
paletteMap.put(Bukkit.createBlockData((String) entry.getKey()).getMaterial(), p);
|
||||||
} catch(NullPointerException ex) {
|
} catch(NullPointerException ex) {
|
||||||
throw new NotFoundException("Slab Palette", (String) entry.getValue(), getParent().getConfig().getID());
|
throw new NotFoundException("Slab Palette", (String) entry.getValue(), getParent().getConfig().getID());
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
package com.dfsek.terra.config.genconfig.biome;
|
package com.dfsek.terra.config.genconfig.biome;
|
||||||
|
|
||||||
import com.dfsek.terra.Debug;
|
|
||||||
import com.dfsek.terra.config.TerraConfig;
|
import com.dfsek.terra.config.TerraConfig;
|
||||||
import com.dfsek.terra.config.TerraConfigSection;
|
import com.dfsek.terra.config.TerraConfigSection;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.exception.ConfigException;
|
import com.dfsek.terra.config.exception.ConfigException;
|
||||||
import com.dfsek.terra.config.exception.NotFoundException;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
|
||||||
import org.polydev.gaea.math.ProbabilityCollection;
|
|
||||||
import org.polydev.gaea.math.Range;
|
import org.polydev.gaea.math.Range;
|
||||||
import org.polydev.gaea.world.Flora;
|
|
||||||
import org.polydev.gaea.world.FloraType;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BiomeSnowConfig extends TerraConfigSection {
|
public class BiomeSnowConfig extends TerraConfigSection {
|
||||||
private final int[] snowHeights;
|
private final int[] snowHeights;
|
||||||
private boolean doSnow = false;
|
private boolean doSnow = false;
|
||||||
|
|
||||||
public BiomeSnowConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeSnowConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
snowHeights = new int[256];
|
snowHeights = new int[256];
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.polydev.gaea.math.ProbabilityCollection;
|
|||||||
import org.polydev.gaea.math.Range;
|
import org.polydev.gaea.math.Range;
|
||||||
import org.polydev.gaea.tree.Tree;
|
import org.polydev.gaea.tree.Tree;
|
||||||
import org.polydev.gaea.tree.TreeType;
|
import org.polydev.gaea.tree.TreeType;
|
||||||
import org.polydev.gaea.world.Flora;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -19,6 +18,7 @@ public class BiomeTreeConfig extends TerraConfigSection {
|
|||||||
private final ProbabilityCollection<Tree> trees = new ProbabilityCollection<>();
|
private final ProbabilityCollection<Tree> trees = new ProbabilityCollection<>();
|
||||||
private final Map<Tree, Range> treeHeights = new HashMap<>();
|
private final Map<Tree, Range> treeHeights = new HashMap<>();
|
||||||
private int treeDensity;
|
private int treeDensity;
|
||||||
|
|
||||||
public BiomeTreeConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeTreeConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
super(parent);
|
||||||
ConfigurationSection c = parent.getConfigurationSection("trees.items");
|
ConfigurationSection c = parent.getConfigurationSection("trees.items");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import static org.polydev.gaea.util.JarUtil.copyResourcesToDirectory;
|
|||||||
public final class LangUtil {
|
public final class LangUtil {
|
||||||
private static Language language;
|
private static Language language;
|
||||||
private static Logger logger;
|
private static Logger logger;
|
||||||
|
|
||||||
public static void load(String langID, JavaPlugin main) {
|
public static void load(String langID, JavaPlugin main) {
|
||||||
logger = main.getLogger();
|
logger = main.getLogger();
|
||||||
File file = new File(main.getDataFolder(), "lang");
|
File file = new File(main.getDataFolder(), "lang");
|
||||||
@@ -45,6 +46,7 @@ public final class LangUtil {
|
|||||||
public static void log(String messageID, Level level, String... args) {
|
public static void log(String messageID, Level level, String... args) {
|
||||||
language.getMessage(messageID).log(logger, level, args);
|
language.getMessage(messageID).log(logger, level, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void send(String messageID, CommandSender sender, String... args) {
|
public static void send(String messageID, CommandSender sender, String... args) {
|
||||||
language.getMessage(messageID).send(sender, args);
|
language.getMessage(messageID).send(sender, args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.dfsek.terra.debug.gui;
|
package com.dfsek.terra.debug.gui;
|
||||||
|
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
|
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||||
import com.dfsek.terra.image.ImageLoader;
|
import com.dfsek.terra.image.ImageLoader;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -18,6 +18,7 @@ public class DebugFrame extends JFrame implements ActionListener {
|
|||||||
private final int x;
|
private final int x;
|
||||||
private final int z;
|
private final int z;
|
||||||
private final BufferedImage img;
|
private final BufferedImage img;
|
||||||
|
|
||||||
public DebugFrame(BufferedImage image, String s) {
|
public DebugFrame(BufferedImage image, String s) {
|
||||||
super(s);
|
super(s);
|
||||||
this.x = image.getWidth();
|
this.x = image.getWidth();
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import java.awt.image.BufferedImage;
|
|||||||
public class DebugGUI extends Thread {
|
public class DebugGUI extends Thread {
|
||||||
|
|
||||||
private final BufferedImage img;
|
private final BufferedImage img;
|
||||||
|
|
||||||
public DebugGUI(BufferedImage img) {
|
public DebugGUI(BufferedImage img) {
|
||||||
this.img = img;
|
this.img = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DebugFrame frame = new DebugFrame(img, "Image2Map Debug GUI");
|
DebugFrame frame = new DebugFrame(img, "Image2Map Debug GUI");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class OreVeinGenerateEvent extends TerraWorldEvent implements Cancellable
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private OreConfig config;
|
private OreConfig config;
|
||||||
|
|
||||||
public OreVeinGenerateEvent(TerraWorld tw, Location l, OreConfig config) {
|
public OreVeinGenerateEvent(TerraWorld tw, Location l, OreConfig config) {
|
||||||
super(tw, l);
|
super(tw, l);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.dfsek.terra.event;
|
package com.dfsek.terra.event;
|
||||||
|
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.config.genconfig.TreeConfig;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.polydev.gaea.tree.Tree;
|
import org.polydev.gaea.tree.Tree;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
StructureSpawnRequirement.putNoise(world, fastNoise); // Assign noise to world to be used for structures.
|
StructureSpawnRequirement.putNoise(world, fastNoise); // Assign noise to world to be used for structures.
|
||||||
ChunkData chunk = createChunkData(world);
|
ChunkData chunk = createChunkData(world);
|
||||||
TerraWorld tw = TerraWorld.getWorld(world);
|
TerraWorld tw = TerraWorld.getWorld(world);
|
||||||
if(!tw.isSafe()) return chunk;
|
if(! tw.isSafe()) return chunk;
|
||||||
ConfigPack config = tw.getConfig();
|
ConfigPack config = tw.getConfig();
|
||||||
int xOrig = (chunkX << 4);
|
int xOrig = (chunkX << 4);
|
||||||
int zOrig = (chunkZ << 4);
|
int zOrig = (chunkZ << 4);
|
||||||
@@ -77,22 +77,22 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
int paletteLevel = 0;
|
int paletteLevel = 0;
|
||||||
int cx = xOrig + x;
|
int cx = xOrig + x;
|
||||||
int cz = zOrig + z;
|
int cz = zOrig + z;
|
||||||
Biome orig = getBiomeGrid(world).getBiome(xOrig+x, zOrig+z, GenerationPhase.BASE);
|
Biome orig = getBiomeGrid(world).getBiome(xOrig + x, zOrig + z, GenerationPhase.BASE);
|
||||||
Biome b = getBiomeGrid(world).getBiome(xOrig+x, zOrig+z, GenerationPhase.PALETTE_APPLY);
|
Biome b = getBiomeGrid(world).getBiome(xOrig + x, zOrig + z, GenerationPhase.PALETTE_APPLY);
|
||||||
BiomeConfig c = config.getBiome((UserDefinedBiome) b);
|
BiomeConfig c = config.getBiome((UserDefinedBiome) b);
|
||||||
BiomeSlabConfig slab = c.getSlabs();
|
BiomeSlabConfig slab = c.getSlabs();
|
||||||
int sea = config.getBiome((UserDefinedBiome) orig).getOcean().getSeaLevel();
|
int sea = config.getBiome((UserDefinedBiome) orig).getOcean().getSeaLevel();
|
||||||
Palette<BlockData> seaPalette = c.getOcean().getOcean();
|
Palette<BlockData> seaPalette = c.getOcean().getOcean();
|
||||||
for(int y = world.getMaxHeight()-1; y >= 0; y--) {
|
for(int y = world.getMaxHeight() - 1; y >= 0; y--) {
|
||||||
if(super.getInterpolatedNoise(x, y, z) > 0) {
|
if(super.getInterpolatedNoise(x, y, z) > 0) {
|
||||||
BlockData data = b.getGenerator().getPalette(y).get(paletteLevel, cx, cz);
|
BlockData data = b.getGenerator().getPalette(y).get(paletteLevel, cx, cz);
|
||||||
chunk.setBlock(x, y, z, data);
|
chunk.setBlock(x, y, z, data);
|
||||||
if(paletteLevel == 0 && c.getSlabs() != null && y < 255) {
|
if(paletteLevel == 0 && c.getSlabs() != null && y < 255) {
|
||||||
prepareBlockPart(data, chunk.getBlockData(x, y+1, z), chunk, new Vector(x, y+1, z), slab.getSlabs(), slab.getStairs(), slab.getSlabThreshold());
|
prepareBlockPart(data, chunk.getBlockData(x, y + 1, z), chunk, new Vector(x, y + 1, z), slab.getSlabs(), slab.getStairs(), slab.getSlabThreshold());
|
||||||
}
|
}
|
||||||
paletteLevel++;
|
paletteLevel++;
|
||||||
} else if(y <= sea) {
|
} else if(y <= sea) {
|
||||||
chunk.setBlock(x, y, z, seaPalette.get(sea-y, x+xOrig, z+zOrig));
|
chunk.setBlock(x, y, z, seaPalette.get(sea - y, x + xOrig, z + zOrig));
|
||||||
paletteLevel = 0;
|
paletteLevel = 0;
|
||||||
} else paletteLevel = 0;
|
} else paletteLevel = 0;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void fixChunk(Chunk c) {
|
public static synchronized void fixChunk(Chunk c) {
|
||||||
if(!(c.getWorld().getGenerator() instanceof TerraChunkGenerator)) throw new IllegalArgumentException();
|
if(! (c.getWorld().getGenerator() instanceof TerraChunkGenerator)) throw new IllegalArgumentException();
|
||||||
popMap.get(c.getWorld()).checkNeighbors(c.getX(), c.getZ(), c.getWorld());
|
popMap.get(c.getWorld()).checkNeighbors(c.getX(), c.getZ(), c.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +167,7 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
|||||||
public int getNoiseOctaves(World world) {
|
public int getNoiseOctaves(World world) {
|
||||||
return octaves;
|
return octaves;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getNoiseFrequency(World world) {
|
public float getNoiseFrequency(World world) {
|
||||||
return frequency;
|
return frequency;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class UserDefinedGenerator extends Generator {
|
|||||||
this.noiseExp = p.parse(equation, s);
|
this.noiseExp = p.parse(equation, s);
|
||||||
this.preventSmooth = preventSmooth;
|
this.preventSmooth = preventSmooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the 2D noise at a pair of coordinates using the provided FastNoiseLite instance.
|
* Gets the 2D noise at a pair of coordinates using the provided FastNoiseLite instance.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,18 +8,17 @@ import com.dfsek.terra.debug.gui.DebugGUI;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.polydev.gaea.biome.NormalizationUtil;
|
import org.polydev.gaea.biome.NormalizationUtil;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
public class ImageLoader {
|
public class ImageLoader {
|
||||||
private final BufferedImage image;
|
private final BufferedImage image;
|
||||||
private final Align align;
|
private final Align align;
|
||||||
double inverseRoot2 = 0.7071067811865475;
|
double inverseRoot2 = 0.7071067811865475;
|
||||||
|
|
||||||
public ImageLoader(File file, Align align) throws IOException {
|
public ImageLoader(File file, Align align) throws IOException {
|
||||||
image = ImageIO.read(file);
|
image = ImageIO.read(file);
|
||||||
this.align = align;
|
this.align = align;
|
||||||
@@ -30,21 +29,27 @@ public class ImageLoader {
|
|||||||
int rgb;
|
int rgb;
|
||||||
rgb = align.getRGB(image, x, y);
|
rgb = align.getRGB(image, x, y);
|
||||||
switch(channel) {
|
switch(channel) {
|
||||||
case RED: return rgb >> 16 & 0xff;
|
case RED:
|
||||||
case GREEN: return rgb >> 8 & 0xff;
|
return rgb >> 16 & 0xff;
|
||||||
case BLUE: return rgb & 0xff;
|
case GREEN:
|
||||||
case ALPHA: return rgb >> 32 & 0xff;
|
return rgb >> 8 & 0xff;
|
||||||
default: throw new IllegalArgumentException();
|
case BLUE:
|
||||||
|
return rgb & 0xff;
|
||||||
|
case ALPHA:
|
||||||
|
return rgb >> 32 & 0xff;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debugWorld(boolean genStep, World w) {
|
public static void debugWorld(boolean genStep, World w) {
|
||||||
if(!ConfigUtil.debug) return;
|
if(! ConfigUtil.debug) return;
|
||||||
BufferedImage newImg = new WorldImageGenerator(w, 1024, 1024).drawWorld(0, 0).getDraw();
|
BufferedImage newImg = new WorldImageGenerator(w, 1024, 1024).drawWorld(0, 0).getDraw();
|
||||||
if(genStep) newImg = redrawStepped(newImg, w, Align.CENTER);
|
if(genStep) newImg = redrawStepped(newImg, w, Align.CENTER);
|
||||||
DebugGUI debugGUI = new DebugGUI(newImg);
|
DebugGUI debugGUI = new DebugGUI(newImg);
|
||||||
debugGUI.start();
|
debugGUI.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BufferedImage redrawStepped(BufferedImage original, World w, Align align) {
|
private static BufferedImage redrawStepped(BufferedImage original, World w, Align align) {
|
||||||
BufferedImage newImg = copyImage(original);
|
BufferedImage newImg = copyImage(original);
|
||||||
TerraBiomeGrid tb = TerraWorld.getWorld(w).getGrid();
|
TerraBiomeGrid tb = TerraWorld.getWorld(w).getGrid();
|
||||||
@@ -52,7 +57,8 @@ public class ImageLoader {
|
|||||||
for(int x = 0; x < newImg.getWidth(); x++) {
|
for(int x = 0; x < newImg.getWidth(); x++) {
|
||||||
for(int y = 0; y < newImg.getHeight(); y++) {
|
for(int y = 0; y < newImg.getHeight(); y++) {
|
||||||
float[] noise;
|
float[] noise;
|
||||||
if(align.equals(Align.CENTER)) noise = tb.getGrid(x - original.getWidth()/2, y - original.getHeight()/2).getRawNoise(x - original.getWidth()/2, y - original.getHeight()/2);
|
if(align.equals(Align.CENTER))
|
||||||
|
noise = tb.getGrid(x - original.getWidth() / 2, y - original.getHeight() / 2).getRawNoise(x - original.getWidth() / 2, y - original.getHeight() / 2);
|
||||||
else noise = tb.getGrid(x, y).getRawNoise(x, y);
|
else noise = tb.getGrid(x, y).getRawNoise(x, y);
|
||||||
newImg.setRGB(x, y, new Color((int) (NormalizationUtil.normalize(noise[0], tb.getGrid(x, y).getSizeX(), 4) * ((double) 255 / tb.getGrid(x, y).getSizeX())),
|
newImg.setRGB(x, y, new Color((int) (NormalizationUtil.normalize(noise[0], tb.getGrid(x, y).getSizeX(), 4) * ((double) 255 / tb.getGrid(x, y).getSizeX())),
|
||||||
(int) (NormalizationUtil.normalize(noise[1], tb.getGrid(x, y).getSizeZ(), 4) * ((double) 255 / tb.getGrid(x, y).getSizeZ())),
|
(int) (NormalizationUtil.normalize(noise[1], tb.getGrid(x, y).getSizeZ(), 4) * ((double) 255 / tb.getGrid(x, y).getSizeZ())),
|
||||||
@@ -64,7 +70,7 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void debug(boolean genStep, World w) {
|
public void debug(boolean genStep, World w) {
|
||||||
if(!ConfigUtil.debug) return;
|
if(! ConfigUtil.debug) return;
|
||||||
BufferedImage newImg = copyImage(image);
|
BufferedImage newImg = copyImage(image);
|
||||||
if(genStep) {
|
if(genStep) {
|
||||||
newImg = redrawStepped(image, w, align);
|
newImg = redrawStepped(image, w, align);
|
||||||
@@ -74,8 +80,9 @@ public class ImageLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getNoiseVal(int x, int y, Channel channel) {
|
public double getNoiseVal(int x, int y, Channel channel) {
|
||||||
return ((double) (getChannel(x, y, channel) - 128)/128)*inverseRoot2;
|
return ((double) (getChannel(x, y, channel) - 128) / 128) * inverseRoot2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BufferedImage copyImage(BufferedImage source) {
|
private static BufferedImage copyImage(BufferedImage source) {
|
||||||
BufferedImage b = new BufferedImage(source.getWidth(), source.getHeight(), source.getType());
|
BufferedImage b = new BufferedImage(source.getWidth(), source.getHeight(), source.getType());
|
||||||
Graphics g = b.getGraphics();
|
Graphics g = b.getGraphics();
|
||||||
@@ -91,11 +98,12 @@ public class ImageLoader {
|
|||||||
public enum Channel {
|
public enum Channel {
|
||||||
RED, GREEN, BLUE, ALPHA
|
RED, GREEN, BLUE, ALPHA
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Align {
|
public enum Align {
|
||||||
CENTER {
|
CENTER {
|
||||||
@Override
|
@Override
|
||||||
public int getRGB(BufferedImage image, int x, int y) {
|
public int getRGB(BufferedImage image, int x, int y) {
|
||||||
return Align.getRGBNoAlign(image, x-(image.getWidth()/2), y-(image.getHeight()/2));
|
return Align.getRGBNoAlign(image, x - (image.getWidth() / 2), y - (image.getHeight() / 2));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NONE {
|
NONE {
|
||||||
@@ -104,7 +112,9 @@ public class ImageLoader {
|
|||||||
return image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(y, image.getHeight()));
|
return image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(y, image.getHeight()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract int getRGB(BufferedImage image, int x, int y);
|
public abstract int getRGB(BufferedImage image, int x, int y);
|
||||||
|
|
||||||
private static int getRGBNoAlign(BufferedImage image, int x, int y) {
|
private static int getRGBNoAlign(BufferedImage image, int x, int y) {
|
||||||
return image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(y, image.getHeight()));
|
return image.getRGB(Math.floorMod(x, image.getWidth()), Math.floorMod(y, image.getHeight()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.dfsek.terra.image;
|
package com.dfsek.terra.image;
|
||||||
|
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.biome.BiomeZone;
|
|
||||||
import com.dfsek.terra.biome.TerraBiomeGrid;
|
import com.dfsek.terra.biome.TerraBiomeGrid;
|
||||||
import com.dfsek.terra.config.base.WorldConfig;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.polydev.gaea.biome.NormalizationUtil;
|
import org.polydev.gaea.biome.NormalizationUtil;
|
||||||
|
|
||||||
@@ -16,17 +14,19 @@ import java.io.IOException;
|
|||||||
public class WorldImageGenerator {
|
public class WorldImageGenerator {
|
||||||
private final World w;
|
private final World w;
|
||||||
private final BufferedImage draw;
|
private final BufferedImage draw;
|
||||||
|
|
||||||
public WorldImageGenerator(World w, int width, int height) {
|
public WorldImageGenerator(World w, int width, int height) {
|
||||||
draw = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
draw = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||||
this.w = w;
|
this.w = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldImageGenerator drawWorld(int centerX, int centerZ) {
|
public WorldImageGenerator drawWorld(int centerX, int centerZ) {
|
||||||
TerraWorld tw = TerraWorld.getWorld(w);
|
TerraWorld tw = TerraWorld.getWorld(w);
|
||||||
TerraBiomeGrid tb = tw.getGrid();
|
TerraBiomeGrid tb = tw.getGrid();
|
||||||
int imY = 0;
|
int imY = 0;
|
||||||
for(int y = centerZ - (draw.getHeight()/2); y < centerZ + (draw.getHeight()/2); y++) {
|
for(int y = centerZ - (draw.getHeight() / 2); y < centerZ + (draw.getHeight() / 2); y++) {
|
||||||
int imX = 0;
|
int imX = 0;
|
||||||
for(int x = centerX - (draw.getWidth()/2); x < centerX + (draw.getWidth()/2); x++) {
|
for(int x = centerX - (draw.getWidth() / 2); x < centerX + (draw.getWidth() / 2); x++) {
|
||||||
int zone = NormalizationUtil.normalize(tw.getZone().getRawNoise(x, y), 256, 4);
|
int zone = NormalizationUtil.normalize(tw.getZone().getRawNoise(x, y), 256, 4);
|
||||||
float[] noise = tb.getGrid(x, y).getRawNoise(x, y);
|
float[] noise = tb.getGrid(x, y).getRawNoise(x, y);
|
||||||
Color c = new Color(NormalizationUtil.normalize(noise[0], 256, 4), NormalizationUtil.normalize(noise[1], 256, 4), zone);
|
Color c = new Color(NormalizationUtil.normalize(noise[0], 256, 4), NormalizationUtil.normalize(noise[1], 256, 4), zone);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class NoiseFunction3 implements Function {
|
public class NoiseFunction3 implements Function {
|
||||||
private FastNoiseLite gen;
|
private FastNoiseLite gen;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumberOfArguments() {
|
public int getNumberOfArguments() {
|
||||||
return 3;
|
return 3;
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ package com.dfsek.terra.population;
|
|||||||
|
|
||||||
import com.dfsek.terra.TerraProfiler;
|
import com.dfsek.terra.TerraProfiler;
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.carving.SimplexCarver;
|
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.genconfig.CarverConfig;
|
import com.dfsek.terra.config.genconfig.CarverConfig;
|
||||||
import com.dfsek.terra.structure.StructureSpawnRequirement;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -29,12 +27,13 @@ import java.util.Set;
|
|||||||
public class CavePopulator extends BlockPopulator {
|
public class CavePopulator extends BlockPopulator {
|
||||||
private static final Map<Material, BlockData> shiftStorage = new HashMap<>(); // Persist BlockData created for shifts, to avoid re-calculating each time.
|
private static final Map<Material, BlockData> shiftStorage = new HashMap<>(); // Persist BlockData created for shifts, to avoid re-calculating each time.
|
||||||
private static final BlockData AIR = Material.AIR.createBlockData();
|
private static final BlockData AIR = Material.AIR.createBlockData();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||||
if(ConfigUtil.masterDisableCaves) return;
|
if(ConfigUtil.masterDisableCaves) return;
|
||||||
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("CaveTime")) {
|
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("CaveTime")) {
|
||||||
TerraWorld tw = TerraWorld.getWorld(world);
|
TerraWorld tw = TerraWorld.getWorld(world);
|
||||||
if(!tw.isSafe()) return;
|
if(! tw.isSafe()) return;
|
||||||
ConfigPack config = tw.getConfig();
|
ConfigPack config = tw.getConfig();
|
||||||
|
|
||||||
for(CarverConfig c : config.getCarvers().values()) {
|
for(CarverConfig c : config.getCarvers().values()) {
|
||||||
@@ -75,7 +74,8 @@ public class CavePopulator extends BlockPopulator {
|
|||||||
if(c.getShiftedBlocks().get(shiftCandidate.get(l)).contains(mut.getBlock().getType())) {
|
if(c.getShiftedBlocks().get(shiftCandidate.get(l)).contains(mut.getBlock().getType())) {
|
||||||
mut.getBlock().setBlockData(shiftStorage.computeIfAbsent(shiftCandidate.get(l), Material::createBlockData), false);
|
mut.getBlock().setBlockData(shiftStorage.computeIfAbsent(shiftCandidate.get(l), Material::createBlockData), false);
|
||||||
}
|
}
|
||||||
} catch(NullPointerException ignore) {}
|
} catch(NullPointerException ignore) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try(ProfileFuture ignore = TerraProfiler.fromWorld(world).measure("CaveBlockUpdate")) {
|
try(ProfileFuture ignore = TerraProfiler.fromWorld(world).measure("CaveBlockUpdate")) {
|
||||||
for(Block b : updateNeeded) {
|
for(Block b : updateNeeded) {
|
||||||
@@ -100,6 +100,7 @@ public class CavePopulator extends BlockPopulator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean borderingOcean(Block b) {
|
private boolean borderingOcean(Block b) {
|
||||||
return b.getRelative(BlockFace.UP).getType().equals(Material.WATER) || b.getType().equals(Material.LAVA);
|
return b.getRelative(BlockFace.UP).getType().equals(Material.WATER) || b.getType().equals(Material.LAVA);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,12 @@ import com.dfsek.terra.config.base.ConfigPack;
|
|||||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||||
import com.dfsek.terra.config.genconfig.biome.BiomeFloraConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeFloraConfig;
|
||||||
import com.dfsek.terra.event.TreeGenerateEvent;
|
import com.dfsek.terra.event.TreeGenerateEvent;
|
||||||
import com.dfsek.terra.generation.UserDefinedDecorator;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.polydev.gaea.biome.Biome;
|
|
||||||
import org.polydev.gaea.generation.GenerationPhase;
|
import org.polydev.gaea.generation.GenerationPhase;
|
||||||
import org.polydev.gaea.math.Range;
|
import org.polydev.gaea.math.Range;
|
||||||
import org.polydev.gaea.population.GaeaBlockPopulator;
|
import org.polydev.gaea.population.GaeaBlockPopulator;
|
||||||
@@ -34,9 +32,9 @@ import java.util.Random;
|
|||||||
public class FloraPopulator extends GaeaBlockPopulator {
|
public class FloraPopulator extends GaeaBlockPopulator {
|
||||||
@Override
|
@Override
|
||||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||||
try (ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("FloraTime")) {
|
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("FloraTime")) {
|
||||||
TerraWorld tw = TerraWorld.getWorld(world);
|
TerraWorld tw = TerraWorld.getWorld(world);
|
||||||
if(!tw.isSafe()) return;
|
if(! tw.isSafe()) return;
|
||||||
int originX = chunk.getX() << 4;
|
int originX = chunk.getX() << 4;
|
||||||
int originZ = chunk.getZ() << 4;
|
int originZ = chunk.getZ() << 4;
|
||||||
TerraBiomeGrid grid = tw.getGrid();
|
TerraBiomeGrid grid = tw.getGrid();
|
||||||
@@ -58,40 +56,46 @@ public class FloraPopulator extends GaeaBlockPopulator {
|
|||||||
BiomeFloraConfig f = c.getFlora();
|
BiomeFloraConfig f = c.getFlora();
|
||||||
for(int i = 0; i < f.getFloraAttempts(); i++) {
|
for(int i = 0; i < f.getFloraAttempts(); i++) {
|
||||||
Flora item;
|
Flora item;
|
||||||
if(f.isFloraSimplex()) item = biome.getDecorator().getFlora().get(f.getFloraNoise(), originX + x, originZ + z);
|
if(f.isFloraSimplex())
|
||||||
|
item = biome.getDecorator().getFlora().get(f.getFloraNoise(), originX + x, originZ + z);
|
||||||
else item = biome.getDecorator().getFlora().get(random);
|
else item = biome.getDecorator().getFlora().get(random);
|
||||||
for(Block highest : item.getValidSpawnsAt(chunk, x, z, c.getFloraHeights(item))) {
|
for(Block highest : item.getValidSpawnsAt(chunk, x, z, c.getFloraHeights(item))) {
|
||||||
if(random.nextInt(100) < biome.getDecorator().getFloraChance())
|
if(random.nextInt(100) < biome.getDecorator().getFloraChance())
|
||||||
item.plant(highest.getLocation());
|
item.plant(highest.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(NullPointerException ignore) {}
|
} catch(NullPointerException ignore) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static boolean doTrees(@NotNull UserDefinedBiome biome, TerraWorld world, @NotNull Random random, @NotNull Chunk chunk, int x, int z) {
|
|
||||||
|
private static boolean doTrees(@NotNull UserDefinedBiome biome, TerraWorld world, @NotNull Random random, @NotNull Chunk chunk, int x, int z) {
|
||||||
for(Block block : getValidTreeSpawnsAt(chunk, x, z, new Range(0, 254))) {
|
for(Block block : getValidTreeSpawnsAt(chunk, x, z, new Range(0, 254))) {
|
||||||
Tree tree = biome.getDecorator().getTrees().get(random);
|
Tree tree = biome.getDecorator().getTrees().get(random);
|
||||||
Range range = world.getConfig().getBiome(biome).getTreeRange(tree);
|
Range range = world.getConfig().getBiome(biome).getTreeRange(tree);
|
||||||
if(!range.isInRange(block.getY())) continue;
|
if(! range.isInRange(block.getY())) continue;
|
||||||
try {
|
try {
|
||||||
Location l = block.getLocation();
|
Location l = block.getLocation();
|
||||||
TreeGenerateEvent event = new TreeGenerateEvent(world, l, tree);
|
TreeGenerateEvent event = new TreeGenerateEvent(world, l, tree);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) tree.plant(l, random, Terra.getInstance());
|
if(! event.isCancelled()) tree.plant(l, random, Terra.getInstance());
|
||||||
} catch(NullPointerException ignore) {}
|
} catch(NullPointerException ignore) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int offset(Random r, int i) {
|
private static int offset(Random r, int i) {
|
||||||
return Math.min(Math.max(i + r.nextInt(3)-1, 0), 15);
|
return Math.min(Math.max(i + r.nextInt(3) - 1, 0), 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Block> getValidTreeSpawnsAt(Chunk chunk, int x, int z, Range check) {
|
public static List<Block> getValidTreeSpawnsAt(Chunk chunk, int x, int z, Range check) {
|
||||||
List<Block> blocks = new ArrayList<>();
|
List<Block> blocks = new ArrayList<>();
|
||||||
for(int y : check) {
|
for(int y : check) {
|
||||||
if(chunk.getBlock(x, y, z).getType().isSolid() && chunk.getBlock(x, y + 1, z).getType().isAir()) {
|
if(chunk.getBlock(x, y, z).getType().isSolid() && chunk.getBlock(x, y + 1, z).getType().isAir()) {
|
||||||
blocks.add(chunk.getBlock(x, y+1, z));
|
blocks.add(chunk.getBlock(x, y + 1, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return blocks;
|
return blocks;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
package com.dfsek.terra.population;
|
package com.dfsek.terra.population;
|
||||||
|
|
||||||
|
import com.dfsek.terra.TerraProfiler;
|
||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
import com.dfsek.terra.config.base.ConfigPack;
|
||||||
|
import com.dfsek.terra.config.genconfig.OreConfig;
|
||||||
import com.dfsek.terra.config.genconfig.biome.BiomeOreConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeOreConfig;
|
||||||
import com.dfsek.terra.event.OreVeinGenerateEvent;
|
import com.dfsek.terra.event.OreVeinGenerateEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.polydev.gaea.math.Range;
|
|
||||||
import com.dfsek.terra.TerraProfiler;
|
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
|
||||||
import com.dfsek.terra.config.genconfig.OreConfig;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.polydev.gaea.biome.Biome;
|
import org.polydev.gaea.biome.Biome;
|
||||||
import org.polydev.gaea.generation.GenerationPhase;
|
import org.polydev.gaea.generation.GenerationPhase;
|
||||||
|
import org.polydev.gaea.math.Range;
|
||||||
import org.polydev.gaea.population.GaeaBlockPopulator;
|
import org.polydev.gaea.population.GaeaBlockPopulator;
|
||||||
import org.polydev.gaea.profiler.ProfileFuture;
|
import org.polydev.gaea.profiler.ProfileFuture;
|
||||||
|
|
||||||
@@ -24,19 +24,19 @@ import java.util.Random;
|
|||||||
public class OrePopulator extends GaeaBlockPopulator {
|
public class OrePopulator extends GaeaBlockPopulator {
|
||||||
@Override
|
@Override
|
||||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||||
try (ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("OreTime")) {
|
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("OreTime")) {
|
||||||
TerraWorld tw = TerraWorld.getWorld(world);
|
TerraWorld tw = TerraWorld.getWorld(world);
|
||||||
if(!tw.isSafe()) return;
|
if(! tw.isSafe()) return;
|
||||||
ConfigPack config = tw.getConfig();
|
ConfigPack config = tw.getConfig();
|
||||||
Biome b = TerraWorld.getWorld(world).getGrid().getBiome((chunk.getX() << 4)+8, (chunk.getZ() << 4) + 8, GenerationPhase.POPULATE);
|
Biome b = TerraWorld.getWorld(world).getGrid().getBiome((chunk.getX() << 4) + 8, (chunk.getZ() << 4) + 8, GenerationPhase.POPULATE);
|
||||||
BiomeOreConfig ores = config.getBiome((UserDefinedBiome) b).getOres();
|
BiomeOreConfig ores = config.getBiome((UserDefinedBiome) b).getOres();
|
||||||
for(Map.Entry<OreConfig, Range> e : ores.getOres().entrySet()) {
|
for(Map.Entry<OreConfig, Range> e : ores.getOres().entrySet()) {
|
||||||
int num = e.getValue().get(random);
|
int num = e.getValue().get(random);
|
||||||
OreConfig ore = e.getKey();
|
OreConfig ore = e.getKey();
|
||||||
int edgeOffset = ore.getChunkEdgeOffset();
|
int edgeOffset = ore.getChunkEdgeOffset();
|
||||||
for(int i = 0; i < num; i++) {
|
for(int i = 0; i < num; i++) {
|
||||||
int x = random.nextInt(16 - edgeOffset*2) + edgeOffset;
|
int x = random.nextInt(16 - edgeOffset * 2) + edgeOffset;
|
||||||
int z = random.nextInt(16 - edgeOffset*2) + edgeOffset;
|
int z = random.nextInt(16 - edgeOffset * 2) + edgeOffset;
|
||||||
int y = ores.getOreHeights().get(ore).get(random);
|
int y = ores.getOreHeights().get(ore).get(random);
|
||||||
|
|
||||||
Vector v = new Vector(x, y, z);
|
Vector v = new Vector(x, y, z);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.dfsek.terra.TerraProfiler;
|
|||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.biome.TerraBiomeGrid;
|
import com.dfsek.terra.biome.TerraBiomeGrid;
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.config.base.ConfigPack;
|
|
||||||
import com.dfsek.terra.config.base.ConfigUtil;
|
import com.dfsek.terra.config.base.ConfigUtil;
|
||||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||||
import com.dfsek.terra.util.DataUtil;
|
import com.dfsek.terra.util.DataUtil;
|
||||||
@@ -13,7 +12,6 @@ import org.bukkit.Chunk;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.polydev.gaea.generation.GenerationPhase;
|
import org.polydev.gaea.generation.GenerationPhase;
|
||||||
import org.polydev.gaea.population.GaeaBlockPopulator;
|
import org.polydev.gaea.population.GaeaBlockPopulator;
|
||||||
@@ -25,6 +23,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class SnowPopulator extends GaeaBlockPopulator {
|
public class SnowPopulator extends GaeaBlockPopulator {
|
||||||
private static final Set<Material> blacklistSpawn = new HashSet<>();
|
private static final Set<Material> blacklistSpawn = new HashSet<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for(Material m : Material.values()) {
|
for(Material m : Material.values()) {
|
||||||
String name = m.toString().toLowerCase();
|
String name = m.toString().toLowerCase();
|
||||||
@@ -44,9 +43,10 @@ public class SnowPopulator extends GaeaBlockPopulator {
|
|||||||
if(ConfigUtil.debug)
|
if(ConfigUtil.debug)
|
||||||
Bukkit.getLogger().info("Added " + blacklistSpawn.size() + " materials to snow blacklist");
|
Bukkit.getLogger().info("Added " + blacklistSpawn.size() + " materials to snow blacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||||
try (ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("SnowTime")) {
|
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("SnowTime")) {
|
||||||
int origX = chunk.getX() << 4;
|
int origX = chunk.getX() << 4;
|
||||||
int origZ = chunk.getZ() << 4;
|
int origZ = chunk.getZ() << 4;
|
||||||
TerraWorld w = TerraWorld.getWorld(world);
|
TerraWorld w = TerraWorld.getWorld(world);
|
||||||
@@ -55,7 +55,7 @@ public class SnowPopulator extends GaeaBlockPopulator {
|
|||||||
for(int x = 0; x < 16; x++) {
|
for(int x = 0; x < 16; x++) {
|
||||||
for(int z = 0; z < 16; z++) {
|
for(int z = 0; z < 16; z++) {
|
||||||
BiomeConfig biome = w.getConfig().getBiome((UserDefinedBiome) g.getBiome(origX + x, origZ + z, GenerationPhase.PALETTE_APPLY));
|
BiomeConfig biome = w.getConfig().getBiome((UserDefinedBiome) g.getBiome(origX + x, origZ + z, GenerationPhase.PALETTE_APPLY));
|
||||||
if(!biome.getSnow().doSnow()) continue;
|
if(! biome.getSnow().doSnow()) continue;
|
||||||
int y;
|
int y;
|
||||||
Block b = null;
|
Block b = null;
|
||||||
for(y = 254; y > 0; y--) {
|
for(y = 254; y > 0; y--) {
|
||||||
|
|||||||
@@ -30,17 +30,18 @@ public class StructurePopulator extends BlockPopulator {
|
|||||||
int cx = (chunk.getX() << 4);
|
int cx = (chunk.getX() << 4);
|
||||||
int cz = (chunk.getZ() << 4);
|
int cz = (chunk.getZ() << 4);
|
||||||
TerraWorld tw = TerraWorld.getWorld(world);
|
TerraWorld tw = TerraWorld.getWorld(world);
|
||||||
if(!tw.isSafe()) return;
|
if(! tw.isSafe()) return;
|
||||||
TerraBiomeGrid grid = tw.getGrid();
|
TerraBiomeGrid grid = tw.getGrid();
|
||||||
ConfigPack config = tw.getConfig();
|
ConfigPack config = tw.getConfig();
|
||||||
structure: for(StructureConfig conf : config.getAllStructures()) {
|
structure:
|
||||||
|
for(StructureConfig conf : config.getAllStructures()) {
|
||||||
Location spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed()).toLocation(world);
|
Location spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed()).toLocation(world);
|
||||||
if(!config.getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(conf)) continue;
|
if(! config.getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(conf)) continue;
|
||||||
Random r2 = new Random(spawn.hashCode());
|
Random r2 = new Random(spawn.hashCode());
|
||||||
Structure struc = conf.getStructure(r2);
|
Structure struc = conf.getStructure(r2);
|
||||||
Structure.Rotation rotation = Structure.Rotation.fromDegrees(r2.nextInt(4) * 90);
|
Structure.Rotation rotation = Structure.Rotation.fromDegrees(r2.nextInt(4) * 90);
|
||||||
for(int y = conf.getSearchStart().get(r2); y > 0; y--) {
|
for(int y = conf.getSearchStart().get(r2); y > 0; y--) {
|
||||||
if(!conf.getBound().isInRange(y)) continue structure;
|
if(! conf.getBound().isInRange(y)) continue structure;
|
||||||
spawn.setY(y);
|
spawn.setY(y);
|
||||||
if(! struc.checkSpawns(spawn, rotation)) continue;
|
if(! struc.checkSpawns(spawn, rotation)) continue;
|
||||||
double horizontal = struc.getStructureInfo().getMaxHorizontal();
|
double horizontal = struc.getStructureInfo().getMaxHorizontal();
|
||||||
@@ -73,6 +74,7 @@ public class StructurePopulator extends BlockPopulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SearchType {
|
public enum SearchType {
|
||||||
UP, DOWN
|
UP, DOWN
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import java.util.Random;
|
|||||||
public class GridSpawn {
|
public class GridSpawn {
|
||||||
private final int separation;
|
private final int separation;
|
||||||
private final int width;
|
private final int width;
|
||||||
|
|
||||||
public GridSpawn(int width, int separation) {
|
public GridSpawn(int width, int separation) {
|
||||||
this.separation = separation;
|
this.separation = separation;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@@ -20,17 +21,18 @@ public class GridSpawn {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get nearest spawn point
|
* Get nearest spawn point
|
||||||
* @param x X coordinate
|
*
|
||||||
* @param z Z coordinate
|
* @param x X coordinate
|
||||||
|
* @param z Z coordinate
|
||||||
* @param seed Seed for RNG
|
* @param seed Seed for RNG
|
||||||
* @return Vector representing nearest spawnpoint
|
* @return Vector representing nearest spawnpoint
|
||||||
*/
|
*/
|
||||||
public Vector getNearestSpawn(int x, int z, long seed) {
|
public Vector getNearestSpawn(int x, int z, long seed) {
|
||||||
int structureChunkX = x / (width + 2*separation);
|
int structureChunkX = x / (width + 2 * separation);
|
||||||
int structureChunkZ = z / (width + 2*separation);
|
int structureChunkZ = z / (width + 2 * separation);
|
||||||
List<Vector> zones = new ArrayList<>();
|
List<Vector> zones = new ArrayList<>();
|
||||||
for(int xi = structureChunkX-1; xi <= structureChunkX+1; xi++) {
|
for(int xi = structureChunkX - 1; xi <= structureChunkX + 1; xi++) {
|
||||||
for(int zi = structureChunkZ-1; zi <= structureChunkZ+1; zi++) {
|
for(int zi = structureChunkZ - 1; zi <= structureChunkZ + 1; zi++) {
|
||||||
zones.add(getChunkSpawn(xi, zi, seed));
|
zones.add(getChunkSpawn(xi, zi, seed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,17 +46,18 @@ public class GridSpawn {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the X/Z coordinates of the spawn point in the nearest Chunk (not Minecraft chunk)
|
* Get the X/Z coordinates of the spawn point in the nearest Chunk (not Minecraft chunk)
|
||||||
|
*
|
||||||
* @param structureChunkX Chunk X coordinate
|
* @param structureChunkX Chunk X coordinate
|
||||||
* @param structureChunkZ Chunk Z coordinate
|
* @param structureChunkZ Chunk Z coordinate
|
||||||
* @param seed Seed for RNG
|
* @param seed Seed for RNG
|
||||||
* @return Vector representing spawnpoint
|
* @return Vector representing spawnpoint
|
||||||
*/
|
*/
|
||||||
public Vector getChunkSpawn(int structureChunkX, int structureChunkZ, long seed) {
|
public Vector getChunkSpawn(int structureChunkX, int structureChunkZ, long seed) {
|
||||||
Random r = new Random(MathUtil.getCarverChunkSeed(structureChunkX, structureChunkZ, seed));
|
Random r = new Random(MathUtil.getCarverChunkSeed(structureChunkX, structureChunkZ, seed));
|
||||||
int offsetX = r.nextInt(width);
|
int offsetX = r.nextInt(width);
|
||||||
int offsetZ = r.nextInt(width);
|
int offsetZ = r.nextInt(width);
|
||||||
int sx = structureChunkX * (width + 2*separation) + offsetX;
|
int sx = structureChunkX * (width + 2 * separation) + offsetX;
|
||||||
int sz = structureChunkZ * (width + 2*separation) + offsetZ;
|
int sz = structureChunkZ * (width + 2 * separation) + offsetZ;
|
||||||
return new Vector(sx, 0, sz);
|
return new Vector(sx, 0, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.dfsek.terra.procgen.math;
|
package com.dfsek.terra.procgen.math;
|
||||||
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oh yeah
|
* oh yeah
|
||||||
*/
|
*/
|
||||||
@@ -11,6 +9,7 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a vector with a given X and Z component
|
* Create a vector with a given X and Z component
|
||||||
|
*
|
||||||
* @param x X component
|
* @param x X component
|
||||||
* @param z Z component
|
* @param z Z component
|
||||||
*/
|
*/
|
||||||
@@ -21,6 +20,7 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get X component
|
* Get X component
|
||||||
|
*
|
||||||
* @return X component
|
* @return X component
|
||||||
*/
|
*/
|
||||||
public double getX() {
|
public double getX() {
|
||||||
@@ -29,6 +29,7 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Z component
|
* Get Z component
|
||||||
|
*
|
||||||
* @return Z component
|
* @return Z component
|
||||||
*/
|
*/
|
||||||
public double getZ() {
|
public double getZ() {
|
||||||
@@ -37,36 +38,40 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply X and Z components by a value.
|
* Multiply X and Z components by a value.
|
||||||
|
*
|
||||||
* @param m Value to multiply
|
* @param m Value to multiply
|
||||||
* @return Mutated vector, for chaining.
|
* @return Mutated vector, for chaining.
|
||||||
*/
|
*/
|
||||||
public Vector2 multiply(double m) {
|
public Vector2 multiply(double m) {
|
||||||
x*=m;
|
x *= m;
|
||||||
z*=m;
|
z *= m;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Divide X and Z components by a value.
|
* Divide X and Z components by a value.
|
||||||
|
*
|
||||||
* @param d Divisor
|
* @param d Divisor
|
||||||
* @return Mutated vector, for chaining.
|
* @return Mutated vector, for chaining.
|
||||||
*/
|
*/
|
||||||
public Vector2 divide(double d) {
|
public Vector2 divide(double d) {
|
||||||
x/=d;
|
x /= d;
|
||||||
z/=d;
|
z /= d;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the squared length of this Vector
|
* Get the squared length of this Vector
|
||||||
|
*
|
||||||
* @return squared length
|
* @return squared length
|
||||||
*/
|
*/
|
||||||
public double lengthSquared() {
|
public double lengthSquared() {
|
||||||
return x*x+z*z;
|
return x * x + z * z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the length of this Vector
|
* Get the length of this Vector
|
||||||
|
*
|
||||||
* @return length
|
* @return length
|
||||||
*/
|
*/
|
||||||
public double length() {
|
public double length() {
|
||||||
@@ -75,28 +80,31 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add this vector to another.
|
* Add this vector to another.
|
||||||
|
*
|
||||||
* @param other Vector to add
|
* @param other Vector to add
|
||||||
* @return Mutated vector, for chaining.
|
* @return Mutated vector, for chaining.
|
||||||
*/
|
*/
|
||||||
public Vector2 add(Vector2 other) {
|
public Vector2 add(Vector2 other) {
|
||||||
x+=other.x;
|
x += other.x;
|
||||||
z+=other.z;
|
z += other.z;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subtract a vector from this vector,
|
* Subtract a vector from this vector,
|
||||||
|
*
|
||||||
* @param other Vector to subtract
|
* @param other Vector to subtract
|
||||||
* @return Mutated vector, for chaining.
|
* @return Mutated vector, for chaining.
|
||||||
*/
|
*/
|
||||||
public Vector2 subtract(Vector2 other) {
|
public Vector2 subtract(Vector2 other) {
|
||||||
x-=other.x;
|
x -= other.x;
|
||||||
z-=other.z;
|
z -= other.z;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize this vector to length 1
|
* Normalize this vector to length 1
|
||||||
|
*
|
||||||
* @return Mutated vector, for chaining.
|
* @return Mutated vector, for chaining.
|
||||||
*/
|
*/
|
||||||
public Vector2 normalize() {
|
public Vector2 normalize() {
|
||||||
@@ -106,6 +114,7 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the distance from this vector to another.
|
* Get the distance from this vector to another.
|
||||||
|
*
|
||||||
* @param other Another vector
|
* @param other Another vector
|
||||||
* @return Distance between vectors
|
* @return Distance between vectors
|
||||||
*/
|
*/
|
||||||
@@ -115,6 +124,7 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the squared distance between 2 vectors.
|
* Get the squared distance between 2 vectors.
|
||||||
|
*
|
||||||
* @param other Another vector
|
* @param other Another vector
|
||||||
* @return Squared distance
|
* @return Squared distance
|
||||||
*/
|
*/
|
||||||
@@ -126,7 +136,7 @@ public class Vector2 implements Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof Vector2)) {
|
if(! (obj instanceof Vector2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Vector2 other = (Vector2) obj;
|
Vector2 other = (Vector2) obj;
|
||||||
@@ -150,7 +160,7 @@ public class Vector2 implements Cloneable {
|
|||||||
public Vector2 clone() {
|
public Vector2 clone() {
|
||||||
try {
|
try {
|
||||||
return (Vector2) super.clone();
|
return (Vector2) super.clone();
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch(CloneNotSupportedException e) {
|
||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,13 @@ import java.util.Set;
|
|||||||
public class Rectangle extends Polygon {
|
public class Rectangle extends Polygon {
|
||||||
private Vector2 min;
|
private Vector2 min;
|
||||||
private Vector2 max;
|
private Vector2 max;
|
||||||
|
|
||||||
public Rectangle(Vector2 min, Vector2 max) {
|
public Rectangle(Vector2 min, Vector2 max) {
|
||||||
this.max = new Vector2(Math.min(min.getX(), max.getX()), Math.min(min.getZ(), max.getZ()));
|
this.max = new Vector2(Math.min(min.getX(), max.getX()), Math.min(min.getZ(), max.getZ()));
|
||||||
this.min = new Vector2(Math.max(min.getX(), max.getX()), Math.max(min.getZ(), max.getZ()));;
|
this.min = new Vector2(Math.max(min.getX(), max.getX()), Math.max(min.getZ(), max.getZ()));
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle(Vector2 center, double xRadius, double zRadius) {
|
public Rectangle(Vector2 center, double xRadius, double zRadius) {
|
||||||
Vector2 rad = new Vector2(xRadius, zRadius);
|
Vector2 rad = new Vector2(xRadius, zRadius);
|
||||||
this.min = center.clone().subtract(rad);
|
this.min = center.clone().subtract(rad);
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package com.dfsek.terra.procgen.voxel;
|
package com.dfsek.terra.procgen.voxel;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
|
|
||||||
public class DeformedSphere extends VoxelGeometry {
|
public class DeformedSphere extends VoxelGeometry {
|
||||||
public DeformedSphere(Vector start, int rad, double deform, FastNoiseLite noise) {
|
public DeformedSphere(Vector start, int rad, double deform, FastNoiseLite noise) {
|
||||||
for(int x = -rad; x <= rad; x++) {
|
for(int x = - rad; x <= rad; x++) {
|
||||||
for(int y = -rad; y <= rad; y++) {
|
for(int y = - rad; y <= rad; y++) {
|
||||||
for(int z = -rad; z <= rad; z++) {
|
for(int z = - rad; z <= rad; z++) {
|
||||||
Vector c = new Vector(x, y, z);
|
Vector c = new Vector(x, y, z);
|
||||||
if(c.length() < (rad + 0.5) * ((noise.getNoise(x, y, z)+1)*deform)) {
|
if(c.length() < (rad + 0.5) * ((noise.getNoise(x, y, z) + 1) * deform)) {
|
||||||
addVector(c.add(start));
|
addVector(c.add(start));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.dfsek.terra.procgen.voxel;
|
package com.dfsek.terra.procgen.voxel;
|
||||||
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
|
||||||
|
|
||||||
public class Sphere extends VoxelGeometry {
|
public class Sphere extends VoxelGeometry {
|
||||||
public Sphere(Vector start, int rad) {
|
public Sphere(Vector start, int rad) {
|
||||||
for(int x = -rad; x <= rad; x++) {
|
for(int x = - rad; x <= rad; x++) {
|
||||||
for(int y = -rad; y <= rad; y++) {
|
for(int y = - rad; y <= rad; y++) {
|
||||||
for(int z = -rad; z <= rad; z++) {
|
for(int z = - rad; z <= rad; z++) {
|
||||||
Vector c = new Vector(x, y, z);
|
Vector c = new Vector(x, y, z);
|
||||||
if(c.length() < rad + 0.5) {
|
if(c.length() < rad + 0.5) {
|
||||||
addVector(c.add(start));
|
addVector(c.add(start));
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ public abstract class VoxelGeometry {
|
|||||||
public void merge(VoxelGeometry other) {
|
public void merge(VoxelGeometry other) {
|
||||||
geometry.addAll(other.geometry);
|
geometry.addAll(other.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VoxelGeometry getBlank() {
|
public static VoxelGeometry getBlank() {
|
||||||
return new VoxelGeometry() {};
|
return new VoxelGeometry() {
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,10 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
public class InitializationException extends Exception {
|
public class InitializationException extends Exception {
|
||||||
private final Location worldLoc;
|
private final Location worldLoc;
|
||||||
|
|
||||||
public InitializationException(String message, @Nullable Location worldLoc) {
|
public InitializationException(String message, @Nullable Location worldLoc) {
|
||||||
super(message);
|
super(message);
|
||||||
this.worldLoc = worldLoc == null ? null :worldLoc.clone();
|
this.worldLoc = worldLoc == null ? null : worldLoc.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.dfsek.terra.structure;
|
|||||||
|
|
||||||
import com.dfsek.terra.Debug;
|
import com.dfsek.terra.Debug;
|
||||||
import com.dfsek.terra.procgen.math.Vector2;
|
import com.dfsek.terra.procgen.math.Vector2;
|
||||||
import com.dfsek.terra.util.structure.RotationUtil;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -10,7 +9,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Container;
|
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Directional;
|
import org.bukkit.block.data.Directional;
|
||||||
@@ -21,7 +19,6 @@ import org.bukkit.block.data.Rotatable;
|
|||||||
import org.bukkit.block.data.type.RedstoneWire;
|
import org.bukkit.block.data.type.RedstoneWire;
|
||||||
import org.bukkit.inventory.BlockInventoryHolder;
|
import org.bukkit.inventory.BlockInventoryHolder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.polydev.gaea.math.Range;
|
import org.polydev.gaea.math.Range;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -32,10 +29,8 @@ import java.io.InputStream;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -44,7 +39,7 @@ import java.util.function.Consumer;
|
|||||||
import static com.dfsek.terra.util.structure.RotationUtil.*;
|
import static com.dfsek.terra.util.structure.RotationUtil.*;
|
||||||
|
|
||||||
public class Structure implements Serializable {
|
public class Structure implements Serializable {
|
||||||
public static final long serialVersionUID = -6664585217063842035L;
|
public static final long serialVersionUID = - 6664585217063842035L;
|
||||||
private final StructureContainedBlock[][][] structure;
|
private final StructureContainedBlock[][][] structure;
|
||||||
private final StructureInfo structureInfo;
|
private final StructureInfo structureInfo;
|
||||||
private final String id;
|
private final String id;
|
||||||
@@ -62,16 +57,17 @@ public class Structure implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Structure(@NotNull Location l1, @NotNull Location l2, @NotNull String id) throws InitializationException {
|
public Structure(@NotNull Location l1, @NotNull Location l2, @NotNull String id) throws InitializationException {
|
||||||
int centerX = -1, centerZ = -1;
|
int centerX = - 1, centerZ = - 1;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.uuid = UUID.randomUUID();
|
this.uuid = UUID.randomUUID();
|
||||||
this.spawns = new HashSet<>();
|
this.spawns = new HashSet<>();
|
||||||
this.inventories = new HashSet<>();
|
this.inventories = new HashSet<>();
|
||||||
if(l1.getX() > l2.getX() || l1.getY() > l2.getY() || l1.getZ() > l2.getZ()) throw new IllegalArgumentException("Invalid locations provided!");
|
if(l1.getX() > l2.getX() || l1.getY() > l2.getY() || l1.getZ() > l2.getZ())
|
||||||
structure = new StructureContainedBlock[l2.getBlockX()-l1.getBlockX()+1][l2.getBlockZ()-l1.getBlockZ()+1][l2.getBlockY()-l1.getBlockY()+1];
|
throw new IllegalArgumentException("Invalid locations provided!");
|
||||||
for(int x = 0; x <= l2.getBlockX()-l1.getBlockX(); x++) {
|
structure = new StructureContainedBlock[l2.getBlockX() - l1.getBlockX() + 1][l2.getBlockZ() - l1.getBlockZ() + 1][l2.getBlockY() - l1.getBlockY() + 1];
|
||||||
for(int z = 0; z <= l2.getBlockZ()-l1.getBlockZ(); z++) {
|
for(int x = 0; x <= l2.getBlockX() - l1.getBlockX(); x++) {
|
||||||
for(int y = 0; y <= l2.getBlockY()-l1.getBlockY(); y++) {
|
for(int z = 0; z <= l2.getBlockZ() - l1.getBlockZ(); z++) {
|
||||||
|
for(int y = 0; y <= l2.getBlockY() - l1.getBlockY(); y++) {
|
||||||
Block b = Objects.requireNonNull(l1.getWorld()).getBlockAt(l1.clone().add(x, y, z));
|
Block b = Objects.requireNonNull(l1.getWorld()).getBlockAt(l1.clone().add(x, y, z));
|
||||||
BlockState state = b.getState();
|
BlockState state = b.getState();
|
||||||
BlockData d = b.getBlockData();
|
BlockData d = b.getBlockData();
|
||||||
@@ -121,17 +117,18 @@ public class Structure implements Serializable {
|
|||||||
if(state instanceof BlockInventoryHolder) {
|
if(state instanceof BlockInventoryHolder) {
|
||||||
inventories.add(new StructureContainedInventory(((BlockInventoryHolder) state).getInventory(), block));
|
inventories.add(new StructureContainedInventory(((BlockInventoryHolder) state).getInventory(), block));
|
||||||
}
|
}
|
||||||
if(!requirement.equals(StructureSpawnRequirement.BLANK)) spawns.add(block);
|
if(! requirement.equals(StructureSpawnRequirement.BLANK)) spawns.add(block);
|
||||||
structure[x][z][y] = block;
|
structure[x][z][y] = block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(centerX < 0 || centerZ < 0) throw new InitializationException("No structure center specified.", null);
|
if(centerX < 0 || centerZ < 0) throw new InitializationException("No structure center specified.", null);
|
||||||
structureInfo = new StructureInfo(l2.getBlockX()-l1.getBlockX()+1, l2.getBlockY()-l1.getBlockY()+1, l2.getBlockZ()-l1.getBlockZ()+1, new Vector2(centerX, centerZ));
|
structureInfo = new StructureInfo(l2.getBlockX() - l1.getBlockX() + 1, l2.getBlockY() - l1.getBlockY() + 1, l2.getBlockZ() - l1.getBlockZ() + 1, new Vector2(centerX, centerZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get GaeaStructureInfo object
|
* Get GaeaStructureInfo object
|
||||||
|
*
|
||||||
* @return Structure Info
|
* @return Structure Info
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -141,8 +138,9 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste the structure at a Location, ignoring chunk boundaries.
|
* Paste the structure at a Location, ignoring chunk boundaries.
|
||||||
|
*
|
||||||
* @param origin Origin location
|
* @param origin Origin location
|
||||||
* @param r Rotation
|
* @param r Rotation
|
||||||
*/
|
*/
|
||||||
public void paste(@NotNull Location origin, Rotation r) {
|
public void paste(@NotNull Location origin, Rotation r) {
|
||||||
Range xRange = getRange(Axis.X, r);
|
Range xRange = getRange(Axis.X, r);
|
||||||
@@ -152,8 +150,9 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
public boolean checkSpawns(Location origin, Rotation r) {
|
public boolean checkSpawns(Location origin, Rotation r) {
|
||||||
for(StructureContainedBlock b : spawns) {
|
for(StructureContainedBlock b : spawns) {
|
||||||
Vector2 rot = getRotatedCoords(new Vector2(b.getX()-structureInfo.getCenterX(), b.getZ()-structureInfo.getCenterZ()), r);
|
Vector2 rot = getRotatedCoords(new Vector2(b.getX() - structureInfo.getCenterX(), b.getZ() - structureInfo.getCenterZ()), r);
|
||||||
if(!b.getRequirement().matches(origin.getWorld(), (int) rot.getX()+origin.getBlockX(), origin.getBlockY()+b.getY(), (int) rot.getZ()+origin.getBlockZ())) return false;
|
if(! b.getRequirement().matches(origin.getWorld(), (int) rot.getX() + origin.getBlockX(), origin.getBlockY() + b.getY(), (int) rot.getZ() + origin.getBlockZ()))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -164,15 +163,16 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste structure at an origin location, confined to a single chunk.
|
* Paste structure at an origin location, confined to a single chunk.
|
||||||
|
*
|
||||||
* @param origin Origin location
|
* @param origin Origin location
|
||||||
* @param chunk Chunk to confine pasting to
|
* @param chunk Chunk to confine pasting to
|
||||||
* @param r Rotation
|
* @param r Rotation
|
||||||
*/
|
*/
|
||||||
public void paste(Location origin, Chunk chunk, Rotation r) {
|
public void paste(Location origin, Chunk chunk, Rotation r) {
|
||||||
int xOr = (chunk.getX() << 4);
|
int xOr = (chunk.getX() << 4);
|
||||||
int zOr = (chunk.getZ() << 4);
|
int zOr = (chunk.getZ() << 4);
|
||||||
Range intersectX = new Range(xOr, xOr+16).sub(origin.getBlockX() - structureInfo.getCenterX());
|
Range intersectX = new Range(xOr, xOr + 16).sub(origin.getBlockX() - structureInfo.getCenterX());
|
||||||
Range intersectZ = new Range(zOr, zOr+16).sub(origin.getBlockZ() - structureInfo.getCenterZ());
|
Range intersectZ = new Range(zOr, zOr + 16).sub(origin.getBlockZ() - structureInfo.getCenterZ());
|
||||||
if(intersectX == null || intersectZ == null) return;
|
if(intersectX == null || intersectZ == null) return;
|
||||||
executeForBlocksInRange(intersectX, getRange(Axis.Y, r), intersectZ, block -> pasteBlock(block, origin, r), r);
|
executeForBlocksInRange(intersectX, getRange(Axis.Y, r), intersectZ, block -> pasteBlock(block, origin, r), r);
|
||||||
Debug.info(intersectX.toString() + " : " + intersectZ.toString());
|
Debug.info(intersectX.toString() + " : " + intersectZ.toString());
|
||||||
@@ -180,17 +180,19 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste a single StructureDefinedBlock at an origin location, offset by its coordinates.
|
* Paste a single StructureDefinedBlock at an origin location, offset by its coordinates.
|
||||||
* @param block The block to paste
|
*
|
||||||
|
* @param block The block to paste
|
||||||
* @param origin The origin location
|
* @param origin The origin location
|
||||||
* @param r The rotation of the structure
|
* @param r The rotation of the structure
|
||||||
*/
|
*/
|
||||||
private void pasteBlock(StructureContainedBlock block, Location origin, Rotation r) {
|
private void pasteBlock(StructureContainedBlock block, Location origin, Rotation r) {
|
||||||
BlockData data = block.getBlockData().clone();
|
BlockData data = block.getBlockData().clone();
|
||||||
if(!data.getMaterial().equals(Material.STRUCTURE_VOID)) {
|
if(! data.getMaterial().equals(Material.STRUCTURE_VOID)) {
|
||||||
|
|
||||||
Location loc = origin.clone().add(block.getX(), block.getY(), block.getZ());
|
Location loc = origin.clone().add(block.getX(), block.getY(), block.getZ());
|
||||||
Block worldBlock = loc.getBlock();
|
Block worldBlock = loc.getBlock();
|
||||||
main: while(worldBlock.isEmpty()) {
|
main:
|
||||||
|
while(worldBlock.isEmpty()) {
|
||||||
if(loc.getBlockY() > 255 || loc.getBlockY() < 0) return;
|
if(loc.getBlockY() > 255 || loc.getBlockY() < 0) return;
|
||||||
if(block.getPull() == null) break;
|
if(block.getPull() == null) break;
|
||||||
switch(block.getPull()) {
|
switch(block.getPull()) {
|
||||||
@@ -200,12 +202,14 @@ public class Structure implements Serializable {
|
|||||||
case DOWN:
|
case DOWN:
|
||||||
worldBlock = worldBlock.getRelative(BlockFace.DOWN);
|
worldBlock = worldBlock.getRelative(BlockFace.DOWN);
|
||||||
break;
|
break;
|
||||||
default: break main;
|
default:
|
||||||
|
break main;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
int offset = block.getPullOffset();
|
int offset = block.getPullOffset();
|
||||||
if(offset != 0) worldBlock = worldBlock.getRelative((offset > 0) ? BlockFace.UP : BlockFace.DOWN, Math.abs(offset));
|
if(offset != 0)
|
||||||
|
worldBlock = worldBlock.getRelative((offset > 0) ? BlockFace.UP : BlockFace.DOWN, Math.abs(offset));
|
||||||
|
|
||||||
if(data instanceof Rotatable) {
|
if(data instanceof Rotatable) {
|
||||||
BlockFace rt = getRotatedFace(((Rotatable) data).getRotation(), r);
|
BlockFace rt = getRotatedFace(((Rotatable) data).getRotation(), r);
|
||||||
@@ -247,17 +251,18 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a Consumer for all blocks in a cuboid region defined by 3 Ranges, accounting for rotation.
|
* Execute a Consumer for all blocks in a cuboid region defined by 3 Ranges, accounting for rotation.
|
||||||
* @param xM X Range
|
*
|
||||||
* @param yM Y Range
|
* @param xM X Range
|
||||||
* @param zM Z Range
|
* @param yM Y Range
|
||||||
|
* @param zM Z Range
|
||||||
* @param exec Consumer to execute for each block.
|
* @param exec Consumer to execute for each block.
|
||||||
* @param r Rotation
|
* @param r Rotation
|
||||||
*/
|
*/
|
||||||
private void executeForBlocksInRange(Range xM, Range yM, Range zM, Consumer<StructureContainedBlock> exec, Rotation r) {
|
private void executeForBlocksInRange(Range xM, Range yM, Range zM, Consumer<StructureContainedBlock> exec, Rotation r) {
|
||||||
for(int x : xM) {
|
for(int x : xM) {
|
||||||
for(int y : yM) {
|
for(int y : yM) {
|
||||||
for(int z : zM) {
|
for(int z : zM) {
|
||||||
Vector2 c = getRotatedCoords(new Vector2(x-structureInfo.getCenterX(), z-structureInfo.getCenterZ()), r);
|
Vector2 c = getRotatedCoords(new Vector2(x - structureInfo.getCenterX(), z - structureInfo.getCenterZ()), r);
|
||||||
c.add(new Vector2(structureInfo.getCenterX(), structureInfo.getCenterZ()));
|
c.add(new Vector2(structureInfo.getCenterX(), structureInfo.getCenterZ()));
|
||||||
if(isInStructure((int) c.getX(), y, (int) c.getZ())) {
|
if(isInStructure((int) c.getX(), y, (int) c.getZ())) {
|
||||||
StructureContainedBlock b = structure[(int) c.getX()][(int) c.getZ()][y];
|
StructureContainedBlock b = structure[(int) c.getX()][(int) c.getZ()][y];
|
||||||
@@ -270,6 +275,7 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether a set of coordinates is within the current structure
|
* Test whether a set of coordinates is within the current structure
|
||||||
|
*
|
||||||
* @param x X coordinate
|
* @param x X coordinate
|
||||||
* @param y Y coordinate
|
* @param y Y coordinate
|
||||||
* @param z Z coordinate
|
* @param z Z coordinate
|
||||||
@@ -281,6 +287,7 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* From an origin location (First bound) fetch the second bound.
|
* From an origin location (First bound) fetch the second bound.
|
||||||
|
*
|
||||||
* @param origin Origin location
|
* @param origin Origin location
|
||||||
* @return Other bound location
|
* @return Other bound location
|
||||||
*/
|
*/
|
||||||
@@ -290,6 +297,7 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the structure to a file
|
* Save the structure to a file
|
||||||
|
*
|
||||||
* @param f File to save to
|
* @param f File to save to
|
||||||
* @throws IOException If file access error occurs
|
* @throws IOException If file access error occurs
|
||||||
*/
|
*/
|
||||||
@@ -299,9 +307,10 @@ public class Structure implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a structure from a file.
|
* Load a structure from a file.
|
||||||
|
*
|
||||||
* @param f File to load from
|
* @param f File to load from
|
||||||
* @return The structure loaded
|
* @return The structure loaded
|
||||||
* @throws IOException If file access error occurs
|
* @throws IOException If file access error occurs
|
||||||
* @throws ClassNotFoundException If structure data is invalid.
|
* @throws ClassNotFoundException If structure data is invalid.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -345,8 +354,10 @@ public class Structure implements Serializable {
|
|||||||
Vector2 min = getRotatedCoords(new Vector2(x.getMin(), z.getMin()).subtract(center), r.inverse()).add(center);
|
Vector2 min = getRotatedCoords(new Vector2(x.getMin(), z.getMin()).subtract(center), r.inverse()).add(center);
|
||||||
Vector2 max = getRotatedCoords(new Vector2(x.getMax(), z.getMax()).subtract(center), r.inverse()).add(center);
|
Vector2 max = getRotatedCoords(new Vector2(x.getMax(), z.getMax()).subtract(center), r.inverse()).add(center);
|
||||||
|
|
||||||
if(a.equals(Axis.X)) return new Range((int) Math.floor(Math.min(min.getX(), max.getX())), (int) Math.ceil(Math.max(min.getX(), max.getX())) + 1);
|
if(a.equals(Axis.X))
|
||||||
else return new Range((int) Math.floor(Math.min(min.getZ(), max.getZ())), (int) Math.ceil(Math.max(min.getZ(), max.getZ())) + 1);
|
return new Range((int) Math.floor(Math.min(min.getX(), max.getX())), (int) Math.ceil(Math.max(min.getX(), max.getX())) + 1);
|
||||||
|
else
|
||||||
|
return new Range((int) Math.floor(Math.min(min.getZ(), max.getZ())), (int) Math.ceil(Math.max(min.getZ(), max.getZ())) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -358,16 +369,19 @@ public class Structure implements Serializable {
|
|||||||
return new Range(0, structureInfo.getSizeY());
|
return new Range(0, structureInfo.getSizeY());
|
||||||
case Z:
|
case Z:
|
||||||
return new Range(0, structureInfo.getSizeZ());
|
return new Range(0, structureInfo.getSizeZ());
|
||||||
default: throw new IllegalArgumentException();
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Axis {
|
public enum Axis {
|
||||||
X, Y, Z
|
X, Y, Z
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Rotation {
|
public enum Rotation {
|
||||||
CW_90(90), CW_180(180), CCW_90(270), NONE(0);
|
CW_90(90), CW_180(180), CCW_90(270), NONE(0);
|
||||||
private final int degrees;
|
private final int degrees;
|
||||||
|
|
||||||
Rotation(int degrees) {
|
Rotation(int degrees) {
|
||||||
this.degrees = degrees;
|
this.degrees = degrees;
|
||||||
}
|
}
|
||||||
@@ -375,22 +389,34 @@ public class Structure implements Serializable {
|
|||||||
public int getDegrees() {
|
public int getDegrees() {
|
||||||
return degrees;
|
return degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Rotation fromDegrees(int deg) {
|
public static Rotation fromDegrees(int deg) {
|
||||||
switch(Math.floorMod(deg, 360)) {
|
switch(Math.floorMod(deg, 360)) {
|
||||||
case 0: return Rotation.NONE;
|
case 0:
|
||||||
case 90: return Rotation.CW_90;
|
return Rotation.NONE;
|
||||||
case 180: return Rotation.CW_180;
|
case 90:
|
||||||
case 270: return Rotation.CCW_90;
|
return Rotation.CW_90;
|
||||||
default: throw new IllegalArgumentException();
|
case 180:
|
||||||
|
return Rotation.CW_180;
|
||||||
|
case 270:
|
||||||
|
return Rotation.CCW_90;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rotation inverse() {
|
public Rotation inverse() {
|
||||||
switch(this) {
|
switch(this) {
|
||||||
case NONE: return NONE;
|
case NONE:
|
||||||
case CCW_90: return CW_90;
|
return NONE;
|
||||||
case CW_90: return CCW_90;
|
case CCW_90:
|
||||||
case CW_180: return CW_180;
|
return CW_90;
|
||||||
default: throw new IllegalArgumentException();
|
case CW_90:
|
||||||
|
return CCW_90;
|
||||||
|
case CW_180:
|
||||||
|
return CW_180;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,15 +25,16 @@ public class StructureContainedBlock implements Serializable {
|
|||||||
private final int z;
|
private final int z;
|
||||||
private final SerializableBlockState state;
|
private final SerializableBlockState state;
|
||||||
private final StructureSpawnRequirement requirement;
|
private final StructureSpawnRequirement requirement;
|
||||||
|
|
||||||
public StructureContainedBlock(int x, int y, int z, BlockState state, BlockData d, StructureSpawnRequirement spawn, Pull pull, int pullOffset) {
|
public StructureContainedBlock(int x, int y, int z, BlockState state, BlockData d, StructureSpawnRequirement spawn, Pull pull, int pullOffset) {
|
||||||
if(state instanceof Sign) {
|
if(state instanceof Sign) {
|
||||||
Debug.info("Sign at (" + x + ", " + y + ", " + z + ").");
|
Debug.info("Sign at (" + x + ", " + y + ", " + z + ").");
|
||||||
this.state = new SerializableSign((org.bukkit.block.Sign) state);
|
this.state = new SerializableSign((org.bukkit.block.Sign) state);
|
||||||
} else if(state instanceof CreatureSpawner) {
|
} else if(state instanceof CreatureSpawner) {
|
||||||
Debug.info("Monster Spawner at (" + x + ", " + y + ", " + z + ").");
|
Debug.info("Monster Spawner at (" + x + ", " + y + ", " + z + ").");
|
||||||
this.state = new SerializableMonsterCage((CreatureSpawner) state);
|
this.state = new SerializableMonsterCage((CreatureSpawner) state);
|
||||||
} else if(state instanceof Banner) {
|
} else if(state instanceof Banner) {
|
||||||
Debug.info("Banner at (" + x + ", " + y + ", " + z + ").");
|
Debug.info("Banner at (" + x + ", " + y + ", " + z + ").");
|
||||||
this.state = new SerializableBanner((Banner) state);
|
this.state = new SerializableBanner((Banner) state);
|
||||||
} else this.state = null;
|
} else this.state = null;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@@ -44,6 +45,7 @@ public class StructureContainedBlock implements Serializable {
|
|||||||
this.pull = pull;
|
this.pull = pull;
|
||||||
this.pullOffset = pullOffset;
|
this.pullOffset = pullOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StructureContainedBlock(int x, int y, int z, SerializableBlockState state, BlockData d, StructureSpawnRequirement spawn, Pull pull, int pullOffset) {
|
public StructureContainedBlock(int x, int y, int z, SerializableBlockState state, BlockData d, StructureSpawnRequirement spawn, Pull pull, int pullOffset) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class StructureContainedInventory implements Serializable {
|
public class StructureContainedInventory implements Serializable {
|
||||||
public static final long serialVersionUID = -175339605585943678L;
|
public static final long serialVersionUID = - 175339605585943678L;
|
||||||
private final int uid;
|
private final int uid;
|
||||||
private final int x, y, z;
|
private final int x, y, z;
|
||||||
|
|
||||||
public StructureContainedInventory(Inventory orig, StructureContainedBlock link) {
|
public StructureContainedInventory(Inventory orig, StructureContainedBlock link) {
|
||||||
ItemStack stack = orig.getItem(0);
|
ItemStack stack = orig.getItem(0);
|
||||||
x = link.getX();
|
x = link.getX();
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.dfsek.terra.structure;
|
package com.dfsek.terra.structure;
|
||||||
|
|
||||||
import com.dfsek.terra.procgen.math.Vector2;
|
import com.dfsek.terra.procgen.math.Vector2;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class StructureInfo implements Serializable {
|
public class StructureInfo implements Serializable {
|
||||||
public static final long serialVersionUID = -175639605885943678L;
|
public static final long serialVersionUID = - 175639605885943678L;
|
||||||
private final int sizeX;
|
private final int sizeX;
|
||||||
private final int sizeY;
|
private final int sizeY;
|
||||||
private final int sizeZ;
|
private final int sizeZ;
|
||||||
private final int centerX;
|
private final int centerX;
|
||||||
private final int centerZ;
|
private final int centerZ;
|
||||||
|
|
||||||
public StructureInfo(int sizeX, int sizeY, int sizeZ, Vector2 center) {
|
public StructureInfo(int sizeX, int sizeY, int sizeZ, Vector2 center) {
|
||||||
this.sizeX = sizeX;
|
this.sizeX = sizeX;
|
||||||
this.sizeY = sizeY;
|
this.sizeY = sizeY;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.structure;
|
|||||||
import com.dfsek.terra.TerraWorld;
|
import com.dfsek.terra.TerraWorld;
|
||||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.polydev.gaea.generation.GenerationPhase;
|
import org.polydev.gaea.generation.GenerationPhase;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
@@ -41,12 +40,15 @@ public enum StructureSpawnRequirement implements Serializable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final long serialVersionUID = -175639605885943679L;
|
private static final long serialVersionUID = - 175639605885943679L;
|
||||||
private static final transient Map<World, FastNoiseLite> noiseMap = new HashMap<>();
|
private static final transient Map<World, FastNoiseLite> noiseMap = new HashMap<>();
|
||||||
|
|
||||||
public abstract boolean matches(World w, int x, int y, int z);
|
public abstract boolean matches(World w, int x, int y, int z);
|
||||||
|
|
||||||
public static void putNoise(World w, FastNoiseLite noise) {
|
public static void putNoise(World w, FastNoiseLite noise) {
|
||||||
noiseMap.putIfAbsent(w, noise);
|
noiseMap.putIfAbsent(w, noise);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FastNoiseLite getNoise(World w) {
|
private static FastNoiseLite getNoise(World w) {
|
||||||
return noiseMap.get(w);
|
return noiseMap.get(w);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import java.io.Serializable;
|
|||||||
public class SerializableBlockData implements Serializable {
|
public class SerializableBlockData implements Serializable {
|
||||||
public static final long serialVersionUID = 5298928608478640008L;
|
public static final long serialVersionUID = 5298928608478640008L;
|
||||||
private final String data;
|
private final String data;
|
||||||
|
|
||||||
public SerializableBlockData(BlockData d) {
|
public SerializableBlockData(BlockData d) {
|
||||||
this.data = d.getAsString(false);
|
this.data = d.getAsString(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockData getData() {
|
public BlockData getData() {
|
||||||
return Bukkit.createBlockData(data);
|
return Bukkit.createBlockData(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.dfsek.terra.structure.serialize.block;
|
|||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.block.Banner;
|
import org.bukkit.block.Banner;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Sign;
|
|
||||||
import org.bukkit.block.banner.Pattern;
|
|
||||||
import org.bukkit.block.banner.PatternType;
|
import org.bukkit.block.banner.PatternType;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -24,7 +22,7 @@ public class SerializableBanner implements SerializableBlockState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getState(BlockState orig) {
|
public BlockState getState(BlockState orig) {
|
||||||
if(!(orig instanceof Banner)) throw new IllegalArgumentException("Provided BlockState is not a banner.");
|
if(! (orig instanceof Banner)) throw new IllegalArgumentException("Provided BlockState is not a banner.");
|
||||||
Banner banner = (Banner) orig;
|
Banner banner = (Banner) orig;
|
||||||
banner.setBaseColor(base);
|
banner.setBaseColor(base);
|
||||||
for(Pattern pattern : patterns) {
|
for(Pattern pattern : patterns) {
|
||||||
@@ -32,9 +30,11 @@ public class SerializableBanner implements SerializableBlockState {
|
|||||||
}
|
}
|
||||||
return banner;
|
return banner;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class Pattern implements Serializable {
|
private static final class Pattern implements Serializable {
|
||||||
private final DyeColor color;
|
private final DyeColor color;
|
||||||
private final PatternType type;
|
private final PatternType type;
|
||||||
|
|
||||||
public Pattern(PatternType type, DyeColor color) {
|
public Pattern(PatternType type, DyeColor color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
public interface SerializableBlockState extends Serializable {
|
public interface SerializableBlockState extends Serializable {
|
||||||
long serialVersionUID = 5298928608478640000L;
|
long serialVersionUID = 5298928608478640000L;
|
||||||
|
|
||||||
BlockState getState(BlockState orig);
|
BlockState getState(BlockState orig);
|
||||||
}
|
}
|
||||||
+4
-4
@@ -3,9 +3,6 @@ package com.dfsek.terra.structure.serialize.block;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.polydev.gaea.math.Range;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SerializableMonsterCage implements SerializableBlockState {
|
public class SerializableMonsterCage implements SerializableBlockState {
|
||||||
public static final long serialVersionUID = 529892860847864007L;
|
public static final long serialVersionUID = 529892860847864007L;
|
||||||
@@ -16,6 +13,7 @@ public class SerializableMonsterCage implements SerializableBlockState {
|
|||||||
private final int playerRange;
|
private final int playerRange;
|
||||||
private final int delay;
|
private final int delay;
|
||||||
private final int count;
|
private final int count;
|
||||||
|
|
||||||
public SerializableMonsterCage(CreatureSpawner orig) {
|
public SerializableMonsterCage(CreatureSpawner orig) {
|
||||||
this.type = orig.getSpawnedType();
|
this.type = orig.getSpawnedType();
|
||||||
this.minDelay = orig.getMinSpawnDelay();
|
this.minDelay = orig.getMinSpawnDelay();
|
||||||
@@ -25,9 +23,11 @@ public class SerializableMonsterCage implements SerializableBlockState {
|
|||||||
this.delay = orig.getDelay();
|
this.delay = orig.getDelay();
|
||||||
this.count = orig.getSpawnCount();
|
this.count = orig.getSpawnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getState(BlockState orig) {
|
public BlockState getState(BlockState orig) {
|
||||||
if(!(orig instanceof CreatureSpawner)) throw new IllegalArgumentException("BlockState is not a Monster Spawner!");
|
if(! (orig instanceof CreatureSpawner))
|
||||||
|
throw new IllegalArgumentException("BlockState is not a Monster Spawner!");
|
||||||
CreatureSpawner spawner = (CreatureSpawner) orig;
|
CreatureSpawner spawner = (CreatureSpawner) orig;
|
||||||
spawner.setSpawnedType(type);
|
spawner.setSpawnedType(type);
|
||||||
spawner.setMinSpawnDelay(minDelay);
|
spawner.setMinSpawnDelay(minDelay);
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ public class SerializableSign implements SerializableBlockState {
|
|||||||
public static final long serialVersionUID = 5298928608478640001L;
|
public static final long serialVersionUID = 5298928608478640001L;
|
||||||
private final String[] text;
|
private final String[] text;
|
||||||
private final boolean isEditable;
|
private final boolean isEditable;
|
||||||
|
|
||||||
public SerializableSign(Sign orig) {
|
public SerializableSign(Sign orig) {
|
||||||
text = orig.getLines();
|
text = orig.getLines();
|
||||||
this.isEditable = orig.isEditable();
|
this.isEditable = orig.isEditable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getState(BlockState orig) {
|
public BlockState getState(BlockState orig) {
|
||||||
if(!(orig instanceof Sign)) throw new IllegalArgumentException("Provided BlockState is not a sign.");
|
if(! (orig instanceof Sign)) throw new IllegalArgumentException("Provided BlockState is not a sign.");
|
||||||
Sign sign = (Sign) orig;
|
Sign sign = (Sign) orig;
|
||||||
for(int i = 0; i < text.length; i++) {
|
for(int i = 0; i < text.length; i++) {
|
||||||
sign.setLine(i, text[i]);
|
sign.setLine(i, text[i]);
|
||||||
@@ -25,6 +27,7 @@ public class SerializableSign implements SerializableBlockState {
|
|||||||
public String[] getLines() {
|
public String[] getLines() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLine(int index) {
|
public String getLine(int index) {
|
||||||
return text[index];
|
return text[index];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.logging.Level;
|
|||||||
public final class PaperUtil {
|
public final class PaperUtil {
|
||||||
public static void checkPaper(JavaPlugin main) {
|
public static void checkPaper(JavaPlugin main) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(main, () -> {
|
||||||
if(!PaperLib.isPaper()) {
|
if(! PaperLib.isPaper()) {
|
||||||
LangUtil.log("use-paper", Level.WARNING);
|
LangUtil.log("use-paper", Level.WARNING);
|
||||||
}
|
}
|
||||||
}, 100L);
|
}, 100L);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public enum StructureTypeEnum {
|
|||||||
NETHER_FOSSIL(StructureType.NETHER_FOSSIL),
|
NETHER_FOSSIL(StructureType.NETHER_FOSSIL),
|
||||||
RUINED_PORTAL(StructureType.RUINED_PORTAL),
|
RUINED_PORTAL(StructureType.RUINED_PORTAL),
|
||||||
BASTION_REMNANT(StructureType.BASTION_REMNANT);
|
BASTION_REMNANT(StructureType.BASTION_REMNANT);
|
||||||
|
|
||||||
StructureTypeEnum(StructureType type) {
|
StructureTypeEnum(StructureType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,21 +8,22 @@ import org.bukkit.block.data.Rail;
|
|||||||
public final class RotationUtil {
|
public final class RotationUtil {
|
||||||
/**
|
/**
|
||||||
* Rotate and mirror a coordinate pair.
|
* Rotate and mirror a coordinate pair.
|
||||||
|
*
|
||||||
* @param orig Vector to rotate.
|
* @param orig Vector to rotate.
|
||||||
* @param r Rotation
|
* @param r Rotation
|
||||||
* @return Rotated coordinate pair
|
* @return Rotated coordinate pair
|
||||||
*/
|
*/
|
||||||
public static Vector2 getRotatedCoords(Vector2 orig, Structure.Rotation r) {
|
public static Vector2 getRotatedCoords(Vector2 orig, Structure.Rotation r) {
|
||||||
Vector2 copy = orig.clone();
|
Vector2 copy = orig.clone();
|
||||||
switch(r) {
|
switch(r) {
|
||||||
case CW_90:
|
case CW_90:
|
||||||
copy.setX(orig.getZ()).setZ(-orig.getX());
|
copy.setX(orig.getZ()).setZ(- orig.getX());
|
||||||
break;
|
break;
|
||||||
case CCW_90:
|
case CCW_90:
|
||||||
copy.setX(-orig.getZ()).setZ(orig.getX());
|
copy.setX(- orig.getZ()).setZ(orig.getX());
|
||||||
break;
|
break;
|
||||||
case CW_180:
|
case CW_180:
|
||||||
copy.multiply(-1);
|
copy.multiply(- 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
@@ -30,16 +31,17 @@ public final class RotationUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the BlockFace with rotation and mirrors applied to it
|
* Get the BlockFace with rotation and mirrors applied to it
|
||||||
|
*
|
||||||
* @param f BlockFace to apply rotation to
|
* @param f BlockFace to apply rotation to
|
||||||
* @param r Rotation
|
* @param r Rotation
|
||||||
* @return Rotated BlockFace
|
* @return Rotated BlockFace
|
||||||
*/
|
*/
|
||||||
public static BlockFace getRotatedFace(BlockFace f, Structure.Rotation r) {
|
public static BlockFace getRotatedFace(BlockFace f, Structure.Rotation r) {
|
||||||
BlockFace n = f;
|
BlockFace n = f;
|
||||||
int rotateNum = r.getDegrees()/90;
|
int rotateNum = r.getDegrees() / 90;
|
||||||
int rn = faceRotation(f);
|
int rn = faceRotation(f);
|
||||||
if(rn >= 0) {
|
if(rn >= 0) {
|
||||||
n = fromRotation(faceRotation(n) + 4*rotateNum);
|
n = fromRotation(faceRotation(n) + 4 * rotateNum);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@@ -61,50 +63,81 @@ public final class RotationUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to rotate the incredibly obnoxious Rail.Shape enum
|
* Method to rotate the incredibly obnoxious Rail.Shape enum
|
||||||
|
*
|
||||||
* @param orig Original shape
|
* @param orig Original shape
|
||||||
* @param r Rotate
|
* @param r Rotate
|
||||||
* @return Rotated/mirrored shape
|
* @return Rotated/mirrored shape
|
||||||
*/
|
*/
|
||||||
public static Rail.Shape getRotatedRail(Rail.Shape orig, Structure.Rotation r) {
|
public static Rail.Shape getRotatedRail(Rail.Shape orig, Structure.Rotation r) {
|
||||||
switch(r) {
|
switch(r) {
|
||||||
case CCW_90:
|
case CCW_90:
|
||||||
switch(orig) {
|
switch(orig) {
|
||||||
case NORTH_WEST: return Rail.Shape.SOUTH_WEST;
|
case NORTH_WEST:
|
||||||
case NORTH_SOUTH: return Rail.Shape.EAST_WEST;
|
return Rail.Shape.SOUTH_WEST;
|
||||||
case SOUTH_WEST: return Rail.Shape.SOUTH_EAST;
|
case NORTH_SOUTH:
|
||||||
case SOUTH_EAST: return Rail.Shape.NORTH_EAST;
|
return Rail.Shape.EAST_WEST;
|
||||||
case EAST_WEST: return Rail.Shape.NORTH_SOUTH;
|
case SOUTH_WEST:
|
||||||
case NORTH_EAST: return Rail.Shape.NORTH_WEST;
|
return Rail.Shape.SOUTH_EAST;
|
||||||
case ASCENDING_EAST: return Rail.Shape.ASCENDING_NORTH;
|
case SOUTH_EAST:
|
||||||
case ASCENDING_WEST: return Rail.Shape.ASCENDING_SOUTH;
|
return Rail.Shape.NORTH_EAST;
|
||||||
case ASCENDING_NORTH: return Rail.Shape.ASCENDING_WEST;
|
case EAST_WEST:
|
||||||
case ASCENDING_SOUTH: return Rail.Shape.ASCENDING_EAST;
|
return Rail.Shape.NORTH_SOUTH;
|
||||||
|
case NORTH_EAST:
|
||||||
|
return Rail.Shape.NORTH_WEST;
|
||||||
|
case ASCENDING_EAST:
|
||||||
|
return Rail.Shape.ASCENDING_NORTH;
|
||||||
|
case ASCENDING_WEST:
|
||||||
|
return Rail.Shape.ASCENDING_SOUTH;
|
||||||
|
case ASCENDING_NORTH:
|
||||||
|
return Rail.Shape.ASCENDING_WEST;
|
||||||
|
case ASCENDING_SOUTH:
|
||||||
|
return Rail.Shape.ASCENDING_EAST;
|
||||||
}
|
}
|
||||||
case CW_90:
|
case CW_90:
|
||||||
switch(orig) {
|
switch(orig) {
|
||||||
case NORTH_WEST: return Rail.Shape.NORTH_EAST;
|
case NORTH_WEST:
|
||||||
case NORTH_SOUTH: return Rail.Shape.EAST_WEST;
|
return Rail.Shape.NORTH_EAST;
|
||||||
case SOUTH_WEST: return Rail.Shape.NORTH_WEST;
|
case NORTH_SOUTH:
|
||||||
case SOUTH_EAST: return Rail.Shape.SOUTH_WEST;
|
return Rail.Shape.EAST_WEST;
|
||||||
case EAST_WEST: return Rail.Shape.NORTH_SOUTH;
|
case SOUTH_WEST:
|
||||||
case NORTH_EAST: return Rail.Shape.SOUTH_EAST;
|
return Rail.Shape.NORTH_WEST;
|
||||||
case ASCENDING_EAST: return Rail.Shape.ASCENDING_SOUTH;
|
case SOUTH_EAST:
|
||||||
case ASCENDING_WEST: return Rail.Shape.ASCENDING_NORTH;
|
return Rail.Shape.SOUTH_WEST;
|
||||||
case ASCENDING_NORTH: return Rail.Shape.ASCENDING_EAST;
|
case EAST_WEST:
|
||||||
case ASCENDING_SOUTH: return Rail.Shape.ASCENDING_WEST;
|
return Rail.Shape.NORTH_SOUTH;
|
||||||
|
case NORTH_EAST:
|
||||||
|
return Rail.Shape.SOUTH_EAST;
|
||||||
|
case ASCENDING_EAST:
|
||||||
|
return Rail.Shape.ASCENDING_SOUTH;
|
||||||
|
case ASCENDING_WEST:
|
||||||
|
return Rail.Shape.ASCENDING_NORTH;
|
||||||
|
case ASCENDING_NORTH:
|
||||||
|
return Rail.Shape.ASCENDING_EAST;
|
||||||
|
case ASCENDING_SOUTH:
|
||||||
|
return Rail.Shape.ASCENDING_WEST;
|
||||||
}
|
}
|
||||||
case CW_180:
|
case CW_180:
|
||||||
switch(orig) {
|
switch(orig) {
|
||||||
case NORTH_WEST: return Rail.Shape.SOUTH_EAST;
|
case NORTH_WEST:
|
||||||
case NORTH_SOUTH: return Rail.Shape.NORTH_SOUTH;
|
return Rail.Shape.SOUTH_EAST;
|
||||||
case SOUTH_WEST: return Rail.Shape.NORTH_EAST;
|
case NORTH_SOUTH:
|
||||||
case SOUTH_EAST: return Rail.Shape.NORTH_WEST;
|
return Rail.Shape.NORTH_SOUTH;
|
||||||
case EAST_WEST: return Rail.Shape.EAST_WEST;
|
case SOUTH_WEST:
|
||||||
case NORTH_EAST: return Rail.Shape.SOUTH_WEST;
|
return Rail.Shape.NORTH_EAST;
|
||||||
case ASCENDING_EAST: return Rail.Shape.ASCENDING_WEST;
|
case SOUTH_EAST:
|
||||||
case ASCENDING_WEST: return Rail.Shape.ASCENDING_EAST;
|
return Rail.Shape.NORTH_WEST;
|
||||||
case ASCENDING_NORTH: return Rail.Shape.ASCENDING_SOUTH;
|
case EAST_WEST:
|
||||||
case ASCENDING_SOUTH: return Rail.Shape.ASCENDING_NORTH;
|
return Rail.Shape.EAST_WEST;
|
||||||
|
case NORTH_EAST:
|
||||||
|
return Rail.Shape.SOUTH_WEST;
|
||||||
|
case ASCENDING_EAST:
|
||||||
|
return Rail.Shape.ASCENDING_WEST;
|
||||||
|
case ASCENDING_WEST:
|
||||||
|
return Rail.Shape.ASCENDING_EAST;
|
||||||
|
case ASCENDING_NORTH:
|
||||||
|
return Rail.Shape.ASCENDING_SOUTH;
|
||||||
|
case ASCENDING_SOUTH:
|
||||||
|
return Rail.Shape.ASCENDING_NORTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return orig;
|
return orig;
|
||||||
@@ -112,55 +145,91 @@ public final class RotationUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an integer representation of a BlockFace, to perform math on.
|
* Get an integer representation of a BlockFace, to perform math on.
|
||||||
|
*
|
||||||
* @param f BlockFace to get integer for
|
* @param f BlockFace to get integer for
|
||||||
* @return integer representation of BlockFace
|
* @return integer representation of BlockFace
|
||||||
*/
|
*/
|
||||||
public static int faceRotation(BlockFace f) {
|
public static int faceRotation(BlockFace f) {
|
||||||
switch(f) {
|
switch(f) {
|
||||||
case NORTH: return 0;
|
case NORTH:
|
||||||
case NORTH_NORTH_EAST: return 1;
|
return 0;
|
||||||
case NORTH_EAST: return 2;
|
case NORTH_NORTH_EAST:
|
||||||
case EAST_NORTH_EAST: return 3;
|
return 1;
|
||||||
case EAST: return 4;
|
case NORTH_EAST:
|
||||||
case EAST_SOUTH_EAST: return 5;
|
return 2;
|
||||||
case SOUTH_EAST: return 6;
|
case EAST_NORTH_EAST:
|
||||||
case SOUTH_SOUTH_EAST: return 7;
|
return 3;
|
||||||
case SOUTH: return 8;
|
case EAST:
|
||||||
case SOUTH_SOUTH_WEST: return 9;
|
return 4;
|
||||||
case SOUTH_WEST: return 10;
|
case EAST_SOUTH_EAST:
|
||||||
case WEST_SOUTH_WEST: return 11;
|
return 5;
|
||||||
case WEST: return 12;
|
case SOUTH_EAST:
|
||||||
case WEST_NORTH_WEST: return 13;
|
return 6;
|
||||||
case NORTH_WEST: return 14;
|
case SOUTH_SOUTH_EAST:
|
||||||
case NORTH_NORTH_WEST: return 15;
|
return 7;
|
||||||
default: return -1;
|
case SOUTH:
|
||||||
|
return 8;
|
||||||
|
case SOUTH_SOUTH_WEST:
|
||||||
|
return 9;
|
||||||
|
case SOUTH_WEST:
|
||||||
|
return 10;
|
||||||
|
case WEST_SOUTH_WEST:
|
||||||
|
return 11;
|
||||||
|
case WEST:
|
||||||
|
return 12;
|
||||||
|
case WEST_NORTH_WEST:
|
||||||
|
return 13;
|
||||||
|
case NORTH_WEST:
|
||||||
|
return 14;
|
||||||
|
case NORTH_NORTH_WEST:
|
||||||
|
return 15;
|
||||||
|
default:
|
||||||
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert integer to BlockFace representation
|
* Convert integer to BlockFace representation
|
||||||
|
*
|
||||||
* @param r integer to get BlockFace for
|
* @param r integer to get BlockFace for
|
||||||
* @return BlockFace represented by integer.
|
* @return BlockFace represented by integer.
|
||||||
*/
|
*/
|
||||||
public static BlockFace fromRotation(int r) {
|
public static BlockFace fromRotation(int r) {
|
||||||
switch(Math.floorMod(r, 16)) {
|
switch(Math.floorMod(r, 16)) {
|
||||||
case 0: return BlockFace.NORTH;
|
case 0:
|
||||||
case 1: return BlockFace.NORTH_NORTH_EAST;
|
return BlockFace.NORTH;
|
||||||
case 2: return BlockFace.NORTH_EAST;
|
case 1:
|
||||||
case 3: return BlockFace.EAST_NORTH_EAST;
|
return BlockFace.NORTH_NORTH_EAST;
|
||||||
case 4: return BlockFace.EAST;
|
case 2:
|
||||||
case 5: return BlockFace.EAST_SOUTH_EAST;
|
return BlockFace.NORTH_EAST;
|
||||||
case 6: return BlockFace.SOUTH_EAST;
|
case 3:
|
||||||
case 7: return BlockFace.SOUTH_SOUTH_EAST;
|
return BlockFace.EAST_NORTH_EAST;
|
||||||
case 8: return BlockFace.SOUTH;
|
case 4:
|
||||||
case 9: return BlockFace.SOUTH_SOUTH_WEST;
|
return BlockFace.EAST;
|
||||||
case 10: return BlockFace.SOUTH_WEST;
|
case 5:
|
||||||
case 11: return BlockFace.WEST_SOUTH_WEST;
|
return BlockFace.EAST_SOUTH_EAST;
|
||||||
case 12: return BlockFace.WEST;
|
case 6:
|
||||||
case 13: return BlockFace.WEST_NORTH_WEST;
|
return BlockFace.SOUTH_EAST;
|
||||||
case 14: return BlockFace.NORTH_WEST;
|
case 7:
|
||||||
case 15: return BlockFace.NORTH_NORTH_WEST;
|
return BlockFace.SOUTH_SOUTH_EAST;
|
||||||
default: throw new IllegalArgumentException();
|
case 8:
|
||||||
|
return BlockFace.SOUTH;
|
||||||
|
case 9:
|
||||||
|
return BlockFace.SOUTH_SOUTH_WEST;
|
||||||
|
case 10:
|
||||||
|
return BlockFace.SOUTH_WEST;
|
||||||
|
case 11:
|
||||||
|
return BlockFace.WEST_SOUTH_WEST;
|
||||||
|
case 12:
|
||||||
|
return BlockFace.WEST;
|
||||||
|
case 13:
|
||||||
|
return BlockFace.WEST_NORTH_WEST;
|
||||||
|
case 14:
|
||||||
|
return BlockFace.NORTH_WEST;
|
||||||
|
case 15:
|
||||||
|
return BlockFace.NORTH_NORTH_WEST;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,10 +14,11 @@ import org.bukkit.plugin.Plugin;
|
|||||||
public final class WorldEditUtil {
|
public final class WorldEditUtil {
|
||||||
public static WorldEditPlugin getWorldEdit() {
|
public static WorldEditPlugin getWorldEdit() {
|
||||||
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
|
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
|
||||||
if (p instanceof WorldEditPlugin) return (WorldEditPlugin) p;
|
if(p instanceof WorldEditPlugin) return (WorldEditPlugin) p;
|
||||||
Bukkit.getLogger().severe("[Terra] a command requiring WorldEdit was executed, but WorldEdit was not detected!");
|
Bukkit.getLogger().severe("[Terra] a command requiring WorldEdit was executed, but WorldEdit was not detected!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location[] getSelectionLocations(Player sender) {
|
public static Location[] getSelectionLocations(Player sender) {
|
||||||
WorldEditPlugin we = WorldEditUtil.getWorldEdit();
|
WorldEditPlugin we = WorldEditUtil.getWorldEdit();
|
||||||
if(we == null) {
|
if(we == null) {
|
||||||
@@ -27,7 +28,7 @@ public final class WorldEditUtil {
|
|||||||
Region selection;
|
Region selection;
|
||||||
try {
|
try {
|
||||||
selection = we.getSession(sender).getSelection(BukkitAdapter.adapt(sender.getWorld()));
|
selection = we.getSession(sender).getSelection(BukkitAdapter.adapt(sender.getWorld()));
|
||||||
} catch(IncompleteRegionException |ClassCastException e) {
|
} catch(IncompleteRegionException | ClassCastException e) {
|
||||||
sender.sendMessage("Invalid/incomplete selection!");
|
sender.sendMessage("Invalid/incomplete selection!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -41,6 +42,7 @@ public final class WorldEditUtil {
|
|||||||
Location l2 = new Location(sender.getWorld(), max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
Location l2 = new Location(sender.getWorld(), max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
||||||
return new Location[] {l1, l2};
|
return new Location[] {l1, l2};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location[] getSelectionPositions(Player sender) {
|
public static Location[] getSelectionPositions(Player sender) {
|
||||||
WorldEditPlugin we = WorldEditUtil.getWorldEdit();
|
WorldEditPlugin we = WorldEditUtil.getWorldEdit();
|
||||||
if(we == null) {
|
if(we == null) {
|
||||||
@@ -50,7 +52,7 @@ public final class WorldEditUtil {
|
|||||||
CuboidRegion selection;
|
CuboidRegion selection;
|
||||||
try {
|
try {
|
||||||
selection = (CuboidRegion) we.getSession(sender).getSelection(BukkitAdapter.adapt(sender.getWorld()));
|
selection = (CuboidRegion) we.getSession(sender).getSelection(BukkitAdapter.adapt(sender.getWorld()));
|
||||||
} catch(IncompleteRegionException |ClassCastException e) {
|
} catch(IncompleteRegionException | ClassCastException e) {
|
||||||
sender.sendMessage("Invalid/incomplete selection!");
|
sender.sendMessage("Invalid/incomplete selection!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,4 @@ trees:
|
|||||||
flora:
|
flora:
|
||||||
chance: 0
|
chance: 0
|
||||||
attempts: 0
|
attempts: 0
|
||||||
items: {}
|
items: { }
|
||||||
@@ -33,4 +33,4 @@ trees:
|
|||||||
flora:
|
flora:
|
||||||
chance: 0
|
chance: 0
|
||||||
attempts: 0
|
attempts: 0
|
||||||
items: {}
|
items: { }
|
||||||
@@ -33,4 +33,4 @@ trees:
|
|||||||
flora:
|
flora:
|
||||||
chance: 0
|
chance: 0
|
||||||
attempts: 0
|
attempts: 0
|
||||||
items: {}
|
items: { }
|
||||||
@@ -34,33 +34,33 @@ palette:
|
|||||||
- "minecraft:bedrock"
|
- "minecraft:bedrock"
|
||||||
- "minecraft:ice"
|
- "minecraft:ice"
|
||||||
layers:
|
layers:
|
||||||
- materials: {"minecraft:air": 1}
|
- materials: { "minecraft:air": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: {"minecraft:lava": 1}
|
- materials: { "minecraft:lava": 1 }
|
||||||
y: 8
|
y: 8
|
||||||
outer:
|
outer:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
replace: []
|
replace: [ ]
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
top:
|
top:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
replace: []
|
replace: [ ]
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
bottom:
|
bottom:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
replace: []
|
replace: [ ]
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
shift:
|
shift:
|
||||||
"minecraft:grass_block": ["minecraft:dirt"]
|
"minecraft:grass_block": [ "minecraft:dirt" ]
|
||||||
"minecraft:podzol": ["minecraft:dirt"]
|
"minecraft:podzol": [ "minecraft:dirt" ]
|
||||||
"minecraft:gravel": ["minecraft:dirt"]
|
"minecraft:gravel": [ "minecraft:dirt" ]
|
||||||
"minecraft:sand": ["minecraft:dirt"]
|
"minecraft:sand": [ "minecraft:dirt" ]
|
||||||
"minecraft:coarse_dirt": ["minecraft:dirt"]
|
"minecraft:coarse_dirt": [ "minecraft:dirt" ]
|
||||||
|
|
||||||
update: []
|
update: [ ]
|
||||||
@@ -36,11 +36,11 @@ palette:
|
|||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:air": 1 }
|
- materials: { "minecraft:air": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: {"minecraft:water": 1}
|
- materials: { "minecraft:water": 1 }
|
||||||
y: 62
|
y: 62
|
||||||
- materials: { "minecraft:lava": 1 }
|
- materials: { "minecraft:lava": 1 }
|
||||||
y: 7
|
y: 7
|
||||||
- materials: {"minecraft:obsidian": 19, "minecraft:magma_block": 1}
|
- materials: { "minecraft:obsidian": 19, "minecraft:magma_block": 1 }
|
||||||
y: 8
|
y: 8
|
||||||
outer:
|
outer:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
@@ -64,10 +64,10 @@ palette:
|
|||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
shift:
|
shift:
|
||||||
"minecraft:grass_block": ["minecraft:dirt"]
|
"minecraft:grass_block": [ "minecraft:dirt" ]
|
||||||
"minecraft:podzol": ["minecraft:dirt"]
|
"minecraft:podzol": [ "minecraft:dirt" ]
|
||||||
"minecraft:gravel": ["minecraft:dirt"]
|
"minecraft:gravel": [ "minecraft:dirt" ]
|
||||||
"minecraft:sand": ["minecraft:dirt"]
|
"minecraft:sand": [ "minecraft:dirt" ]
|
||||||
"minecraft:coarse_dirt": ["minecraft:dirt"]
|
"minecraft:coarse_dirt": [ "minecraft:dirt" ]
|
||||||
|
|
||||||
update: []
|
update: [ ]
|
||||||
@@ -36,11 +36,11 @@ palette:
|
|||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:air": 1 }
|
- materials: { "minecraft:air": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: {"minecraft:water": 1}
|
- materials: { "minecraft:water": 1 }
|
||||||
y: 48
|
y: 48
|
||||||
- materials: { "minecraft:lava": 1 }
|
- materials: { "minecraft:lava": 1 }
|
||||||
y: 7
|
y: 7
|
||||||
- materials: {"minecraft:obsidian": 19, "minecraft:magma_block": 1}
|
- materials: { "minecraft:obsidian": 19, "minecraft:magma_block": 1 }
|
||||||
y: 8
|
y: 8
|
||||||
outer:
|
outer:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
@@ -51,7 +51,7 @@ palette:
|
|||||||
y: 255
|
y: 255
|
||||||
- materials: { "minecraft:stone": 23, "minecraft:spruce_wood": 1, "minecraft:dark_oak_wood": 1 }
|
- materials: { "minecraft:stone": 23, "minecraft:spruce_wood": 1, "minecraft:dark_oak_wood": 1 }
|
||||||
y: 48
|
y: 48
|
||||||
- materials: { "minecraft:stone": 1}
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 18
|
y: 18
|
||||||
top:
|
top:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
@@ -77,9 +77,9 @@ palette:
|
|||||||
y: 18
|
y: 18
|
||||||
|
|
||||||
shift:
|
shift:
|
||||||
"minecraft:grass_block": ["minecraft:dirt"]
|
"minecraft:grass_block": [ "minecraft:dirt" ]
|
||||||
"minecraft:podzol": ["minecraft:dirt"]
|
"minecraft:podzol": [ "minecraft:dirt" ]
|
||||||
"minecraft:gravel": ["minecraft:dirt"]
|
"minecraft:gravel": [ "minecraft:dirt" ]
|
||||||
"minecraft:sand": ["minecraft:dirt"]
|
"minecraft:sand": [ "minecraft:dirt" ]
|
||||||
"minecraft:coarse_dirt": ["minecraft:dirt"]
|
"minecraft:coarse_dirt": [ "minecraft:dirt" ]
|
||||||
update: []
|
update: [ ]
|
||||||
@@ -43,14 +43,14 @@ palette:
|
|||||||
replace:
|
replace:
|
||||||
- "minecraft:stone"
|
- "minecraft:stone"
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:stone": 1, "minecraft:cobblestone": 1,"minecraft:snow_block": 1}
|
- materials: { "minecraft:stone": 1, "minecraft:cobblestone": 1,"minecraft:snow_block": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
outer:
|
outer:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
replace:
|
replace:
|
||||||
- "minecraft:stone"
|
- "minecraft:stone"
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:packed_ice": 1,"minecraft:snow_block": 1, "minecraft:stone": 2}
|
- materials: { "minecraft:packed_ice": 1,"minecraft:snow_block": 1, "minecraft:stone": 2 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 18
|
y: 18
|
||||||
@@ -59,15 +59,15 @@ palette:
|
|||||||
replace:
|
replace:
|
||||||
- "minecraft:stone"
|
- "minecraft:stone"
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:packed_ice": 4}
|
- materials: { "minecraft:packed_ice": 4 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 18
|
y: 18
|
||||||
|
|
||||||
shift:
|
shift:
|
||||||
"minecraft:grass_block": ["minecraft:dirt"]
|
"minecraft:grass_block": [ "minecraft:dirt" ]
|
||||||
"minecraft:podzol": ["minecraft:dirt"]
|
"minecraft:podzol": [ "minecraft:dirt" ]
|
||||||
"minecraft:gravel": ["minecraft:dirt"]
|
"minecraft:gravel": [ "minecraft:dirt" ]
|
||||||
"minecraft:sand": ["minecraft:dirt"]
|
"minecraft:sand": [ "minecraft:dirt" ]
|
||||||
"minecraft:coarse_dirt": ["minecraft:dirt"]
|
"minecraft:coarse_dirt": [ "minecraft:dirt" ]
|
||||||
update: []
|
update: [ ]
|
||||||
@@ -34,13 +34,13 @@ palette:
|
|||||||
- "minecraft:bedrock"
|
- "minecraft:bedrock"
|
||||||
- "minecraft:ice"
|
- "minecraft:ice"
|
||||||
layers:
|
layers:
|
||||||
- materials: {"minecraft:air": 1}
|
- materials: { "minecraft:air": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: {"minecraft:lava": 1}
|
- materials: { "minecraft:lava": 1 }
|
||||||
y: 8
|
y: 8
|
||||||
outer:
|
outer:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
replace: []
|
replace: [ ]
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
@@ -57,10 +57,10 @@ palette:
|
|||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
shift:
|
shift:
|
||||||
"minecraft:grass_block": ["minecraft:dirt"]
|
"minecraft:grass_block": [ "minecraft:dirt" ]
|
||||||
"minecraft:podzol": ["minecraft:dirt"]
|
"minecraft:podzol": [ "minecraft:dirt" ]
|
||||||
"minecraft:gravel": ["minecraft:dirt"]
|
"minecraft:gravel": [ "minecraft:dirt" ]
|
||||||
"minecraft:sand": ["minecraft:dirt"]
|
"minecraft:sand": [ "minecraft:dirt" ]
|
||||||
"minecraft:coarse_dirt": ["minecraft:dirt"]
|
"minecraft:coarse_dirt": [ "minecraft:dirt" ]
|
||||||
|
|
||||||
update: []
|
update: [ ]
|
||||||
@@ -34,13 +34,13 @@ palette:
|
|||||||
- "minecraft:bedrock"
|
- "minecraft:bedrock"
|
||||||
- "minecraft:ice"
|
- "minecraft:ice"
|
||||||
layers:
|
layers:
|
||||||
- materials: {"minecraft:air": 1}
|
- materials: { "minecraft:air": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
- materials: {"minecraft:lava": 1}
|
- materials: { "minecraft:lava": 1 }
|
||||||
y: 8
|
y: 8
|
||||||
outer:
|
outer:
|
||||||
replace-blacklist: false
|
replace-blacklist: false
|
||||||
replace: []
|
replace: [ ]
|
||||||
layers:
|
layers:
|
||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
@@ -57,10 +57,10 @@ palette:
|
|||||||
- materials: { "minecraft:stone": 1 }
|
- materials: { "minecraft:stone": 1 }
|
||||||
y: 255
|
y: 255
|
||||||
shift:
|
shift:
|
||||||
"minecraft:grass_block": ["minecraft:dirt"]
|
"minecraft:grass_block": [ "minecraft:dirt" ]
|
||||||
"minecraft:podzol": ["minecraft:dirt"]
|
"minecraft:podzol": [ "minecraft:dirt" ]
|
||||||
"minecraft:gravel": ["minecraft:dirt"]
|
"minecraft:gravel": [ "minecraft:dirt" ]
|
||||||
"minecraft:sand": ["minecraft:dirt"]
|
"minecraft:sand": [ "minecraft:dirt" ]
|
||||||
"minecraft:coarse_dirt": ["minecraft:dirt"]
|
"minecraft:coarse_dirt": [ "minecraft:dirt" ]
|
||||||
|
|
||||||
update: []
|
update: [ ]
|
||||||
@@ -7,7 +7,7 @@ layers:
|
|||||||
- "minecraft:cobblestone_wall": 1
|
- "minecraft:cobblestone_wall": 1
|
||||||
layers: 1
|
layers: 1
|
||||||
- materials:
|
- materials:
|
||||||
- "minecraft:cobblestone_wall": 1
|
- "minecraft:cobblestone_wall": 1
|
||||||
layers: 1
|
layers: 1
|
||||||
|
|
||||||
id: "STALAGMITE"
|
id: "STALAGMITE"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "BEACH", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "SWAMP", "SWAMP", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "SWAMP", "SWAMP", "WARM_BEACH", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
- ["FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "WARM_BEACH", "WARM_BEACH"]
|
- [ "FROZEN_BEACH", "FROZEN_BEACH", "COLD_BEACH", "COLD_BEACH", "BEACH", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "WARM_BEACH", "WARM_BEACH" ]
|
||||||
id: "BEACH"
|
id: "BEACH"
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
- ["TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "MESA", "MESA"]
|
- [ "TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "MESA", "MESA" ]
|
||||||
- ["TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "MESA", "MESA"]
|
- [ "TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "MESA", "MESA" ]
|
||||||
- ["TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "MESA", "MESA"]
|
- [ "TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "MESA", "MESA" ]
|
||||||
- ["TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "DESERT", "DESERT"]
|
- [ "TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "DESERT", "DESERT" ]
|
||||||
- ["TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "DESERT", "DESERT"]
|
- [ "TUNDRA", "TUNDRA", "TAIGA", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "DESERT", "DESERT", "DESERT", "DESERT" ]
|
||||||
- ["SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "SAVANNA", "SAVANNA"]
|
- [ "SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "SAVANNA", "SAVANNA", "SAVANNA", "SAVANNA" ]
|
||||||
- ["SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS"]
|
- [ "SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS", "PLAINS" ]
|
||||||
- ["SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE", "JUNGLE"]
|
- [ "SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE", "JUNGLE" ]
|
||||||
- ["SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE"]
|
- [ "SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE" ]
|
||||||
- ["SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE", "JUNGLE"]
|
- [ "SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE", "JUNGLE" ]
|
||||||
- ["SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE", "JUNGLE"]
|
- [ "SNOWY_TAIGA", "SNOWY_TAIGA", "TAIGA", "DARK_FOREST", "DARK_FOREST", "FOREST", "FOREST", "JUNGLE", "JUNGLE", "JUNGLE", "JUNGLE" ]
|
||||||
id: "LAND"
|
id: "LAND"
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS", "ARID_MOUNTAINS" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE" ]
|
||||||
- ["MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE"]
|
- [ "MOUNTAINS_STONE", "MOUNTAINS_STONE", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_PRETTY", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE", "MOUNTAINS_JUNGLE" ]
|
||||||
id: "MOUNTAIN"
|
id: "MOUNTAIN"
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0", "ARID_MOUNTAINS_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0" ]
|
||||||
- ["MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0"]
|
- [ "MOUNTAINS_STONE_0", "MOUNTAINS_STONE_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0", "MOUNTAINS_JUNGLE_0" ]
|
||||||
id: "MOUNTAIN_0"
|
id: "MOUNTAIN_0"
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1", "ARID_MOUNTAINS_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_0" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1" ]
|
||||||
- ["MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1"]
|
- [ "MOUNTAINS_STONE_1", "MOUNTAINS_STONE_1", "MOUNTAINS_PRETTY_0", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_PRETTY_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1", "MOUNTAINS_JUNGLE_1" ]
|
||||||
id: "MOUNTAIN_1"
|
id: "MOUNTAIN_1"
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
grid:
|
grid:
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "OCEAN", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "OCEAN", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "SWAMP", "SWAMP", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "SWAMP", "SWAMP", "LUKEWARM_OCEAN", "WARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "LUKEWARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "LUKEWARM_OCEAN", "WARM_OCEAN" ]
|
||||||
- ["FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "LUKEWARM_OCEAN", "WARM_OCEAN"]
|
- [ "FROZEN_OCEAN", "FROZEN_OCEAN", "COLD_OCEAN", "COLD_OCEAN", "OCEAN", "SWAMP", "SWAMP", "SWAMP", "SWAMP", "LUKEWARM_OCEAN", "WARM_OCEAN" ]
|
||||||
id: "OCEAN"
|
id: "OCEAN"
|
||||||
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user