mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-22 08:10:40 +00:00
more cleanup
This commit is contained in:
@@ -14,6 +14,7 @@ import com.dfsek.terra.api.platform.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.platform.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.platform.world.Biome;
|
||||
import com.dfsek.terra.api.platform.world.World;
|
||||
import com.dfsek.terra.api.world.generation.TerraChunkGenerator;
|
||||
import com.dfsek.terra.bukkit.command.command.TerraCommand;
|
||||
import com.dfsek.terra.bukkit.command.command.structure.LocateCommand;
|
||||
import com.dfsek.terra.bukkit.generator.BukkitChunkGeneratorWrapper;
|
||||
@@ -34,7 +35,7 @@ import com.dfsek.terra.debug.DebugLogger;
|
||||
import com.dfsek.terra.registry.master.AddonRegistry;
|
||||
import com.dfsek.terra.registry.master.ConfigRegistry;
|
||||
import com.dfsek.terra.world.TerraWorld;
|
||||
import com.dfsek.terra.world.generation.MasterChunkGenerator;
|
||||
import com.dfsek.terra.world.generation.generators.DefaultChunkGenerator3D;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -51,7 +52,7 @@ import java.util.Objects;
|
||||
|
||||
|
||||
public class TerraBukkitPlugin extends JavaPlugin implements TerraPlugin {
|
||||
private final Map<String, MasterChunkGenerator> generatorMap = new HashMap<>();
|
||||
private final Map<String, DefaultChunkGenerator3D> generatorMap = new HashMap<>();
|
||||
private final Map<World, TerraWorld> worldMap = new HashMap<>();
|
||||
private final Map<String, ConfigPack> worlds = new HashMap<>();
|
||||
private final ConfigRegistry registry = new ConfigRegistry();
|
||||
@@ -80,7 +81,7 @@ public class TerraBukkitPlugin extends JavaPlugin implements TerraPlugin {
|
||||
public void reload() {
|
||||
Map<World, TerraWorld> newMap = new HashMap<>();
|
||||
worldMap.forEach((world, tw) -> {
|
||||
((MasterChunkGenerator) ((BukkitChunkGeneratorWrapper) world.getGenerator().getHandle()).getHandle()).getCache().clear();
|
||||
((BukkitChunkGeneratorWrapper) world.getGenerator().getHandle()).getHandle().getCache().clear();
|
||||
String packID = tw.getConfig().getTemplate().getID();
|
||||
newMap.put(world, new TerraWorld(world, registry.get(packID), this));
|
||||
});
|
||||
@@ -205,7 +206,7 @@ public class TerraBukkitPlugin extends JavaPlugin implements TerraPlugin {
|
||||
if(!registry.contains(id)) throw new IllegalArgumentException("No such config pack \"" + id + "\"");
|
||||
ConfigPack pack = registry.get(id);
|
||||
worlds.put(worldName, pack);
|
||||
return new MasterChunkGenerator(registry.get(id), this, pack.getSamplerCache());
|
||||
return new DefaultChunkGenerator3D(registry.get(id), this, pack.getSamplerCache());
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ public class TerraBukkitPlugin extends JavaPlugin implements TerraPlugin {
|
||||
throw new IllegalArgumentException("Not a Terra world! " + w.getGenerator());
|
||||
if(!worlds.containsKey(w.getName())) {
|
||||
getLogger().warning("Unexpected world load detected: \"" + w.getName() + "\"");
|
||||
return new TerraWorld(w, ((MasterChunkGenerator) w.getGenerator().getHandle()).getConfigPack(), this);
|
||||
return new TerraWorld(w, ((TerraChunkGenerator) w.getGenerator().getHandle()).getConfigPack(), this);
|
||||
}
|
||||
return worldMap.computeIfAbsent(w, world -> new TerraWorld(w, worlds.get(w.getName()), this));
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
return debugLogger;
|
||||
}
|
||||
|
||||
private Transformer<String, Biome> biomeFixer = new Transformer.Builder<String, Biome>()
|
||||
private final Transformer<String, Biome> biomeFixer = new Transformer.Builder<String, Biome>()
|
||||
.addTransform(id -> BuiltinRegistries.BIOME.get(Identifier.tryParse(id)), new NotNullValidator<>())
|
||||
.addTransform(id -> BuiltinRegistries.BIOME.get(Identifier.tryParse("minecraft:" + id.toLowerCase())), new NotNullValidator<>()).build();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.dfsek.terra.config.pack.ConfigPack;
|
||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||
import com.dfsek.terra.fabric.world.TerraBiomeSource;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricSeededWorldAccess;
|
||||
import com.dfsek.terra.world.generation.MasterChunkGenerator;
|
||||
import com.dfsek.terra.world.generation.generators.DefaultChunkGenerator3D;
|
||||
import com.dfsek.terra.world.population.FloraPopulator;
|
||||
import com.dfsek.terra.world.population.OrePopulator;
|
||||
import com.dfsek.terra.world.population.StructurePopulator;
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.world.gen.chunk.VerticalBlockSample;
|
||||
|
||||
public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.dfsek.terra.api.platform.world.generator.ChunkGenerator {
|
||||
private final long seed;
|
||||
private final MasterChunkGenerator delegate;
|
||||
private final DefaultChunkGenerator3D delegate;
|
||||
private final TerraBiomeSource biomeSource;
|
||||
public static final Codec<ConfigPack> PACK_CODEC = (RecordCodecBuilder.create(config -> config.group(
|
||||
Codec.STRING.fieldOf("pack").forGetter(pack -> pack.getTemplate().getID())
|
||||
@@ -69,7 +69,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.d
|
||||
super(biomeSource, new StructuresConfig(false));
|
||||
this.pack = configPack;
|
||||
|
||||
this.delegate = new MasterChunkGenerator(configPack, TerraFabricPlugin.getInstance(), pack.getSamplerCache());
|
||||
this.delegate = new DefaultChunkGenerator3D(configPack, TerraFabricPlugin.getInstance(), pack.getSamplerCache());
|
||||
delegate.getMain().getLogger().info("Loading world...");
|
||||
this.biomeSource = biomeSource;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements com.d
|
||||
}
|
||||
|
||||
@Override
|
||||
public MasterChunkGenerator getHandle() {
|
||||
public DefaultChunkGenerator3D getHandle() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.dfsek.terra.platform;
|
||||
|
||||
import com.dfsek.terra.api.platform.world.generator.ChunkGenerator;
|
||||
import com.dfsek.terra.world.generation.MasterChunkGenerator;
|
||||
import com.dfsek.terra.world.generation.generators.DefaultChunkGenerator3D;
|
||||
|
||||
public class GenWrapper implements ChunkGenerator {
|
||||
private final MasterChunkGenerator generator;
|
||||
private final DefaultChunkGenerator3D generator;
|
||||
|
||||
public GenWrapper(MasterChunkGenerator generator) {
|
||||
public GenWrapper(DefaultChunkGenerator3D generator) {
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.dfsek.terra.StandalonePlugin;
|
||||
import com.dfsek.terra.platform.DirectChunkData;
|
||||
import com.dfsek.terra.platform.DirectWorld;
|
||||
import com.dfsek.terra.platform.GenWrapper;
|
||||
import com.dfsek.terra.world.generation.MasterChunkGenerator;
|
||||
import com.dfsek.terra.world.generation.generators.DefaultChunkGenerator3D;
|
||||
import com.dfsek.terra.world.generation.math.SamplerCache;
|
||||
import com.dfsek.terra.world.population.FloraPopulator;
|
||||
import com.dfsek.terra.world.population.OrePopulator;
|
||||
@@ -23,7 +23,7 @@ public class Generator {
|
||||
StructurePopulator structurePopulator;
|
||||
TreePopulator treePopulator;
|
||||
OrePopulator orePopulator;
|
||||
MasterChunkGenerator generator;
|
||||
DefaultChunkGenerator3D generator;
|
||||
|
||||
public Generator(long seed, StandalonePlugin plugin) {
|
||||
plugin.load();
|
||||
@@ -31,7 +31,7 @@ public class Generator {
|
||||
structurePopulator = new StructurePopulator(plugin);
|
||||
treePopulator = new TreePopulator(plugin);
|
||||
orePopulator = new OrePopulator(plugin);
|
||||
generator = new MasterChunkGenerator(plugin.getRegistry().get("DEFAULT"), plugin, new SamplerCache(plugin));
|
||||
generator = new DefaultChunkGenerator3D(plugin.getRegistry().get("DEFAULT"), plugin, new SamplerCache(plugin));
|
||||
this.seed = seed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user