Record Class WarehouseSnapshot
java.lang.Object
java.lang.Record
com.minecolonies.api.items.component.WarehouseSnapshot
- Record Components:
snapshot- the snapshot data.hash- the work order hash for comparison between work orders.
Container class for warehouse snapshot data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<WarehouseSnapshot> static final WarehouseSnapshotstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, WarehouseSnapshot> -
Constructor Summary
ConstructorsConstructorDescriptionWarehouseSnapshot(Map<String, Integer> snapshot, String hash) Creates an instance of aWarehouseSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.hash()Returns the value of thehashrecord component.final inthashCode()Returns a hash code value for this object.static WarehouseSnapshotreadFromItemStack(net.minecraft.world.item.ItemStack itemStack) snapshot()Returns the value of thesnapshotrecord component.final StringtoString()Returns a string representation of this record class.static voidupdateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<WarehouseSnapshot> 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,WarehouseSnapshot> STREAM_CODEC
-
-
Constructor Details
-
Method Details
-
writeToItemStack
public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack) -
readFromItemStack
-
updateItemStack
public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<WarehouseSnapshot> updater) -
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). -
snapshot
Returns the value of thesnapshotrecord component.- Returns:
- the value of the
snapshotrecord component
-
hash
Returns the value of thehashrecord component.- Returns:
- the value of the
hashrecord component
-