Search in sources :

Example 1 with AdditionalRegistration

use of org.spongepowered.api.registry.util.AdditionalRegistration in project SpongeCommon by SpongePowered.

the class CookedFishRegistryModule method registerAdditional.

@AdditionalRegistration
public void registerAdditional() {
    for (ItemFishFood.FishType fishType : ItemFishFood.FishType.values()) {
        if (fishType.canCook() && !this.fishMap.containsKey(fishType.name().toLowerCase(Locale.ENGLISH))) {
            CookedFish cooked = new SpongeCookedFish(fishType.name(), new SpongeTranslation("item.fish." + fishType.getUnlocalizedName() + ".cooked.name"), fishType);
            this.fishMap.put(cooked.getId().toLowerCase(Locale.ENGLISH), cooked);
        }
    }
}
Also used : CookedFish(org.spongepowered.api.data.type.CookedFish) SpongeCookedFish(org.spongepowered.common.data.type.SpongeCookedFish) SpongeTranslation(org.spongepowered.common.text.translation.SpongeTranslation) ItemFishFood(net.minecraft.item.ItemFishFood) SpongeCookedFish(org.spongepowered.common.data.type.SpongeCookedFish) AdditionalRegistration(org.spongepowered.api.registry.util.AdditionalRegistration)

Example 2 with AdditionalRegistration

use of org.spongepowered.api.registry.util.AdditionalRegistration in project SpongeCommon by SpongePowered.

the class EnchantmentRegistryModule method registerAdditional.

@AdditionalRegistration
public void registerAdditional() {
    for (ResourceLocation key : net.minecraft.enchantment.Enchantment.REGISTRY.getKeys()) {
        net.minecraft.enchantment.Enchantment enchantment = net.minecraft.enchantment.Enchantment.REGISTRY.getObject(key);
        if (enchantment == null) {
            continue;
        }
        if (!this.enchantmentMappings.containsValue(enchantment)) {
            final String name = enchantment.getName().replace("enchantment.", "");
            this.enchantmentMappings.put(name.toLowerCase(Locale.ENGLISH), (EnchantmentType) enchantment);
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) AdditionalRegistration(org.spongepowered.api.registry.util.AdditionalRegistration)

Example 3 with AdditionalRegistration

use of org.spongepowered.api.registry.util.AdditionalRegistration 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 4 with AdditionalRegistration

use of org.spongepowered.api.registry.util.AdditionalRegistration in project SpongeCommon by SpongePowered.

the class BannerPatternShapeRegistryModule method registerAdditional.

@AdditionalRegistration
public void registerAdditional() {
    for (BannerPattern pattern : BannerPattern.values()) {
        if (!this.bannerPatternShapeMappings.containsKey(pattern.name())) {
            this.bannerPatternShapeMappings.put(pattern.name().toLowerCase(Locale.ENGLISH), (BannerPatternShape) (Object) pattern);
            this.bannerPatternShapeMappings.put(pattern.getHashname().toLowerCase(Locale.ENGLISH), (BannerPatternShape) (Object) pattern);
        }
    }
}
Also used : BannerPattern(net.minecraft.tileentity.BannerPattern) AdditionalRegistration(org.spongepowered.api.registry.util.AdditionalRegistration)

Example 5 with AdditionalRegistration

use of org.spongepowered.api.registry.util.AdditionalRegistration in project SpongeCommon by SpongePowered.

the class PotionEffectTypeRegistryModule method additionalRegistration.

@AdditionalRegistration
public void additionalRegistration() {
    // I'm guessing that this should work very well.
    for (Potion potion : Potion.REGISTRY) {
        if (potion != null) {
            PotionEffectType potionEffectType = (PotionEffectType) potion;
            if (!this.potionList.contains(potionEffectType)) {
                this.potionList.add(potionEffectType);
                this.potionEffectTypeMap.put(Potion.REGISTRY.getNameForObject(potion).toString(), potionEffectType);
            }
        }
    }
}
Also used : Potion(net.minecraft.potion.Potion) PotionEffectType(org.spongepowered.api.effect.potion.PotionEffectType) AdditionalRegistration(org.spongepowered.api.registry.util.AdditionalRegistration)

Aggregations

AdditionalRegistration (org.spongepowered.api.registry.util.AdditionalRegistration)5 ResourceLocation (net.minecraft.util.ResourceLocation)2 ItemFishFood (net.minecraft.item.ItemFishFood)1 Potion (net.minecraft.potion.Potion)1 BannerPattern (net.minecraft.tileentity.BannerPattern)1 Biome (net.minecraft.world.biome.Biome)1 CookedFish (org.spongepowered.api.data.type.CookedFish)1 PotionEffectType (org.spongepowered.api.effect.potion.PotionEffectType)1 BiomeType (org.spongepowered.api.world.biome.BiomeType)1 VirtualBiomeType (org.spongepowered.api.world.biome.VirtualBiomeType)1 SpongeCookedFish (org.spongepowered.common.data.type.SpongeCookedFish)1 IMixinBiome (org.spongepowered.common.interfaces.world.biome.IMixinBiome)1 SpongeTranslation (org.spongepowered.common.text.translation.SpongeTranslation)1