Record Class Upgrade
java.lang.Object
java.lang.Record
com.blamejared.ironsmelters.component.Upgrade
- All Implemented Interfaces:
net.minecraft.world.item.component.TooltipProvider
public record Upgrade(Optional<SmelterType> from, SmelterType to, boolean keepData)
extends Record
implements net.minecraft.world.item.component.TooltipProvider
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUpgrade(Optional<SmelterType> from, SmelterType to, boolean keepData) Creates an instance of aUpgraderecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(net.minecraft.world.item.Item.TooltipContext context, Consumer<net.minecraft.network.chat.Component> tooltipAdder, net.minecraft.world.item.TooltipFlag tooltipFlag) final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.booleankeepData()Returns the value of thekeepDatarecord component.booleanmatches(net.minecraft.world.level.block.state.BlockState state) to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.booleanupgrade(net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.core.BlockPos pos)
-
Field Details
-
PREDICATE
-
CODEC
-
-
Constructor Details
-
Upgrade
Creates an instance of aUpgraderecord class.- Parameters:
from- the value for thefromrecord componentto- the value for thetorecord componentkeepData- the value for thekeepDatarecord component
-
-
Method Details
-
matches
public boolean matches(net.minecraft.world.level.block.state.BlockState state) -
upgrade
public boolean upgrade(net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.core.BlockPos pos) -
addToTooltip
public void addToTooltip(net.minecraft.world.item.Item.TooltipContext context, Consumer<net.minecraft.network.chat.Component> tooltipAdder, net.minecraft.world.item.TooltipFlag tooltipFlag) - 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 '=='. -
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-
keepData
public boolean keepData()Returns the value of thekeepDatarecord component.- Returns:
- the value of the
keepDatarecord component
-