make platform biome return singular

This commit is contained in:
dfsek 2021-12-04 18:17:32 -07:00
parent 2ef2b61cc5
commit 0818f943b1
6 changed files with 10 additions and 14 deletions

View File

@ -53,7 +53,7 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
private @Meta NoiseSampler carvingEquation = NoiseSampler.zero();
@Value("vanilla")
private @Meta ProbabilityCollection<PlatformBiome> vanilla;
private @Meta PlatformBiome vanilla;
@Value("biome-noise")
@Default
@ -198,7 +198,7 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
return id;
}
public ProbabilityCollection<PlatformBiome> getVanilla() {
public PlatformBiome getVanilla() {
return vanilla;
}

View File

@ -21,7 +21,7 @@ import com.dfsek.terra.api.world.biome.GenerationSettings;
*/
public class UserDefinedBiome implements Biome {
private final UserDefinedGenerationSettings gen;
private final ProbabilityCollection<PlatformBiome> vanilla;
private final PlatformBiome vanilla;
private final String id;
private final BiomeTemplate config;
private final int color;
@ -29,7 +29,7 @@ public class UserDefinedBiome implements Biome {
private final Context context = new Context();
public UserDefinedBiome(ProbabilityCollection<PlatformBiome> vanilla, UserDefinedGenerationSettings gen, BiomeTemplate config) {
public UserDefinedBiome(PlatformBiome vanilla, UserDefinedGenerationSettings gen, BiomeTemplate config) {
this.vanilla = vanilla;
this.gen = gen;
this.id = config.getID();
@ -50,7 +50,7 @@ public class UserDefinedBiome implements Biome {
* @return Collection of biomes to represent the custom biome.
*/
@Override
public ProbabilityCollection<PlatformBiome> getVanillaBiomes() {
public PlatformBiome getPlatformBiome() {
return vanilla;
}

View File

@ -31,7 +31,7 @@ public class BiomeInfoCommand implements CommandTemplate {
@Override
public void execute(CommandSender sender) {
sender.sendMessage("Biome info for \"" + biome.getID() + "\".");
sender.sendMessage("Vanilla biome: " + biome.getVanillaBiomes());
sender.sendMessage("Vanilla biome: " + biome.getPlatformBiome());
if(biome instanceof UserDefinedBiome) {
BiomeTemplate bio = ((UserDefinedBiome) biome).getConfig();

View File

@ -11,7 +11,6 @@ package com.dfsek.terra.api.world.biome;
import java.util.Set;
import com.dfsek.terra.api.properties.PropertyHolder;
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
/**
@ -24,7 +23,7 @@ public interface Biome extends PropertyHolder {
*
* @return TerraBiome - The Vanilla biome.
*/
ProbabilityCollection<PlatformBiome> getVanillaBiomes();
PlatformBiome getPlatformBiome();
/**
* Gets the BiomeTerrain instance used to generate the biome.

View File

@ -21,16 +21,13 @@ public class BukkitBiomeProvider extends BiomeProvider implements Handle {
@Override
public @NotNull org.bukkit.block.Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
Biome biome = delegate.getBiome(x, z, worldInfo.getSeed());
return (org.bukkit.block.Biome) biome.getVanillaBiomes().get(biome.getGenerator().getBiomeNoise(), x, y, z).getHandle();
return (org.bukkit.block.Biome) biome.getPlatformBiome().getHandle();
}
@Override
public @NotNull List<org.bukkit.block.Biome> getBiomes(@NotNull WorldInfo worldInfo) {
return StreamSupport.stream(delegate.getBiomes().spliterator(), false)
.flatMap(terraBiome -> terraBiome.getVanillaBiomes()
.getContents()
.stream()
.map(biome -> (org.bukkit.block.Biome) biome.getHandle()))
.map(terraBiome -> (org.bukkit.block.Biome) terraBiome.getPlatformBiome().getHandle())
.collect(Collectors.toList());
}

View File

@ -69,7 +69,7 @@ public final class FabricUtil {
//TerraFabricPlugin.FabricAddon fabricAddon = TerraFabricPlugin.getInstance().getFabricAddon();
Registry<net.minecraft.world.biome.Biome> biomeRegistry = registryManager.get(Registry.BIOME_KEY);
net.minecraft.world.biome.Biome vanilla = ((ProtoPlatformBiome) (new ArrayList<>(biome.getVanillaBiomes().getContents()).get(0))).get(biomeRegistry);
net.minecraft.world.biome.Biome vanilla = ((ProtoPlatformBiome) biome.getPlatformBiome()).get(biomeRegistry);
GenerationSettings.Builder generationSettings = new GenerationSettings.Builder();