Interface WanderingTrader

All Superinterfaces:
AbstractVillager, Ageable, Attributable, Audience, Breedable, CommandSender, Creature, Damageable, DataComponentView, Entity, Frictional, HoverEventSource<HoverEvent.ShowEntity>, InventoryHolder, Leashable, LivingEntity, Lootable, Merchant, Metadatable, Mob, Nameable, NPC, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, ProjectileSource, ServerOperator, Sound.Emitter

public interface WanderingTrader extends AbstractVillager
Represents a wandering trader NPC
Since:
1.14
  • Method Details

    • getDespawnDelay

      int getDespawnDelay()
      Gets the despawn delay before this WanderingTrader is forcibly despawned. If this is less than or equal to 0, then the trader will not be despawned.
      Returns:
      The despawn delay before this WanderingTrader is forcibly despawned
      Since:
      1.16.5
    • setDespawnDelay

      void setDespawnDelay(int despawnDelay)
      Sets the despawn delay before this WanderingTrader is forcibly despawned. If this is less than or equal to 0, then the trader will not be despawned.
      Parameters:
      despawnDelay - The new despawn delay before this WanderingTrader is forcibly despawned
      Since:
      1.16.5
    • setCanDrinkPotion

      void setCanDrinkPotion(boolean bool)
      Set if the Wandering Trader can and will drink an invisibility potion.
      Parameters:
      bool - whether the mob will drink
      Since:
      1.16.5
    • canDrinkPotion

      boolean canDrinkPotion()
      Get if the Wandering Trader can and will drink an invisibility potion.
      Returns:
      whether the mob will drink
      Since:
      1.16.5
    • setCanDrinkMilk

      void setCanDrinkMilk(boolean bool)
      Set if the Wandering Trader can and will drink milk.
      Parameters:
      bool - whether the mob will drink
      Since:
      1.16.5
    • canDrinkMilk

      boolean canDrinkMilk()
      Get if the Wandering Trader can and will drink milk.
      Returns:
      whether the mob will drink
      Since:
      1.16.5
    • getWanderingTowards

      @Nullable Location getWanderingTowards()
      Gets the location that this wandering trader is currently wandering towards.

      This will return null if the wandering trader has finished wandering towards the given location.

      Returns:
      the location currently wandering towards, or null if not wandering
      Since:
      1.19.2
    • setWanderingTowards

      void setWanderingTowards(@Nullable Location location)
      Sets the location that this wandering trader is currently wandering towards.

      This can be set to null to prevent the wandering trader from wandering further.

      Parameters:
      location - location to wander towards (world is ignored, will always use the entity's world)
      Since:
      1.19.2