mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-15 21:31:05 +00:00
remove usages of TerraWorld#getConfig
This commit is contained in:
+2
-4
@@ -75,13 +75,12 @@ public class NoiseChunkGenerator3D implements TerraChunkGenerator {
|
||||
@SuppressWarnings({"try"})
|
||||
public ChunkData generateChunkData(@NotNull World world, Random random, int chunkX, int chunkZ, ChunkData chunk) {
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("chunk_base_3d")) {
|
||||
TerraWorld tw = main.getWorld(world);
|
||||
BiomeProvider grid = world.getBiomeProvider();
|
||||
|
||||
int xOrig = (chunkX << 4);
|
||||
int zOrig = (chunkZ << 4);
|
||||
|
||||
Sampler sampler = tw.getConfig().getSamplerCache().getChunk(chunkX, chunkZ);
|
||||
Sampler sampler = world.getConfig().getSamplerCache().getChunk(chunkX, chunkZ);
|
||||
|
||||
long seed = world.getSeed();
|
||||
|
||||
@@ -168,10 +167,9 @@ public class NoiseChunkGenerator3D implements TerraChunkGenerator {
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(World world, int x, int y, int z) {
|
||||
TerraWorld terraWorld = main.getWorld(world);
|
||||
BiomeProvider provider = world.getBiomeProvider();
|
||||
TerraBiome biome = provider.getBiome(x, z, world.getSeed());
|
||||
Sampler sampler = terraWorld.getConfig().getSamplerCache().get(x, z);
|
||||
Sampler sampler = world.getConfig().getSamplerCache().get(x, z);
|
||||
|
||||
PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class);
|
||||
Palette palette = PaletteUtil.getPalette(x, y, z, biome.getGenerator(world), sampler, paletteInfo);
|
||||
|
||||
+1
-1
@@ -14,6 +14,6 @@ public class BiomeArgumentParser implements ArgumentParser<TerraBiome> {
|
||||
@Override
|
||||
public TerraBiome parse(CommandSender sender, String arg) {
|
||||
Player player = (Player) sender;
|
||||
return main.getWorld(player.world()).getConfig().getRegistry(TerraBiome.class).get(arg);
|
||||
return player.world().getConfig().getRegistry(TerraBiome.class).get(arg);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,6 +17,6 @@ public class BiomeTabCompleter implements TabCompleter {
|
||||
@Override
|
||||
public List<String> complete(CommandSender sender) {
|
||||
Player player = (Player) sender;
|
||||
return main.getWorld(player.world()).getConfig().getRegistry(TerraBiome.class).entries().stream().map(TerraBiome::getID).collect(Collectors.toList());
|
||||
return player.world().getConfig().getRegistry(TerraBiome.class).entries().stream().map(TerraBiome::getID).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -30,11 +30,9 @@ public class CavePopulator implements TerraGenerationStage, Chunkified {
|
||||
@SuppressWarnings("try")
|
||||
@Override
|
||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||
TerraWorld tw = main.getWorld(world);
|
||||
WorldHandle handle = main.getWorldHandle();
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("carving")) {
|
||||
Random random = PopulationUtil.getRandom(chunk);
|
||||
WorldConfig config = tw.getConfig();
|
||||
WorldConfig config = world.getConfig();
|
||||
if(config.disableCarving()) return;
|
||||
|
||||
for(UserDefinedCarver c : config.getRegistry(UserDefinedCarver.class).entries()) {
|
||||
|
||||
@@ -22,9 +22,8 @@ public class OrePopulator implements TerraGenerationStage {
|
||||
@SuppressWarnings("try")
|
||||
@Override
|
||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||
TerraWorld tw = main.getWorld(world);
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("ore")) {
|
||||
if(tw.getConfig().disableOres()) return;
|
||||
if(world.getConfig().disableOres()) return;
|
||||
|
||||
for(int cx = -1; cx <= 1; cx++) {
|
||||
for(int cz = -1; cz <= 1; cz++) {
|
||||
|
||||
+2
-3
@@ -28,14 +28,13 @@ public class StructurePopulator implements TerraGenerationStage, Chunkified {
|
||||
@SuppressWarnings("try")
|
||||
@Override
|
||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||
TerraWorld tw = main.getWorld(world);
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("structure")) {
|
||||
if(tw.getConfig().disableStructures()) return;
|
||||
if(world.getConfig().disableStructures()) return;
|
||||
|
||||
int cx = (chunk.getX() << 4);
|
||||
int cz = (chunk.getZ() << 4);
|
||||
BiomeProvider provider = world.getBiomeProvider();
|
||||
WorldConfig config = tw.getConfig();
|
||||
WorldConfig config = world.getConfig();
|
||||
for(ConfiguredStructure conf : config.getRegistry(TerraStructure.class).entries()) {
|
||||
Vector3 spawn = conf.getSpawn().getNearestSpawn(cx + 8, cz + 8, world.getSeed());
|
||||
|
||||
|
||||
+1
-1
@@ -13,6 +13,6 @@ public class ScriptArgumentParser implements ArgumentParser<Structure> {
|
||||
|
||||
@Override
|
||||
public Structure parse(CommandSender sender, String arg) {
|
||||
return main.getWorld(((Player) sender).world()).getConfig().getRegistry(Structure.class).get(arg);
|
||||
return ((Player) sender).world().getConfig().getRegistry(Structure.class).get(arg);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,6 +13,6 @@ public class StructureArgumentParser implements ArgumentParser<ConfiguredStructu
|
||||
|
||||
@Override
|
||||
public ConfiguredStructure parse(CommandSender sender, String arg) {
|
||||
return main.getWorld(((Player) sender).world()).getConfig().getRegistry(ConfiguredStructure.class).get(arg);
|
||||
return ((Player) sender).world().getConfig().getRegistry(ConfiguredStructure.class).get(arg);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,6 +16,6 @@ public class ScriptCompleter implements TabCompleter {
|
||||
|
||||
@Override
|
||||
public List<String> complete(CommandSender sender) {
|
||||
return main.getWorld(((Player) sender).world()).getConfig().getRegistry(Structure.class).entries().stream().map(Structure::getId).collect(Collectors.toList());
|
||||
return ((Player) sender).world().getConfig().getRegistry(Structure.class).entries().stream().map(Structure::getId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,6 +17,6 @@ public class StructureCompleter implements TabCompleter {
|
||||
@Override
|
||||
public List<String> complete(CommandSender sender) {
|
||||
Player player = (Player) sender;
|
||||
return new ArrayList<>(main.getWorld(player.world()).getConfig().getRegistry(ConfiguredStructure.class).keys());
|
||||
return new ArrayList<>(player.world().getConfig().getRegistry(ConfiguredStructure.class).keys());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -29,9 +29,8 @@ public class FloraGenerationStage implements TerraGenerationStage {
|
||||
@SuppressWarnings("try")
|
||||
@Override
|
||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||
TerraWorld tw = main.getWorld(world);
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("flora")) {
|
||||
if(tw.getConfig().disableFlora()) return;
|
||||
if(world.getConfig().disableFlora()) return;
|
||||
|
||||
long seed = world.getSeed();
|
||||
BiomeProvider provider = world.getBiomeProvider();
|
||||
|
||||
+1
-2
@@ -50,8 +50,7 @@ public class CheckFunction implements Function<String> {
|
||||
private String apply(Vector3 vector, World world) {
|
||||
int y = vector.getBlockY();
|
||||
if(y >= world.getMaxHeight() || y < 0) return "AIR";
|
||||
TerraWorld tw = main.getWorld(world);
|
||||
SamplerCache cache = tw.getConfig().getSamplerCache();
|
||||
SamplerCache cache = world.getConfig().getSamplerCache();
|
||||
double comp = sample(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), cache);
|
||||
|
||||
if(comp > 0) return "LAND"; // If noise val is greater than zero, location will always be land.
|
||||
|
||||
Reference in New Issue
Block a user