Class FluidRegistryEntry<T>

java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidEntry
alexiil.mc.lib.attributes.fluid.volume.FluidRegistryEntry<T>

public final class FluidRegistryEntry<T> extends FluidEntry
FluidEntry that is backed by a Registry.
  • Constructor Details

    • FluidRegistryEntry

      public FluidRegistryEntry(net.minecraft.util.registry.DefaultedRegistry<T> backingRegistry, T backingObject)
    • FluidRegistryEntry

      public FluidRegistryEntry(net.minecraft.util.registry.Registry<T> backingRegistry, T backingObject)
  • Method Details

    • getName

      public static String getName(net.minecraft.util.registry.Registry<?> registry)
      Returns:
      The save name for the given registry. Currently Fluid and Potion based registries are special-cased to return single-char strings ('f' and 'p' respectively). In the future other common registries may have additional special names. The only guarantee given is that getRegistryFromName(String) will know what the mapping is.
    • getFullRegistryName

      public static net.minecraft.util.Identifier getFullRegistryName(net.minecraft.util.registry.Registry<?> registry)
      Returns:
      The full Identifier for the given registry. This isn't directly used for saving.
    • getRegistryFromName

      @Nullable public static net.minecraft.util.registry.DefaultedRegistry<?> getRegistryFromName(String name)
    • toTag

      public void toTag(net.minecraft.nbt.NbtCompound tag)
      Specified by:
      toTag in class FluidEntry
    • toMcBuffer

      public void toMcBuffer(net.minecraft.network.PacketByteBuf buffer)
      Specified by:
      toMcBuffer in class FluidEntry
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in class FluidEntry
      Returns:
      True if this corresponds to the default value in the backing registry. (No floating entries are empty).
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class FluidEntry
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class FluidEntry
    • equals

      protected boolean equals(FluidEntry other)
      Specified by:
      equals in class FluidEntry
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getRegistryInternalName

      public String getRegistryInternalName()
      Specified by:
      getRegistryInternalName in class FluidEntry
      Returns:
      The LBA-internal name used to serialise this entry. Floating entries return "i", Fluid-based registry entries return "f", Potion-based registry entries return "p", and any other registry entry returns the ID of that registry.
    • getId

      public net.minecraft.util.Identifier getId()
      Specified by:
      getId in class FluidEntry
      Returns:
      The Identifier that the backing object uses.
    • getBackingRegistry

      public net.minecraft.util.registry.Registry<T> getBackingRegistry()
    • getBackingObject

      public T getBackingObject()