TerraBiome -> Biome

This commit is contained in:
dfsek
2021-12-04 17:47:41 -07:00
parent 16c80a0976
commit 2ef2b61cc5
45 changed files with 193 additions and 191 deletions
@@ -18,11 +18,11 @@ import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.config.ConfigType;
import com.dfsek.terra.api.registry.OpenRegistry;
import com.dfsek.terra.api.util.reflection.TypeKey;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.Biome;
public class BiomeConfigType implements ConfigType<BiomeTemplate, TerraBiome> {
public static final TypeKey<TerraBiome> BIOME_TYPE_TOKEN = new TypeKey<>() {
public class BiomeConfigType implements ConfigType<BiomeTemplate, Biome> {
public static final TypeKey<Biome> BIOME_TYPE_TOKEN = new TypeKey<>() {
};
private final BiomeFactory factory;
@@ -31,8 +31,8 @@ public class BiomeConfigType implements ConfigType<BiomeTemplate, TerraBiome> {
}
@Override
public Supplier<OpenRegistry<TerraBiome>> registrySupplier(ConfigPack pack) {
return () -> pack.getRegistryFactory().create(registry -> (TypeLoader<TerraBiome>) (t, c, loader) -> {
public Supplier<OpenRegistry<Biome>> registrySupplier(ConfigPack pack) {
return () -> pack.getRegistryFactory().create(registry -> (TypeLoader<Biome>) (t, c, loader) -> {
if(c.equals("SELF")) return null;
return registry.get((String) c).orElseThrow(() -> new LoadException(
"No such " + t.getType().getTypeName() + " matching \"" + c + "\" was found in this registry."));
@@ -45,12 +45,12 @@ public class BiomeConfigType implements ConfigType<BiomeTemplate, TerraBiome> {
}
@Override
public ConfigFactory<BiomeTemplate, TerraBiome> getFactory() {
public ConfigFactory<BiomeTemplate, Biome> getFactory() {
return factory;
}
@Override
public TypeKey<TerraBiome> getTypeKey() {
public TypeKey<Biome> getTypeKey() {
return BIOME_TYPE_TOKEN;
}
}
@@ -10,10 +10,10 @@ package com.dfsek.terra.addons.biome;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.config.ConfigFactory;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.Biome;
public class BiomeFactory implements ConfigFactory<BiomeTemplate, TerraBiome> {
public class BiomeFactory implements ConfigFactory<BiomeTemplate, Biome> {
private final ConfigPack pack;
public BiomeFactory(ConfigPack pack) {
@@ -21,7 +21,7 @@ public class BiomeFactory implements ConfigFactory<BiomeTemplate, TerraBiome> {
}
@Override
public TerraBiome build(BiomeTemplate template, Platform platform) {
public Biome build(BiomeTemplate template, Platform platform) {
UserDefinedGenerationSettings generator = new UserDefinedGenerationSettings(template.getNoiseEquation(),
template.getElevationEquation(),
template.getCarvingEquation(), template.getBiomeNoise(),
@@ -11,15 +11,15 @@ import java.util.Set;
import com.dfsek.terra.api.properties.Context;
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.biome.PlatformBiome;
import com.dfsek.terra.api.world.biome.GenerationSettings;
import com.dfsek.terra.api.world.biome.TerraBiome;
/**
* Class representing a config-defined biome
*/
public class UserDefinedBiome implements TerraBiome {
public class UserDefinedBiome implements Biome {
private final UserDefinedGenerationSettings gen;
private final ProbabilityCollection<PlatformBiome> vanilla;
private final String id;
@@ -9,13 +9,13 @@ package com.dfsek.terra.addons.biome.command.biome;
import com.dfsek.terra.api.world.ServerWorld;
import com.dfsek.terra.api.world.biome.Biome;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.util.vector.Vector3;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
@@ -25,7 +25,7 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
public class AsyncBiomeFinder implements Runnable {
protected final BiomeProvider provider;
protected final TerraBiome target;
protected final Biome target;
protected final int startRadius;
protected final int maxRadius;
protected final int centerX;
@@ -35,7 +35,7 @@ public class AsyncBiomeFinder implements Runnable {
private final Consumer<Vector3> callback;
protected int searchSize = 1;
public AsyncBiomeFinder(BiomeProvider provider, TerraBiome target, @NotNull Vector3 origin, ServerWorld world, int startRadius, int maxRadius,
public AsyncBiomeFinder(BiomeProvider provider, Biome target, @NotNull Vector3 origin, ServerWorld world, int startRadius, int maxRadius,
Consumer<Vector3> callback, Platform platform) {
this.provider = provider;
this.target = target;
@@ -97,12 +97,12 @@ public class AsyncBiomeFinder implements Runnable {
*
* @return TerraBiome at coordinates
*/
public boolean isValid(int x, int z, TerraBiome target) {
public boolean isValid(int x, int z, Biome target) {
int res = platform.getTerraConfig().getBiomeSearchResolution();
return getProvider().getBiome(x * res, z * res, world.getSeed()).equals(target);
}
public TerraBiome getTarget() {
public Biome getTarget() {
return target;
}
@@ -16,7 +16,7 @@ import com.dfsek.terra.api.command.annotation.Argument;
import com.dfsek.terra.api.command.annotation.Command;
import com.dfsek.terra.api.command.annotation.inject.ArgumentTarget;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.Biome;
@Command(arguments = @Argument(
@@ -26,7 +26,7 @@ import com.dfsek.terra.api.world.biome.TerraBiome;
))
public class BiomeInfoCommand implements CommandTemplate {
@ArgumentTarget("biome")
private TerraBiome biome;
private Biome biome;
@Override
public void execute(CommandSender sender) {
@@ -25,7 +25,7 @@ import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.inject.annotations.Inject;
import com.dfsek.terra.api.util.vector.Vector3;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.Biome;
@PlayerCommand
@@ -52,7 +52,7 @@ public class BiomeLocateCommand implements CommandTemplate {
private Integer radius;
@ArgumentTarget("biome")
private TerraBiome biome;
private Biome biome;
@SwitchTarget("teleport")
private boolean teleport;
@@ -12,16 +12,16 @@ import com.dfsek.terra.api.command.arg.ArgumentParser;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.inject.annotations.Inject;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.Biome;
public class BiomeArgumentParser implements ArgumentParser<TerraBiome> {
public class BiomeArgumentParser implements ArgumentParser<Biome> {
@Inject
private Platform platform;
@Override
public TerraBiome parse(CommandSender sender, String arg) {
public Biome parse(CommandSender sender, String arg) {
Player player = (Player) sender;
return player.world().getPack().getRegistry(TerraBiome.class).get(arg).orElse(null);
return player.world().getPack().getRegistry(Biome.class).get(arg).orElse(null);
}
}
@@ -15,7 +15,7 @@ import com.dfsek.terra.api.command.tab.TabCompleter;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.inject.annotations.Inject;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.Biome;
public class BiomeTabCompleter implements TabCompleter {
@@ -25,7 +25,7 @@ public class BiomeTabCompleter implements TabCompleter {
@Override
public List<String> complete(CommandSender sender) {
Player player = (Player) sender;
return player.world().getPack().getRegistry(TerraBiome.class).entries().stream().map(TerraBiome::getID).collect(
return player.world().getPack().getRegistry(Biome.class).entries().stream().map(Biome::getID).collect(
Collectors.toList());
}
}