Search in sources :

Example 1 with SpongeRegistryType

use of org.spongepowered.common.registry.SpongeRegistryType in project SpongeCommon by SpongePowered.

the class MappedRegistryMixin method impl$cacheRegistryEntry.

@Inject(method = "registerMapping(ILnet/minecraft/resources/ResourceKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Ljava/lang/Object;", at = @At("TAIL"))
private void impl$cacheRegistryEntry(final int p_243537_1_, final net.minecraft.resources.ResourceKey<T> p_243537_2_, final T p_243537_3_, final Lifecycle p_243537_4_, final boolean p_243537_5_, final CallbackInfoReturnable<T> cir) {
    final net.minecraft.resources.ResourceKey<? extends Registry<T>> resourceKey = this.shadow$key();
    final ResourceKey root = (ResourceKey) (Object) ((ResourceKeyAccessor<T>) resourceKey).accessor$registryName();
    final ResourceKey location = (ResourceKey) (Object) resourceKey.location();
    this.bridge$register(new SpongeRegistryEntry<>(new SpongeRegistryType<>(root, location), (ResourceKey) (Object) p_243537_2_.location(), p_243537_3_));
}
Also used : ResourceKeyAccessor(org.spongepowered.common.accessor.resources.ResourceKeyAccessor) SpongeRegistryType(org.spongepowered.common.registry.SpongeRegistryType) ResourceKey(org.spongepowered.api.ResourceKey) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

ResourceKey (org.spongepowered.api.ResourceKey)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 ResourceKeyAccessor (org.spongepowered.common.accessor.resources.ResourceKeyAccessor)1 SpongeRegistryType (org.spongepowered.common.registry.SpongeRegistryType)1