Record Class Plant
java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.plant.Plant
- Record Components:
growthType- TheGrowthTypeto use. This dictates most of the plant's logic.allStates- ARuleTestfor all states of the plant.seed- The seedItemStackto use. This is used e.g. for replanting.crop- The cropItemStackto use. This is used e.g. for harvest bonuses.tool- The toolItemStackto use when harvesting.
public record Plant(GrowthType growthType, net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest allStates, Optional<net.minecraft.world.item.ItemStackTemplate> seed, Optional<net.minecraft.world.item.ItemStackTemplate> crop, Optional<net.minecraft.world.item.ItemStackTemplate> tool)
extends Record
Represents a plant. Plants are used by certain mod mechanics, such as the Harvest component or Dryads growing certain crops.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlant(GrowthType growthType, net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest allStates, Optional<net.minecraft.world.item.ItemStackTemplate> seed, Optional<net.minecraft.world.item.ItemStackTemplate> crop, Optional<net.minecraft.world.item.ItemStackTemplate> tool) Creates an instance of aPlantrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.levelgen.structure.templatesystem.RuleTestReturns the value of theallStatesrecord component.createContext(net.minecraft.server.level.ServerPlayer player, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.item.ItemStack tool) Optional<net.minecraft.world.item.ItemStackTemplate> crop()Returns the value of thecroprecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegrowthTyperecord component.final inthashCode()Returns a hash code value for this object.Optional<net.minecraft.world.item.ItemStackTemplate> seed()Returns the value of theseedrecord component.Optional<net.minecraft.world.item.ItemStackTemplate> tool()Returns the value of thetoolrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DIRECT_CODEC
-
CODEC
-
-
Constructor Details
-
Plant
public Plant(GrowthType growthType, net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest allStates, Optional<net.minecraft.world.item.ItemStackTemplate> seed, Optional<net.minecraft.world.item.ItemStackTemplate> crop, Optional<net.minecraft.world.item.ItemStackTemplate> tool) Creates an instance of aPlantrecord class.- Parameters:
growthType- the value for thegrowthTyperecord componentallStates- the value for theallStatesrecord componentseed- the value for theseedrecord componentcrop- the value for thecroprecord componenttool- the value for thetoolrecord component
-
-
Method Details
-
createContext
public GrowthContext createContext(net.minecraft.server.level.ServerPlayer player, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.item.ItemStack tool) - Parameters:
player- TheServerPlayerto use.level- TheServerLevelto use.pos- TheBlockPosto use.state- TheBlockStateto use.tool- TheItemStackto use.- Returns:
- A new
GrowthContext.
-
toString
-
hashCode
-
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). -
growthType
Returns the value of thegrowthTyperecord component.- Returns:
- the value of the
growthTyperecord component
-
allStates
-
seed
-
crop
-
tool
-