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);
}
}
}
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);
}
}
}
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());
}
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);
}
}
}
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);
}
}
}
}
Aggregations