Package com.petrolpark.core.data.reward
Record Class ContextEntityReward
java.lang.Object
java.lang.Record
com.petrolpark.core.data.reward.ContextEntityReward
- All Implemented Interfaces:
IReward,ITypedReward<RewardType>,net.minecraft.world.level.storage.loot.LootContextUser
public record ContextEntityReward(IEntityTarget target, IEntityReward reward)
extends Record
implements IReward
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ContextEntityReward> static final com.mojang.serialization.Codec<ContextEntityReward> Fields inherited from interface com.petrolpark.core.data.reward.IReward
LIST_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionContextEntityReward(IEntityTarget target, IEntityReward reward) Creates an instance of aContextEntityRewardrecord class.ContextEntityReward(IEntityReward reward) -
Method Summary
Modifier and TypeMethodDescriptionvoidfinal booleanIndicates whether some other object is "equal to" this one.Set<net.minecraft.world.level.storage.loot.parameters.LootContextParam<?>> getType()final inthashCode()Returns a hash code value for this object.voidrender(net.minecraft.client.gui.GuiGraphics graphics) reward()Returns the value of therewardrecord component.final voidreward(net.minecraft.world.level.storage.loot.LootContext context, float multiplier) target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.petrolpark.core.data.reward.ITypedReward
translate, translateSimpleMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
validate
-
Field Details
-
CODEC
-
INLINE_CODEC
-
-
Constructor Details
-
ContextEntityReward
-
ContextEntityReward
Creates an instance of aContextEntityRewardrecord class.- Parameters:
target- the value for thetargetrecord componentreward- the value for therewardrecord component
-
-
Method Details
-
reward
public final void reward(net.minecraft.world.level.storage.loot.LootContext context, float multiplier) -
getType
- Specified by:
getTypein interfaceIReward- Specified by:
getTypein interfaceITypedReward<RewardType>
-
render
public void render(net.minecraft.client.gui.GuiGraphics graphics) - Specified by:
renderin interfaceITypedReward<RewardType>
-
addToDescription
- Specified by:
addToDescriptionin interfaceITypedReward<RewardType>
-
getReferencedContextParams
public Set<net.minecraft.world.level.storage.loot.parameters.LootContextParam<?>> getReferencedContextParams()- Specified by:
getReferencedContextParamsin interfacenet.minecraft.world.level.storage.loot.LootContextUser
-
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). -
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
reward
Returns the value of therewardrecord component.- Returns:
- the value of the
rewardrecord component
-