mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
make platform biome return singular
This commit is contained in:
parent
2ef2b61cc5
commit
0818f943b1
@ -53,7 +53,7 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
|
|||||||
private @Meta NoiseSampler carvingEquation = NoiseSampler.zero();
|
private @Meta NoiseSampler carvingEquation = NoiseSampler.zero();
|
||||||
|
|
||||||
@Value("vanilla")
|
@Value("vanilla")
|
||||||
private @Meta ProbabilityCollection<PlatformBiome> vanilla;
|
private @Meta PlatformBiome vanilla;
|
||||||
|
|
||||||
@Value("biome-noise")
|
@Value("biome-noise")
|
||||||
@Default
|
@Default
|
||||||
@ -198,7 +198,7 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProbabilityCollection<PlatformBiome> getVanilla() {
|
public PlatformBiome getVanilla() {
|
||||||
return vanilla;
|
return vanilla;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import com.dfsek.terra.api.world.biome.GenerationSettings;
|
|||||||
*/
|
*/
|
||||||
public class UserDefinedBiome implements Biome {
|
public class UserDefinedBiome implements Biome {
|
||||||
private final UserDefinedGenerationSettings gen;
|
private final UserDefinedGenerationSettings gen;
|
||||||
private final ProbabilityCollection<PlatformBiome> vanilla;
|
private final PlatformBiome vanilla;
|
||||||
private final String id;
|
private final String id;
|
||||||
private final BiomeTemplate config;
|
private final BiomeTemplate config;
|
||||||
private final int color;
|
private final int color;
|
||||||
@ -29,7 +29,7 @@ public class UserDefinedBiome implements Biome {
|
|||||||
|
|
||||||
private final Context context = new Context();
|
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.vanilla = vanilla;
|
||||||
this.gen = gen;
|
this.gen = gen;
|
||||||
this.id = config.getID();
|
this.id = config.getID();
|
||||||
@ -50,7 +50,7 @@ public class UserDefinedBiome implements Biome {
|
|||||||
* @return Collection of biomes to represent the custom biome.
|
* @return Collection of biomes to represent the custom biome.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ProbabilityCollection<PlatformBiome> getVanillaBiomes() {
|
public PlatformBiome getPlatformBiome() {
|
||||||
return vanilla;
|
return vanilla;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class BiomeInfoCommand implements CommandTemplate {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender) {
|
public void execute(CommandSender sender) {
|
||||||
sender.sendMessage("Biome info for \"" + biome.getID() + "\".");
|
sender.sendMessage("Biome info for \"" + biome.getID() + "\".");
|
||||||
sender.sendMessage("Vanilla biome: " + biome.getVanillaBiomes());
|
sender.sendMessage("Vanilla biome: " + biome.getPlatformBiome());
|
||||||
|
|
||||||
if(biome instanceof UserDefinedBiome) {
|
if(biome instanceof UserDefinedBiome) {
|
||||||
BiomeTemplate bio = ((UserDefinedBiome) biome).getConfig();
|
BiomeTemplate bio = ((UserDefinedBiome) biome).getConfig();
|
||||||
|
@ -11,7 +11,6 @@ package com.dfsek.terra.api.world.biome;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.dfsek.terra.api.properties.PropertyHolder;
|
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.
|
* @return TerraBiome - The Vanilla biome.
|
||||||
*/
|
*/
|
||||||
ProbabilityCollection<PlatformBiome> getVanillaBiomes();
|
PlatformBiome getPlatformBiome();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the BiomeTerrain instance used to generate the biome.
|
* Gets the BiomeTerrain instance used to generate the biome.
|
||||||
|
@ -21,16 +21,13 @@ public class BukkitBiomeProvider extends BiomeProvider implements Handle {
|
|||||||
@Override
|
@Override
|
||||||
public @NotNull org.bukkit.block.Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
|
public @NotNull org.bukkit.block.Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
|
||||||
Biome biome = delegate.getBiome(x, z, worldInfo.getSeed());
|
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
|
@Override
|
||||||
public @NotNull List<org.bukkit.block.Biome> getBiomes(@NotNull WorldInfo worldInfo) {
|
public @NotNull List<org.bukkit.block.Biome> getBiomes(@NotNull WorldInfo worldInfo) {
|
||||||
return StreamSupport.stream(delegate.getBiomes().spliterator(), false)
|
return StreamSupport.stream(delegate.getBiomes().spliterator(), false)
|
||||||
.flatMap(terraBiome -> terraBiome.getVanillaBiomes()
|
.map(terraBiome -> (org.bukkit.block.Biome) terraBiome.getPlatformBiome().getHandle())
|
||||||
.getContents()
|
|
||||||
.stream()
|
|
||||||
.map(biome -> (org.bukkit.block.Biome) biome.getHandle()))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public final class FabricUtil {
|
|||||||
//TerraFabricPlugin.FabricAddon fabricAddon = TerraFabricPlugin.getInstance().getFabricAddon();
|
//TerraFabricPlugin.FabricAddon fabricAddon = TerraFabricPlugin.getInstance().getFabricAddon();
|
||||||
|
|
||||||
Registry<net.minecraft.world.biome.Biome> biomeRegistry = registryManager.get(Registry.BIOME_KEY);
|
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();
|
GenerationSettings.Builder generationSettings = new GenerationSettings.Builder();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user