Record Class ContextEntityReward
java.lang.Object
java.lang.Record
petrolpark.mc.library.core.data.reward.ContextEntityReward
- All Implemented Interfaces:
net.minecraft.world.level.storage.loot.LootContextUser,IAbstractReward<IReward.Type>,IReward,IWrappedReward<IEntityReward>
@ParametersAreNonnullByDefault
public record ContextEntityReward(IEntityTarget target, net.minecraft.core.Holder<IEntityReward> rewardHolder)
extends Record
implements IWrappedReward<IEntityReward>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface petrolpark.mc.library.core.data.reward.IReward
IReward.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ContextEntityReward> static final com.mojang.serialization.Codec<ContextEntityReward> Fields inherited from interface petrolpark.mc.library.core.data.reward.IReward
DIRECT_CODEC, SET_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionContextEntityReward(net.minecraft.core.Holder<IEntityReward> reward) ContextEntityReward(IEntityTarget target, net.minecraft.core.Holder<IEntityReward> rewardHolder) Creates an instance of aContextEntityRewardrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getType()final inthashCode()Returns a hash code value for this object.booleanreward(net.minecraft.world.level.storage.loot.LootContext context, float multiplier, boolean simulate) net.minecraft.core.Holder<IEntityReward> Returns the value of therewardHolderrecord component.target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.wrapInfo(IRewardInfo info) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface petrolpark.mc.library.core.data.reward.IWrappedReward
info, validateMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams
-
Field Details
-
CODEC
-
INLINE_CODEC
-
-
Constructor Details
-
ContextEntityReward
-
ContextEntityReward
public ContextEntityReward(IEntityTarget target, net.minecraft.core.Holder<IEntityReward> rewardHolder) Creates an instance of aContextEntityRewardrecord class.- Parameters:
target- the value for thetargetrecord componentrewardHolder- the value for therewardHolderrecord component
-
-
Method Details
-
reward
public boolean reward(net.minecraft.world.level.storage.loot.LootContext context, float multiplier, boolean simulate) -
wrapInfo
- Specified by:
wrapInfoin interfaceIWrappedReward<IEntityReward>
-
getType
- Specified by:
getTypein interfaceIAbstractReward<IReward.Type>
-
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
-
rewardHolder
Returns the value of therewardHolderrecord component.- Specified by:
rewardHolderin interfaceIWrappedReward<IEntityReward>- Returns:
- the value of the
rewardHolderrecord component
-