Record Class UnlockTradeEntityReward
java.lang.Object
java.lang.Record
petrolpark.mc.library.core.data.reward.entity.UnlockTradeEntityReward
- All Implemented Interfaces:
net.minecraft.world.level.storage.loot.LootContextUser,IEntityReward,ISimpleEntityReward,IAbstractReward<IEntityReward.Type>,INamedRewardInfo,IRewardInfo
@ParametersAreNonnullByDefault
public record UnlockTradeEntityReward(net.minecraft.world.item.trading.MerchantOffer trade)
extends Record
implements ISimpleEntityReward
petrolpark:unlock_trade
Trade to the Entity (if they are a Merchant).
Arguments:
-
trade- TheMerchantOfferto add to the recipient
-
Nested Class Summary
Nested classes/interfaces inherited from interface petrolpark.mc.library.core.data.reward.entity.IEntityReward
IEntityReward.TypeNested classes/interfaces inherited from interface petrolpark.mc.library.core.data.reward.info.INamedRewardInfo
INamedRewardInfo.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<UnlockTradeEntityReward> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, UnlockTradeEntityReward> Fields inherited from interface petrolpark.mc.library.core.data.reward.entity.IEntityReward
TYPED_CODECFields inherited from interface petrolpark.mc.library.core.data.reward.info.IRewardInfo
DIRECT_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionUnlockTradeEntityReward(net.minecraft.world.item.trading.MerchantOffer trade) Creates an instance of aUnlockTradeEntityRewardrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidfinal booleanIndicates whether some other object is "equal to" this one.getType()final inthashCode()Returns a hash code value for this object.voidrender(net.minecraft.client.gui.GuiGraphics graphics) booleanreward(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.storage.loot.LootContext context, float multiplier, boolean simulate) final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.trading.MerchantOffertrade()Returns the value of thetraderecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface petrolpark.mc.library.core.data.reward.info.INamedRewardInfo
translate, translateSimpleMethods inherited from interface petrolpark.mc.library.core.data.reward.entity.ISimpleEntityReward
getRewardInfoType, infoMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams, validate
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,UnlockTradeEntityReward> STREAM_CODEC
-
-
Constructor Details
-
UnlockTradeEntityReward
public UnlockTradeEntityReward(net.minecraft.world.item.trading.MerchantOffer trade) Creates an instance of aUnlockTradeEntityRewardrecord class.- Parameters:
trade- the value for thetraderecord component
-
-
Method Details
-
reward
public boolean reward(net.minecraft.world.entity.Entity entity, net.minecraft.world.level.storage.loot.LootContext context, float multiplier, boolean simulate) - Specified by:
rewardin interfaceIEntityReward
-
render
public void render(net.minecraft.client.gui.GuiGraphics graphics) - Specified by:
renderin interfaceIRewardInfo
-
addToDescription
- Specified by:
addToDescriptionin interfaceIRewardInfo
-
getType
- Specified by:
getTypein interfaceIAbstractReward<IEntityReward.Type>- Specified by:
getTypein interfaceISimpleEntityReward
-
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). -
trade
public net.minecraft.world.item.trading.MerchantOffer trade()Returns the value of thetraderecord component.- Returns:
- the value of the
traderecord component
-