Search in sources :

Example 1 with IMixinBiome

use of org.spongepowered.common.interfaces.world.biome.IMixinBiome 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 2 with IMixinBiome

use of org.spongepowered.common.interfaces.world.biome.IMixinBiome 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)

Aggregations

ResourceLocation (net.minecraft.util.ResourceLocation)2 Biome (net.minecraft.world.biome.Biome)2 BiomeType (org.spongepowered.api.world.biome.BiomeType)2 VirtualBiomeType (org.spongepowered.api.world.biome.VirtualBiomeType)2 IMixinBiome (org.spongepowered.common.interfaces.world.biome.IMixinBiome)2 AdditionalRegistration (org.spongepowered.api.registry.util.AdditionalRegistration)1