Class TradeWithVillagerEvent


public class TradeWithVillagerEvent extends PlayerEvent
Fired when a player trades with an AbstractVillager.

This event is not

invalid reference
cancellable
, and does not
invalid reference
have a result
.

This event is fired on the main Forge event bus, only on the

invalid reference
logical server
.

  • Field Details

    • offer

      private final net.minecraft.world.item.trading.MerchantOffer offer
    • abstractVillager

      private final net.minecraft.world.entity.npc.AbstractVillager abstractVillager
  • Constructor Details

    • TradeWithVillagerEvent

      @Internal public TradeWithVillagerEvent(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.trading.MerchantOffer offer, net.minecraft.world.entity.npc.AbstractVillager abstractVillager)
  • Method Details

    • getMerchantOffer

      public net.minecraft.world.item.trading.MerchantOffer getMerchantOffer()
      Returns the MerchantOffer selected by the player to trade with.
      Returns:
      the MerchantOffer selected by the player to trade with
    • getAbstractVillager

      public net.minecraft.world.entity.npc.AbstractVillager getAbstractVillager()
      Returns the villager the player traded with.
      Returns:
      the villager the player traded with