Class MappedRegistryMixin<T>

java.lang.Object
net.fabricmc.fabric.mixin.registry.sync.MappedRegistryMixin<T>
All Implemented Interfaces:
com.mojang.serialization.Keyable, Iterable<T>, FabricRegistry, ListenableRegistry<T>, RemappableRegistry, net.minecraft.core.HolderGetter<T>, net.minecraft.core.HolderLookup<T>, net.minecraft.core.HolderLookup.RegistryLookup<T>, net.minecraft.core.HolderOwner<T>, net.minecraft.core.IdMap<T>, net.minecraft.core.Registry<T>, net.minecraft.core.WritableRegistry<T>, net.neoforged.neoforge.registries.IRegistryExtension<T>

public abstract class MappedRegistryMixin<T> extends Object implements net.minecraft.core.WritableRegistry<T>, RemappableRegistry, ListenableRegistry<T>, FabricRegistry
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.core.HolderLookup

    net.minecraft.core.HolderLookup.Provider, net.minecraft.core.HolderLookup.RegistryLookup<T>

    Nested classes/interfaces inherited from interface net.minecraft.core.HolderLookup.RegistryLookup

    net.minecraft.core.HolderLookup.RegistryLookup.Delegate<T>

    Nested classes/interfaces inherited from interface net.minecraft.core.Registry

    net.minecraft.core.Registry.PendingTags<T>

    Nested classes/interfaces inherited from interface RemappableRegistry

    RemappableRegistry.RemapMode
  • Field Summary

    Fields inherited from interface net.minecraft.core.IdMap

    DEFAULT
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAlias(net.minecraft.resources.Identifier old, net.minecraft.resources.Identifier newId)
    Adds an alias for an entry in this registry.
    abstract boolean
    containsKey(net.minecraft.resources.Identifier id)
     
     
     
    abstract Optional<net.minecraft.resources.ResourceKey<T>>
     
    abstract @Nullable T
    getValue(@Nullable net.minecraft.resources.Identifier id)
     
    abstract net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>>
    key()
     
    void
    remap(it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.resources.Identifier> remoteIndexedEntries, RemappableRegistry.RemapMode mode)
     
    abstract String
     
    void
     
    protected abstract void
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.core.HolderGetter

    get, get, getOrThrow, getOrThrow, getRandomElementOf

    Methods inherited from interface net.minecraft.core.HolderLookup

    listElementIds, listElements, listTagIds, listTags

    Methods inherited from interface net.minecraft.core.HolderLookup.RegistryLookup

    filterElements, filterFeatures, getData, registryLifecycle

    Methods inherited from interface net.minecraft.core.HolderOwner

    canSerializeIn

    Methods inherited from interface net.minecraft.core.IdMap

    byId, byIdOrThrow, getIdOrThrow, size

    Methods inherited from interface net.neoforged.neoforge.registries.IRegistryExtension

    addCallback, addCallback, containsValue, doesSync, getDataMap, getId, getId, getKeyOrNull, getMaxId, resolve, resolve

    Methods inherited from interface Iterable

    forEach, iterator, spliterator

    Methods inherited from interface net.minecraft.core.Registry

    asHolderIdMap, byNameCodec, componentLookup, containsKey, createIntrusiveHolder, entrySet, freeze, get, get, getAny, getId, getKey, getOptional, getOptional, getRandom, getTagOrEmpty, getTags, getValue, getValueOrThrow, holderByNameCodec, keys, keySet, prepareTagReload, registrationInfo, registryKeySet, stream, wrapAsHolder

    Methods inherited from interface net.minecraft.core.WritableRegistry

    bindTags, createRegistrationLookup, isEmpty, register
  • Constructor Details

    • MappedRegistryMixin

      public MappedRegistryMixin()
  • Method Details

    • getResourceKey

      public abstract Optional<net.minecraft.resources.ResourceKey<T>> getResourceKey(T entry)
      Specified by:
      getResourceKey in interface net.minecraft.core.Registry<T>
    • getValue

      public abstract @Nullable T getValue(@Nullable net.minecraft.resources.Identifier id)
      Specified by:
      getValue in interface net.minecraft.core.Registry<T>
    • key

      public abstract net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key()
      Specified by:
      key in interface net.minecraft.core.HolderLookup.RegistryLookup<T>
      Specified by:
      key in interface net.minecraft.core.Registry<T>
    • containsKey

      public abstract boolean containsKey(net.minecraft.resources.Identifier id)
      Specified by:
      containsKey in interface net.minecraft.core.Registry<T>
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
    • validateWrite

      protected abstract void validateWrite()
    • fabric_getAddObjectEvent

      public Event<RegistryEntryAddedCallback<T>> fabric_getAddObjectEvent()
      Specified by:
      fabric_getAddObjectEvent in interface ListenableRegistry<T>
    • fabric_getRemapEvent

      public Event<RegistryIdRemapCallback<T>> fabric_getRemapEvent()
      Specified by:
      fabric_getRemapEvent in interface ListenableRegistry<T>
    • remap

      public void remap(it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.resources.Identifier> remoteIndexedEntries, RemappableRegistry.RemapMode mode) throws RemapException
      Specified by:
      remap in interface RemappableRegistry
      Throws:
      RemapException
    • unmap

      public void unmap() throws RemapException
      Specified by:
      unmap in interface RemappableRegistry
      Throws:
      RemapException
    • addAlias

      public void addAlias(net.minecraft.resources.Identifier old, net.minecraft.resources.Identifier newId)
      Description copied from interface: FabricRegistry
      Adds an alias for an entry in this registry. Once added, all queries to this registry that refer to the old Identifier will be redirected towards newId. This is useful if a mod wants to change an ID without breaking compatibility with existing worlds.
      Specified by:
      addAlias in interface FabricRegistry
      Specified by:
      addAlias in interface net.neoforged.neoforge.registries.IRegistryExtension<T>
      Parameters:
      old - the Identifier that will become an alias for newId
      newId - the Identifier for which old will become an alias