Search in sources :

Example 1 with BiomeType

use of org.spongepowered.api.world.biome.BiomeType in project Skree by Skelril.

the class NoOreWorldGeneratorModifier method modifyWorldGenerator.

@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
    for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
        BiomeGenerationSettings biomeData = worldGenerator.getBiomeSettings(biomeType);
        List<Ore> populators = biomeData.getPopulators(Ore.class);
        biomeData.getPopulators().removeAll(populators);
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) Ore(org.spongepowered.api.world.gen.populator.Ore) BiomeGenerationSettings(org.spongepowered.api.world.biome.BiomeGenerationSettings)

Example 2 with BiomeType

use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.

the class BiomeTypeRegistryModule method registerAdditional.

@AdditionalRegistration
public void registerAdditional() {
    for (Biome biome : Biome.REGISTRY) {
        if (biome != null && !this.biomeTypes.contains(biome)) {
            String id = ((BiomeType) biome).getId();
            if (id == null) {
                ResourceLocation reg_id = Biome.REGISTRY.getNameForObject(biome);
                ((IMixinBiome) biome).setModId(reg_id.getResourceDomain());
                id = reg_id.toString();
                ((IMixinBiome) biome).setId(id);
            }
            this.biomeTypes.add((BiomeType) biome);
            this.catalogTypeMap.put(id, (BiomeType) biome);
        }
    }
    // Re-map fields in case mods have changed vanilla world types
    RegistryHelper.mapFields(BiomeTypes.class, provideCatalogMap());
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) VirtualBiomeType(org.spongepowered.api.world.biome.VirtualBiomeType) IMixinBiome(org.spongepowered.common.interfaces.world.biome.IMixinBiome) Biome(net.minecraft.world.biome.Biome) ResourceLocation(net.minecraft.util.ResourceLocation) IMixinBiome(org.spongepowered.common.interfaces.world.biome.IMixinBiome) AdditionalRegistration(org.spongepowered.api.registry.util.AdditionalRegistration)

Example 3 with BiomeType

use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.

the class BiomeTypeRegistryModule method registerDefaults.

@Override
public void registerDefaults() {
    for (Biome biome : Biome.REGISTRY) {
        if (biome != null) {
            String id = ((BiomeType) biome).getId();
            if (id == null) {
                ResourceLocation reg_id = Biome.REGISTRY.getNameForObject(biome);
                ((IMixinBiome) biome).setModId(reg_id.getResourceDomain());
                id = reg_id.toString();
                ((IMixinBiome) biome).setId(id);
            }
            this.biomeTypes.add((BiomeType) biome);
            this.catalogTypeMap.put(id, (BiomeType) biome);
        }
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) VirtualBiomeType(org.spongepowered.api.world.biome.VirtualBiomeType) IMixinBiome(org.spongepowered.common.interfaces.world.biome.IMixinBiome) Biome(net.minecraft.world.biome.Biome) ResourceLocation(net.minecraft.util.ResourceLocation) IMixinBiome(org.spongepowered.common.interfaces.world.biome.IMixinBiome)

Example 4 with BiomeType

use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.

the class ByteArrayMutableBiomeBuffer method getBiome.

@Override
public BiomeType getBiome(int x, int y, int z) {
    checkOpen();
    checkRange(x, y, z);
    byte biomeId = this.biomes[getIndex(x, z)];
    BiomeType biomeType = (BiomeType) Biome.getBiomeForId(biomeId & 255);
    return biomeType == null ? BiomeTypes.OCEAN : biomeType;
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType)

Example 5 with BiomeType

use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.

the class ObjectArrayImmutableBiomeBuffer method getNativeBiome.

/**
 * Gets the native biome for the position, resolving virtual biomes to
 * persisted types if needed.
 *
 * @param x The X position
 * @param y The Y position
 * @param z The X position
 * @return The native biome
 */
public Biome getNativeBiome(int x, int y, int z) {
    checkRange(x, y, z);
    BiomeType type = this.biomes[getIndex(x, z)];
    if (type instanceof VirtualBiomeType) {
        type = ((VirtualBiomeType) type).getPersistedType();
    }
    return (Biome) type;
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) VirtualBiomeType(org.spongepowered.api.world.biome.VirtualBiomeType) Biome(net.minecraft.world.biome.Biome) VirtualBiomeType(org.spongepowered.api.world.biome.VirtualBiomeType)

Aggregations

BiomeType (org.spongepowered.api.world.biome.BiomeType)25 Vector3i (com.flowpowered.math.vector.Vector3i)10 VirtualBiomeType (org.spongepowered.api.world.biome.VirtualBiomeType)9 BiomeGenerationSettings (org.spongepowered.api.world.biome.BiomeGenerationSettings)8 ImmutableBiomeVolume (org.spongepowered.api.world.extent.ImmutableBiomeVolume)5 GenerationPopulator (org.spongepowered.api.world.gen.GenerationPopulator)5 Biome (net.minecraft.world.biome.Biome)4 UnmodifiableBiomeVolume (org.spongepowered.api.world.extent.UnmodifiableBiomeVolume)4 ArrayList (java.util.ArrayList)3 Extent (org.spongepowered.api.world.extent.Extent)3 Populator (org.spongepowered.api.world.gen.Populator)3 Timing (co.aikar.timings.Timing)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 BlockPos (net.minecraft.util.math.BlockPos)2 World (net.minecraft.world.World)2 Chunk (net.minecraft.world.chunk.Chunk)2 ChunkGeneratorOverworld (net.minecraft.world.gen.ChunkGeneratorOverworld)2 DataContainer (org.spongepowered.api.data.DataContainer)2 EventManager (org.spongepowered.api.event.EventManager)2 BiomeGenerator (org.spongepowered.api.world.gen.BiomeGenerator)2