Record Class ColonyId
java.lang.Object
java.lang.Record
com.minecolonies.api.items.component.ColonyId
- All Implemented Interfaces:
net.minecraft.world.item.component.TooltipProvider
public record ColonyId(int id, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension)
extends Record
implements net.minecraft.world.item.component.TooltipProvider
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionColonyId(int id, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Creates an instance of aColonyIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(net.minecraft.world.item.Item.TooltipContext context, @NotNull Consumer<net.minecraft.network.chat.Component> tooltip, @NotNull net.minecraft.world.item.TooltipFlag flags) net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> Returns the value of thedimensionrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfinal inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.static @Nullable IColonyreadColonyFromItemStack(net.minecraft.world.item.ItemStack itemStack) static @Nullable IColonyViewreadColonyViewFromItemStack(net.minecraft.world.item.ItemStack itemStack) static ColonyIdreadFromItemStack(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<ColonyId> 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,ColonyId> STREAM_CODEC
-
-
Constructor Details
-
ColonyId
public ColonyId(int id, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Creates an instance of aColonyIdrecord class.- Parameters:
id- the value for theidrecord componentdimension- the value for thedimensionrecord component
-
-
Method Details
-
hasColonyId
public boolean hasColonyId() -
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) -
readFromItemStack
-
readColonyFromItemStack
@Nullable public static @Nullable IColony readColonyFromItemStack(net.minecraft.world.item.ItemStack itemStack) -
readColonyViewFromItemStack
@Nullable public static @Nullable IColonyView readColonyViewFromItemStack(net.minecraft.world.item.ItemStack itemStack) -
updateItemStack
public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<ColonyId> updater) -
addToTooltip
public void addToTooltip(@NotNull net.minecraft.world.item.Item.TooltipContext context, @NotNull @NotNull Consumer<net.minecraft.network.chat.Component> tooltip, @NotNull @NotNull net.minecraft.world.item.TooltipFlag flags) - Specified by:
addToTooltipin interfacenet.minecraft.world.item.component.TooltipProvider
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
dimension
public net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension()Returns the value of thedimensionrecord component.- Returns:
- the value of the
dimensionrecord component
-