Record Class BuildingId

java.lang.Object
java.lang.Record
com.minecolonies.api.items.component.BuildingId

public record BuildingId(net.minecraft.core.BlockPos id) extends Record
Saves reference to hut
  • Field Details

    • EMPTY

      public static final BuildingId EMPTY
    • CODEC

      public static final com.mojang.serialization.Codec<BuildingId> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,BuildingId> STREAM_CODEC
  • Constructor Details

    • BuildingId

      public BuildingId(net.minecraft.core.BlockPos id)
      Creates an instance of a BuildingId record class.
      Parameters:
      id - the value for the id record component
  • Method Details

    • hasId

      public boolean hasId()
    • writeToItemStack

      public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack)
    • readFromItemStack

      public static BuildingId readFromItemStack(net.minecraft.world.item.ItemStack itemStack)
    • updateItemStack

      public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<BuildingId> updater)
    • readBuildingFromItemStack

      @Nullable public static @Nullable IBuilding readBuildingFromItemStack(net.minecraft.world.item.ItemStack itemStack)
    • readBuildingViewFromItemStack

      @Nullable public static @Nullable IBuildingView readBuildingViewFromItemStack(net.minecraft.world.item.ItemStack itemStack)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public net.minecraft.core.BlockPos id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component