Merge pull request #19 from budgidiere/master

Lots O Stuff
This commit is contained in:
dfsek 2020-11-20 15:59:27 -07:00 committed by GitHub
commit 0af101fbbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 59 additions and 1113 deletions

View File

@ -43,7 +43,6 @@ dependencies {
implementation("commons-io:commons-io:2.4")
implementation("org.apache.commons:commons-imaging:1.0-alpha2")
implementation("org.apache.commons:commons-math3:3.6.1")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT")
implementation("org.bstats:bstats-bukkit:1.7")
@ -55,7 +54,7 @@ dependencies {
compileOnly("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT")
implementation("io.papermc:paperlib:1.0.5")
implementation("it.unimi.dsi:dsiutils:2.6.14")
implementation("net.jafama:jafama:2.3.2")
// JUnit.
@ -107,7 +106,8 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
relocate("parsii", "com.dfsek.terra.lib.parsii")
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
relocate("it.unimi.dsi", "com.dfsek.terra.lib.unimi")
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
minimize()
}
tasks.build {

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,6 @@ import com.dfsek.terra.config.genconfig.TreeConfig;
import com.dfsek.terra.config.genconfig.structure.StructureConfig;
import com.dfsek.terra.registry.TreeRegistry;
import com.dfsek.terra.util.StructureTypeEnum;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
@ -24,6 +23,7 @@ import org.bukkit.event.world.StructureGrowEvent;
import org.polydev.gaea.GaeaPlugin;
import org.polydev.gaea.tree.Tree;
import org.polydev.gaea.tree.TreeType;
import org.polydev.gaea.util.FastRandom;
public class EventListener implements Listener {
private final GaeaPlugin main;
@ -81,9 +81,9 @@ public class EventListener implements Listener {
Tree tree = registry.get(TreeType.fromBukkit(e.getSpecies()).toString());
Debug.info("Overriding tree type: " + e.getSpecies());
if(tree instanceof TreeConfig) {
if(!((TreeConfig) tree).plantBlockCheck(e.getLocation(), new XoRoShiRo128PlusPlusRandom())) {
if(!((TreeConfig) tree).plantBlockCheck(e.getLocation(), new FastRandom())) {
block.setBlockData(data);
}
} else if(!tree.plant(e.getLocation(), new XoRoShiRo128PlusPlusRandom(), Terra.getInstance())) block.setBlockData(data);
} else if(!tree.plant(e.getLocation(), new FastRandom(), Terra.getInstance())) block.setBlockData(data);
}
}

View File

@ -6,11 +6,11 @@ import com.dfsek.terra.biome.grid.TerraBiomeGrid;
import com.dfsek.terra.config.genconfig.structure.StructureConfig;
import com.dfsek.terra.structure.Rotation;
import com.dfsek.terra.structure.Structure;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.util.FastRandom;
import java.util.Random;
import java.util.function.Consumer;
@ -36,7 +36,7 @@ public class AsyncStructureFinder extends AsyncFeatureFinder<StructureConfig> {
Location spawn = target.getSpawn().getChunkSpawn(x, z, world.getSeed()).toLocation(world);
if(!TerraWorld.getWorld(world).getConfig().getBiome((UserDefinedBiome) getGrid().getBiome(spawn)).getStructures().contains(target))
return false;
Random r2 = new XoRoShiRo128PlusPlusRandom(spawn.hashCode());
Random r2 = new FastRandom(spawn.hashCode());
Structure struc = target.getStructure(r2);
Rotation rotation = Rotation.fromDegrees(r2.nextInt(4) * 90);
for(int y = target.getSearchStart().get(r2); y > 0; y--) {

View File

@ -1,6 +1,6 @@
package com.dfsek.terra.biome.postprocessing;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.polydev.gaea.math.FastNoiseLite;
/**

View File

@ -4,12 +4,12 @@ import com.dfsek.terra.procgen.GridSpawn;
import com.dfsek.terra.procgen.voxel.DeformedSphere;
import com.dfsek.terra.procgen.voxel.Tube;
import com.dfsek.terra.procgen.voxel.VoxelGeometry;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.util.Vector;
import org.polydev.gaea.math.FastNoiseLite;
import org.polydev.gaea.math.MathUtil;
import org.polydev.gaea.util.FastRandom;
import java.util.Random;
@ -24,7 +24,7 @@ public class Cavern {
public VoxelGeometry carveChunk(int chunkX, int chunkZ) {
long seedC = MathUtil.getCarverChunkSeed(chunkX, chunkZ, seed);
Random chunk = new XoRoShiRo128PlusPlusRandom(seedC);
Random chunk = new FastRandom(seedC);
Vector org = node.getNodeLocation((chunkX << 4) + 8, (chunkZ << 4) + 8).clone().setY(chunk.nextInt(128));
VoxelGeometry carve = VoxelGeometry.getBlank();
@ -34,7 +34,7 @@ public class Cavern {
Bukkit.getLogger().info("Cavern: " + org.toString());
carve.merge(new DeformedSphere(org.clone(), chunk.nextInt(4) + 3, 0.75, smpl));
Vector _00 = new Vector(org.getX() + 16, new XoRoShiRo128PlusPlusRandom(MathUtil.getCarverChunkSeed(chunkX + 1, chunkZ, seed)).nextInt(128), org.getZ());
Vector _00 = new Vector(org.getX() + 16, new FastRandom(MathUtil.getCarverChunkSeed(chunkX + 1, chunkZ, seed)).nextInt(128), org.getZ());
carve.merge(new Tube(org, _00, 4));
return carve;

View File

@ -1,6 +1,6 @@
package com.dfsek.terra.carving;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.World;
import org.bukkit.util.Vector;
import org.polydev.gaea.math.FastNoiseLite;

View File

@ -3,12 +3,12 @@ package com.dfsek.terra.carving;
import com.dfsek.terra.TerraWorld;
import com.dfsek.terra.biome.UserDefinedBiome;
import com.dfsek.terra.config.base.ConfigPack;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.World;
import org.bukkit.util.Vector;
import org.polydev.gaea.generation.GenerationPhase;
import org.polydev.gaea.math.Range;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.carving.Carver;
import org.polydev.gaea.world.carving.Worm;
@ -41,7 +41,7 @@ public class UserDefinedCarver extends Carver {
@Override
public Worm getWorm(long l, Vector vector) {
Random r = new XoRoShiRo128PlusPlusRandom(l + hash);
Random r = new FastRandom(l + hash);
return new UserDefinedWorm(length.get(r) / 2, r, vector, radius.getMax(), topCut, bottomCut);
}
@ -60,7 +60,7 @@ public class UserDefinedCarver extends Carver {
@Override
public boolean isChunkCarved(World w, int chunkX, int chunkZ, Random random) {
ConfigPack c = TerraWorld.getWorld(w).getConfig();
return new XoRoShiRo128PlusPlusRandom(random.nextLong() + hash).nextInt(100) < c.getBiome((UserDefinedBiome) TerraWorld.getWorld(w).getGrid().getBiome(chunkX << 4, chunkZ << 4, GenerationPhase.POPULATE)).getCarverChance(this);
return new FastRandom(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 {

View File

@ -3,8 +3,7 @@ package com.dfsek.terra.command;
import com.dfsek.terra.TerraWorld;
import com.dfsek.terra.config.genconfig.OreConfig;
import com.dfsek.terra.config.lang.LangUtil;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
@ -13,6 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.command.WorldCommand;
import org.polydev.gaea.util.FastRandom;
import java.util.Collections;
import java.util.List;
@ -36,7 +36,7 @@ public class OreCommand extends WorldCommand {
return true;
}
Vector source = new Vector(FastMath.floorMod(bl.getX(), 16), bl.getY(), FastMath.floorMod(bl.getZ(), 16));
ore.doVein(source, bl.getChunk(), new XoRoShiRo128PlusPlusRandom());
ore.doVein(source, bl.getChunk(), new FastRandom());
} else {
LangUtil.send("command.ore.main-menu", sender);
}

View File

@ -4,8 +4,7 @@ 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.exception.ConfigException;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
@ -14,6 +13,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.InvalidConfigurationException;
import org.polydev.gaea.math.Range;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.Flora;
import org.polydev.gaea.world.palette.Palette;
import org.polydev.gaea.world.palette.RandomPalette;
@ -53,7 +53,7 @@ public class FloraConfig extends TerraConfig implements Flora {
physics = getBoolean("physics", false);
ceiling = getBoolean("ceiling", false);
Palette<BlockData> p = new RandomPalette<>(new XoRoShiRo128PlusPlusRandom(getInt("seed", 4)));
Palette<BlockData> p = new RandomPalette<>(new FastRandom(getInt("seed", 4)));
floraPalette = PaletteConfig.getPalette(getMapList("layers"), p);
}

View File

@ -4,7 +4,7 @@ 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.exception.ConfigException;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;

View File

@ -4,12 +4,12 @@ import com.dfsek.terra.Debug;
import com.dfsek.terra.config.TerraConfig;
import com.dfsek.terra.config.base.ConfigPack;
import com.dfsek.terra.config.exception.ConfigException;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Bukkit;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.InvalidConfigurationException;
import org.polydev.gaea.math.FastNoiseLite;
import org.polydev.gaea.math.ProbabilityCollection;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.palette.Palette;
import org.polydev.gaea.world.palette.RandomPalette;
import org.polydev.gaea.world.palette.SimplexPalette;
@ -36,7 +36,7 @@ public class PaletteConfig extends TerraConfig {
pNoise.setFractalOctaves(4);
pNoise.setFrequency(getDouble("frequency", 0.02));
pal = new SimplexPalette<>(pNoise);
} else pal = new RandomPalette<>(new XoRoShiRo128PlusPlusRandom(getInt("seed", 2403)));
} else pal = new RandomPalette<>(new FastRandom(getInt("seed", 2403)));
palette = getPalette(getMapList("layers"), pal);
}

View File

@ -4,18 +4,18 @@ import com.dfsek.terra.config.TerraConfig;
import com.dfsek.terra.config.TerraConfigSection;
import com.dfsek.terra.config.exception.ConfigException;
import com.dfsek.terra.config.exception.NotFoundException;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.InvalidConfigurationException;
import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.math.ProbabilityCollection;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.palette.Palette;
import org.polydev.gaea.world.palette.RandomPalette;
public class BiomeOceanConfig extends TerraConfigSection {
private static final Palette<BlockData> oceanDefault = new RandomPalette<BlockData>(new XoRoShiRo128PlusPlusRandom(0)).add(Material.WATER.createBlockData(), 1);
private static final Palette<BlockData> oceanDefault = new RandomPalette<BlockData>(new FastRandom(0)).add(Material.WATER.createBlockData(), 1);
private final Palette<BlockData> ocean;
private final int seaLevel;
@ -26,7 +26,7 @@ public class BiomeOceanConfig extends TerraConfigSection {
if(oceanN != null) {
if(oceanN.startsWith("BLOCK:")) {
try {
ocean = new RandomPalette<BlockData>(new XoRoShiRo128PlusPlusRandom(0)).add(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(oceanN.substring(6)), 1), 1);
ocean = new RandomPalette<BlockData>(new FastRandom(0)).add(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(oceanN.substring(6)), 1), 1);
} catch(IllegalArgumentException ex) {
throw new ConfigException("BlockData \"" + oceanN + "\" is invalid! (Ocean Palette)", parent.getID());
}

View File

@ -4,11 +4,11 @@ import com.dfsek.terra.config.TerraConfig;
import com.dfsek.terra.config.TerraConfigSection;
import com.dfsek.terra.config.exception.ConfigException;
import com.dfsek.terra.config.exception.NotFoundException;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Bukkit;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.InvalidConfigurationException;
import org.polydev.gaea.math.ProbabilityCollection;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.palette.Palette;
import org.polydev.gaea.world.palette.RandomPalette;
@ -29,7 +29,7 @@ public class BiomePaletteConfig extends TerraConfigSection {
try {
if(((String) entry.getKey()).startsWith("BLOCK:")) {
try {
paletteMap.put((Integer) entry.getValue(), new RandomPalette<BlockData>(new XoRoShiRo128PlusPlusRandom(0)).add(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(((String) entry.getKey()).substring(6)), 1), 1));
paletteMap.put((Integer) entry.getValue(), new RandomPalette<BlockData>(new FastRandom(0)).add(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(((String) entry.getKey()).substring(6)), 1), 1));
} catch(IllegalArgumentException ex) {
throw new ConfigException("BlockData " + entry.getKey() + " is invalid! (Palettes)", parent.getID());
}

View File

@ -5,13 +5,13 @@ import com.dfsek.terra.config.TerraConfig;
import com.dfsek.terra.config.TerraConfigSection;
import com.dfsek.terra.config.exception.ConfigException;
import com.dfsek.terra.config.exception.NotFoundException;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.InvalidConfigurationException;
import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.math.ProbabilityCollection;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.palette.Palette;
import org.polydev.gaea.world.palette.RandomPalette;
@ -42,7 +42,7 @@ public class BiomeSlabConfig extends TerraConfigSection {
if(((String) entry.getValue()).startsWith("BLOCK:")) {
try {
Debug.info("Adding slab palette with single material " + entry.getKey());
paletteMap.put(Bukkit.createBlockData((String) entry.getKey()).getMaterial(), new RandomPalette<BlockData>(new XoRoShiRo128PlusPlusRandom(0)).add(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(((String) entry.getValue()).substring(6)), 1), 1));
paletteMap.put(Bukkit.createBlockData((String) entry.getKey()).getMaterial(), new RandomPalette<BlockData>(new FastRandom(0)).add(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(((String) entry.getValue()).substring(6)), 1), 1));
} catch(IllegalArgumentException ex) {
throw new ConfigException("Invalid BlockData in slab configuration: " + ex.getMessage(), getParent().getConfig().getID());
}

View File

@ -4,7 +4,7 @@ import com.dfsek.terra.TerraWorld;
import com.dfsek.terra.biome.UserDefinedBiome;
import com.dfsek.terra.generation.TerraChunkGenerator;
import com.dfsek.terra.image.ImageLoader;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.polydev.gaea.generation.GenerationPhase;

View File

@ -5,7 +5,7 @@ import com.dfsek.terra.biome.BiomeZone;
import com.dfsek.terra.biome.grid.TerraBiomeGrid;
import com.dfsek.terra.config.base.ConfigUtil;
import com.dfsek.terra.debug.gui.DebugGUI;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.World;
import org.polydev.gaea.biome.NormalizationUtil;

View File

@ -9,8 +9,7 @@ import com.dfsek.terra.config.base.ConfigPack;
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
import com.dfsek.terra.config.genconfig.biome.BiomeFloraConfig;
import com.dfsek.terra.event.TreeGenerateEvent;
import com.dfsek.terra.util.GlueList;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
@ -22,9 +21,9 @@ import org.polydev.gaea.math.Range;
import org.polydev.gaea.population.GaeaBlockPopulator;
import org.polydev.gaea.profiler.ProfileFuture;
import org.polydev.gaea.tree.Tree;
import org.polydev.gaea.util.GlueList;
import org.polydev.gaea.world.Flora;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

View File

@ -13,8 +13,7 @@ import com.dfsek.terra.structure.Structure;
import com.dfsek.terra.structure.StructureContainedInventory;
import com.dfsek.terra.structure.features.Feature;
import com.dfsek.terra.util.structure.RotationUtil;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
@ -23,6 +22,7 @@ import org.bukkit.inventory.BlockInventoryHolder;
import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.profiler.ProfileFuture;
import org.polydev.gaea.structures.loot.LootTable;
import org.polydev.gaea.util.FastRandom;
import java.util.Random;
@ -42,7 +42,7 @@ public class StructurePopulator extends BlockPopulator {
for(StructureConfig conf : config.getAllStructures()) {
Location spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed()).toLocation(world);
if(!config.getBiome((UserDefinedBiome) grid.getBiome(spawn)).getStructures().contains(conf)) continue;
Random r2 = new XoRoShiRo128PlusPlusRandom(spawn.hashCode());
Random r2 = new FastRandom(spawn.hashCode());
Structure struc = conf.getStructure(r2);
Rotation rotation = Rotation.fromDegrees(r2.nextInt(4) * 90);
for(int y = conf.getSearchStart().get(r2); y > 0; y--) {

View File

@ -1,11 +1,10 @@
package com.dfsek.terra.procgen;
import com.dfsek.terra.util.GlueList;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.util.Vector;
import org.polydev.gaea.math.MathUtil;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.util.GlueList;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@ -55,7 +54,7 @@ public class GridSpawn {
* @return Vector representing spawnpoint
*/
public Vector getChunkSpawn(int structureChunkX, int structureChunkZ, long seed) {
Random r = new XoRoShiRo128PlusPlusRandom(MathUtil.getCarverChunkSeed(structureChunkX, structureChunkZ, seed));
Random r = new FastRandom(MathUtil.getCarverChunkSeed(structureChunkX, structureChunkZ, seed));
int offsetX = r.nextInt(width);
int offsetZ = r.nextInt(width);
int sx = structureChunkX * (width + 2 * separation) + offsetX;

View File

@ -1,6 +1,6 @@
package com.dfsek.terra.procgen.math;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
/**
* oh yeah

View File

@ -1,7 +1,7 @@
package com.dfsek.terra.procgen.pixel;
import com.dfsek.terra.procgen.math.Vector2;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,9 +1,8 @@
package com.dfsek.terra.procgen.voxel;
import com.dfsek.terra.util.GlueList;
import org.bukkit.util.Vector;
import org.polydev.gaea.util.GlueList;
import java.util.ArrayList;
import java.util.List;
public abstract class VoxelGeometry {

View File

@ -1,6 +1,6 @@
package com.dfsek.terra.structure;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
public enum Rotation {
CW_90(90), CW_180(180), CCW_90(270), NONE(0);

View File

@ -3,7 +3,7 @@ package com.dfsek.terra.structure;
import com.dfsek.terra.Debug;
import com.dfsek.terra.procgen.math.Vector2;
import com.dfsek.terra.util.structure.RotationUtil;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;

View File

@ -1,7 +1,7 @@
package com.dfsek.terra.structure;
import com.dfsek.terra.procgen.math.Vector2;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import java.io.Serializable;

View File

@ -4,9 +4,7 @@ import com.dfsek.terra.Debug;
import com.dfsek.terra.structure.Rotation;
import com.dfsek.terra.structure.Structure;
import com.dfsek.terra.structure.StructureInfo;
import com.dfsek.terra.util.GlueList;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
@ -15,8 +13,9 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
import org.polydev.gaea.math.MathUtil;
import org.polydev.gaea.math.Range;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.util.GlueList;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Random;
@ -57,7 +56,7 @@ public class EntityFeature implements Feature {
@Override
public void apply(Structure structure, Rotation r, Location l, Chunk chunk) {
Random random = new XoRoShiRo128PlusPlusRandom(MathUtil.getCarverChunkSeed(chunk.getX(), chunk.getZ(), chunk.getWorld().getSeed()));
Random random = new FastRandom(MathUtil.getCarverChunkSeed(chunk.getX(), chunk.getZ(), chunk.getWorld().getSeed()));
for(Location attempt : getLocations(structure, r, l, random, amount.get(random))) {
if(!isInChunk(chunk, attempt)) continue; // Don't attempt spawn if not in current chunk.
attemptSpawn(attempt, l);

View File

@ -1,8 +1,8 @@
package com.dfsek.terra.util;
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.polydev.gaea.util.FastRandom;
import org.polydev.gaea.world.palette.Palette;
import org.polydev.gaea.world.palette.RandomPalette;
@ -11,5 +11,5 @@ public final class DataUtil {
public static final BlockData SNOW = Material.SNOW.createBlockData();
public static final BlockData WATER = Material.WATER.createBlockData();
public static final BlockData AIR = Material.AIR.createBlockData();
public static final Palette<BlockData> BLANK_PALETTE = new RandomPalette<BlockData>(new XoRoShiRo128PlusPlusRandom(2403)).add(AIR, 1);
public static final Palette<BlockData> BLANK_PALETTE = new RandomPalette<BlockData>(new FastRandom(2403)).add(AIR, 1);
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ package com.dfsek.terra.util.structure;
import com.dfsek.terra.procgen.math.Vector2;
import com.dfsek.terra.structure.Rotation;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;

View File

@ -1,4 +1,4 @@
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.junit.jupiter.api.Test;
import org.polydev.gaea.math.FastNoiseLite;

View File

@ -1,7 +1,7 @@
import com.dfsek.terra.util.GlueList;
import org.apache.commons.math3.util.FastMath;
import net.jafama.FastMath;
import org.junit.jupiter.api.Test;
import org.polydev.gaea.math.FastNoiseLite;
import org.polydev.gaea.util.GlueList;
import java.util.ArrayList;
import java.util.Collections;