Record Class SoilOverride
java.lang.Object
java.lang.Record
net.darkhax.botanypots.common.api.data.components.SoilOverride
- Record Components:
soil- The soil to use instead of the default recipe-based lookup.
This item component allows specific items to define a soil that differs from their default recipe-based behavior. For
example, a specific iron block could grow crops at 10x speed while normal iron blocks do not offer any speed
modifier.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SoilOverride> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, SoilOverride> static final net.darkhax.bookshelf.common.api.function.CachedSupplier<net.minecraft.core.component.DataComponentType<SoilOverride>> static final net.minecraft.resources.ResourceLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static Optional<SoilOverride> get(net.minecraft.world.item.ItemStack stack) Gets the override value for an item if one exists.final inthashCode()Returns a hash code value for this object.static voidApplies a soil override to the specified item.soil()Returns the value of thesoilrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
STREAM
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,SoilOverride> STREAM -
TYPE_ID
public static final net.minecraft.resources.ResourceLocation TYPE_ID -
TYPE
public static final net.darkhax.bookshelf.common.api.function.CachedSupplier<net.minecraft.core.component.DataComponentType<SoilOverride>> TYPE
-
-
Constructor Details
-
SoilOverride
Creates an instance of aSoilOverriderecord class.- Parameters:
soil- the value for thesoilrecord component
-
-
Method Details
-
get
Gets the override value for an item if one exists.- Parameters:
stack- The item to query.- Returns:
- The current soil override as an optional. If an override is specified the optional will be present, otherwise it is empty.
-
set
Applies a soil override to the specified item.- Parameters:
stack- The item to apply the override to.soil- The soil to attach as an override.
-
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). -
soil
Returns the value of thesoilrecord component.- Returns:
- the value of the
soilrecord component
-