Record Class BuildingId
java.lang.Object
java.lang.Record
com.minecolonies.api.items.component.BuildingId
Saves reference to hut
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BuildingId> static final BuildingIdstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, BuildingId> -
Constructor Summary
ConstructorsConstructorDescriptionBuildingId(net.minecraft.core.BlockPos id) Creates an instance of aBuildingIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasId()net.minecraft.core.BlockPosid()Returns the value of theidrecord component.static @Nullable IBuildingreadBuildingFromItemStack(net.minecraft.world.item.ItemStack itemStack) static @Nullable IBuildingViewreadBuildingViewFromItemStack(net.minecraft.world.item.ItemStack itemStack) static BuildingIdreadFromItemStack(net.minecraft.world.item.ItemStack itemStack) final StringtoString()Returns a string representation of this record class.static voidupdateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<BuildingId> updater) voidwriteToItemStack(net.minecraft.world.item.ItemStack itemStack)
-
Field Details
-
EMPTY
-
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 aBuildingIdrecord class.- Parameters:
id- the value for theidrecord component
-
-
Method Details
-
hasId
public boolean hasId() -
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) -
readFromItemStack
-
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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
id
public net.minecraft.core.BlockPos id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-