java.lang.Object
net.minecraft.world.entity.monster.piglin.PiglinAi

public class PiglinAi extends Object
  • Field Details

    • REPELLENT_DETECTION_RANGE_HORIZONTAL

      public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL
      See Also:
      Constant Field Values
    • REPELLENT_DETECTION_RANGE_VERTICAL

      public static final int REPELLENT_DETECTION_RANGE_VERTICAL
      See Also:
      Constant Field Values
    • BARTERING_ITEM

      public static final Item BARTERING_ITEM
    • PLAYER_ANGER_RANGE

      private static final int PLAYER_ANGER_RANGE
      See Also:
      Constant Field Values
    • ANGER_DURATION

      private static final int ANGER_DURATION
      See Also:
      Constant Field Values
    • ADMIRE_DURATION

      private static final int ADMIRE_DURATION
      See Also:
      Constant Field Values
    • MAX_DISTANCE_TO_WALK_TO_ITEM

      private static final int MAX_DISTANCE_TO_WALK_TO_ITEM
      See Also:
      Constant Field Values
    • MAX_TIME_TO_WALK_TO_ITEM

      private static final int MAX_TIME_TO_WALK_TO_ITEM
      See Also:
      Constant Field Values
    • HOW_LONG_TIME_TO_DISABLE_ADMIRE_WALKING_IF_CANT_REACH_ITEM

      private static final int HOW_LONG_TIME_TO_DISABLE_ADMIRE_WALKING_IF_CANT_REACH_ITEM
      See Also:
      Constant Field Values
    • CELEBRATION_TIME

      private static final int CELEBRATION_TIME
      See Also:
      Constant Field Values
    • TIME_BETWEEN_HUNTS

      private static final UniformInt TIME_BETWEEN_HUNTS
    • BABY_FLEE_DURATION_AFTER_GETTING_HIT

      private static final int BABY_FLEE_DURATION_AFTER_GETTING_HIT
      See Also:
      Constant Field Values
    • HIT_BY_PLAYER_MEMORY_TIMEOUT

      private static final int HIT_BY_PLAYER_MEMORY_TIMEOUT
      See Also:
      Constant Field Values
    • MAX_WALK_DISTANCE_TO_START_RIDING

      private static final int MAX_WALK_DISTANCE_TO_START_RIDING
      See Also:
      Constant Field Values
    • RIDE_START_INTERVAL

      private static final UniformInt RIDE_START_INTERVAL
    • RIDE_DURATION

      private static final UniformInt RIDE_DURATION
    • RETREAT_DURATION

      private static final UniformInt RETREAT_DURATION
    • MELEE_ATTACK_COOLDOWN

      private static final int MELEE_ATTACK_COOLDOWN
      See Also:
      Constant Field Values
    • EAT_COOLDOWN

      private static final int EAT_COOLDOWN
      See Also:
      Constant Field Values
    • DESIRED_DISTANCE_FROM_ENTITY_WHEN_AVOIDING

      private static final int DESIRED_DISTANCE_FROM_ENTITY_WHEN_AVOIDING
      See Also:
      Constant Field Values
    • MAX_LOOK_DIST

      private static final int MAX_LOOK_DIST
      See Also:
      Constant Field Values
    • MAX_LOOK_DIST_FOR_PLAYER_HOLDING_LOVED_ITEM

      private static final int MAX_LOOK_DIST_FOR_PLAYER_HOLDING_LOVED_ITEM
      See Also:
      Constant Field Values
    • INTERACTION_RANGE

      private static final int INTERACTION_RANGE
      See Also:
      Constant Field Values
    • MIN_DESIRED_DIST_FROM_TARGET_WHEN_HOLDING_CROSSBOW

      private static final int MIN_DESIRED_DIST_FROM_TARGET_WHEN_HOLDING_CROSSBOW
      See Also:
      Constant Field Values
    • SPEED_WHEN_STRAFING_BACK_FROM_TARGET

      private static final float SPEED_WHEN_STRAFING_BACK_FROM_TARGET
      See Also:
      Constant Field Values
    • DESIRED_DISTANCE_FROM_ZOMBIFIED

      private static final int DESIRED_DISTANCE_FROM_ZOMBIFIED
      See Also:
      Constant Field Values
    • AVOID_ZOMBIFIED_DURATION

      private static final UniformInt AVOID_ZOMBIFIED_DURATION
    • BABY_AVOID_NEMESIS_DURATION

      private static final UniformInt BABY_AVOID_NEMESIS_DURATION
    • PROBABILITY_OF_CELEBRATION_DANCE

      private static final float PROBABILITY_OF_CELEBRATION_DANCE
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_AVOIDING

      private static final float SPEED_MULTIPLIER_WHEN_AVOIDING
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_RETREATING

      private static final float SPEED_MULTIPLIER_WHEN_RETREATING
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_MOUNTING

      private static final float SPEED_MULTIPLIER_WHEN_MOUNTING
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_GOING_TO_WANTED_ITEM

      private static final float SPEED_MULTIPLIER_WHEN_GOING_TO_WANTED_ITEM
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_GOING_TO_CELEBRATE_LOCATION

      private static final float SPEED_MULTIPLIER_WHEN_GOING_TO_CELEBRATE_LOCATION
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_DANCING

      private static final float SPEED_MULTIPLIER_WHEN_DANCING
      See Also:
      Constant Field Values
    • SPEED_MULTIPLIER_WHEN_IDLING

      private static final float SPEED_MULTIPLIER_WHEN_IDLING
      See Also:
      Constant Field Values
  • Constructor Details

    • PiglinAi

      public PiglinAi()
  • Method Details

    • makeBrain

      protected static Brain<?> makeBrain(Piglin p_34841_, Brain<Piglin> p_34842_)
    • initMemories

      protected static void initMemories(Piglin p_34833_)
    • initCoreActivity

      private static void initCoreActivity(Brain<Piglin> p_34821_)
    • initIdleActivity

      private static void initIdleActivity(Brain<Piglin> p_34892_)
    • initFightActivity

      private static void initFightActivity(Piglin p_34904_, Brain<Piglin> p_34905_)
    • initCelebrateActivity

      private static void initCelebrateActivity(Brain<Piglin> p_34921_)
    • initAdmireItemActivity

      private static void initAdmireItemActivity(Brain<Piglin> p_34941_)
    • initRetreatActivity

      private static void initRetreatActivity(Brain<Piglin> p_34959_)
    • initRideHoglinActivity

      private static void initRideHoglinActivity(Brain<Piglin> p_34974_)
    • createIdleLookBehaviors

      private static RunOne<Piglin> createIdleLookBehaviors()
    • createIdleMovementBehaviors

      private static RunOne<Piglin> createIdleMovementBehaviors()
    • avoidRepellent

      private static SetWalkTargetAwayFrom<BlockPos> avoidRepellent()
    • babyAvoidNemesis

      private static CopyMemoryWithExpiry<Piglin,​LivingEntity> babyAvoidNemesis()
    • avoidZombified

      private static CopyMemoryWithExpiry<Piglin,​LivingEntity> avoidZombified()
    • updateActivity

      protected static void updateActivity(Piglin p_34899_)
    • isBabyRidingBaby

      private static boolean isBabyRidingBaby(Piglin p_34993_)
    • pickUpItem

      protected static void pickUpItem(Piglin p_34844_, ItemEntity p_34845_)
    • holdInOffhand

      private static void holdInOffhand(Piglin p_34933_, ItemStack p_34934_)
    • removeOneItemFromItemEntity

      private static ItemStack removeOneItemFromItemEntity(ItemEntity p_34823_)
    • stopHoldingOffHandItem

      protected static void stopHoldingOffHandItem(Piglin p_34868_, boolean p_34869_)
    • cancelAdmiring

      protected static void cancelAdmiring(Piglin p_34928_)
    • putInInventory

      private static void putInInventory(Piglin p_34953_, ItemStack p_34954_)
    • throwItems

      private static void throwItems(Piglin p_34861_, List<ItemStack> p_34862_)
    • throwItemsTowardRandomPos

      private static void throwItemsTowardRandomPos(Piglin p_34913_, List<ItemStack> p_34914_)
    • throwItemsTowardPlayer

      private static void throwItemsTowardPlayer(Piglin p_34851_, Player p_34852_, List<ItemStack> p_34853_)
    • throwItemsTowardPos

      private static void throwItemsTowardPos(Piglin p_34864_, List<ItemStack> p_34865_, Vec3 p_34866_)
    • getBarterResponseItems

      private static List<ItemStack> getBarterResponseItems(Piglin p_34997_)
    • wantsToDance

      private static boolean wantsToDance(LivingEntity p_34811_, LivingEntity p_34812_)
    • wantsToPickup

      protected static boolean wantsToPickup(Piglin p_34858_, ItemStack p_34859_)
    • isLovedItem

      protected static boolean isLovedItem(ItemStack p_149966_)
    • wantsToStopRiding

      private static boolean wantsToStopRiding(Piglin p_34835_, Entity p_34836_)
    • isNearestValidAttackTarget

      private static boolean isNearestValidAttackTarget(Piglin p_34901_, LivingEntity p_34902_)
    • isNearZombified

      private static boolean isNearZombified(Piglin p_34999_)
    • findNearestValidAttackTarget

      private static Optional<? extends LivingEntity> findNearestValidAttackTarget(Piglin p_35001_)
    • angerNearbyPiglins

      public static void angerNearbyPiglins(Player p_34874_, boolean p_34875_)
    • mobInteract

      public static InteractionResult mobInteract(Piglin p_34847_, Player p_34848_, InteractionHand p_34849_)
    • canAdmire

      protected static boolean canAdmire(Piglin p_34910_, ItemStack p_34911_)
    • wasHurtBy

      protected static void wasHurtBy(Piglin p_34838_, LivingEntity p_34839_)
    • maybeRetaliate

      protected static void maybeRetaliate(AbstractPiglin p_34827_, LivingEntity p_34828_)
    • getSoundForCurrentActivity

      public static Optional<SoundEvent> getSoundForCurrentActivity(Piglin p_34948_)
    • getSoundForActivity

      private static SoundEvent getSoundForActivity(Piglin p_34855_, Activity p_34856_)
    • isNearAvoidTarget

      private static boolean isNearAvoidTarget(Piglin p_35003_)
    • hasAnyoneNearbyHuntedRecently

      protected static boolean hasAnyoneNearbyHuntedRecently(Piglin p_34966_)
    • getVisibleAdultPiglins

      private static List<AbstractPiglin> getVisibleAdultPiglins(Piglin p_35005_)
    • getAdultPiglins

      private static List<AbstractPiglin> getAdultPiglins(AbstractPiglin p_34961_)
    • isWearingGold

      public static boolean isWearingGold(LivingEntity p_34809_)
    • stopWalking

      private static void stopWalking(Piglin p_35007_)
    • babySometimesRideBabyHoglin

      private static RunSometimes<Piglin> babySometimesRideBabyHoglin()
    • broadcastAngerTarget

      protected static void broadcastAngerTarget(AbstractPiglin p_34896_, LivingEntity p_34897_)
    • broadcastUniversalAnger

      protected static void broadcastUniversalAnger(AbstractPiglin p_34825_)
    • broadcastDontKillAnyMoreHoglinsForAWhile

      protected static void broadcastDontKillAnyMoreHoglinsForAWhile(Piglin p_34978_)
    • setAngerTarget

      protected static void setAngerTarget(AbstractPiglin p_34925_, LivingEntity p_34926_)
    • setAngerTargetToNearestTargetablePlayerIfFound

      private static void setAngerTargetToNearestTargetablePlayerIfFound(AbstractPiglin p_34945_, LivingEntity p_34946_)
    • setAngerTargetIfCloserThanCurrent

      private static void setAngerTargetIfCloserThanCurrent(AbstractPiglin p_34963_, LivingEntity p_34964_)
    • getAngerTarget

      private static Optional<LivingEntity> getAngerTarget(AbstractPiglin p_34976_)
    • getAvoidTarget

      public static Optional<LivingEntity> getAvoidTarget(Piglin p_34987_)
    • getNearestVisibleTargetablePlayer

      public static Optional<Player> getNearestVisibleTargetablePlayer(AbstractPiglin p_34894_)
    • broadcastRetreat

      private static void broadcastRetreat(Piglin p_34930_, LivingEntity p_34931_)
    • retreatFromNearestTarget

      private static void retreatFromNearestTarget(Piglin p_34950_, LivingEntity p_34951_)
    • wantsToStopFleeing

      private static boolean wantsToStopFleeing(Piglin p_35009_)
    • piglinsEqualOrOutnumberHoglins

      private static boolean piglinsEqualOrOutnumberHoglins(Piglin p_35011_)
    • hoglinsOutnumberPiglins

      private static boolean hoglinsOutnumberPiglins(Piglin p_35013_)
    • setAvoidTargetAndDontHuntForAWhile

      private static void setAvoidTargetAndDontHuntForAWhile(Piglin p_34968_, LivingEntity p_34969_)
    • dontKillAnyMoreHoglinsForAWhile

      protected static void dontKillAnyMoreHoglinsForAWhile(AbstractPiglin p_34923_)
    • seesPlayerHoldingWantedItem

      private static boolean seesPlayerHoldingWantedItem(Piglin p_149972_)
    • eat

      private static void eat(Piglin p_35015_)
    • getRandomNearbyPos

      private static Vec3 getRandomNearbyPos(Piglin p_35017_)
    • hasEatenRecently

      private static boolean hasEatenRecently(Piglin p_35019_)
    • isIdle

      protected static boolean isIdle(AbstractPiglin p_34943_)
    • hasCrossbow

      private static boolean hasCrossbow(LivingEntity p_34919_)
    • admireGoldItem

      private static void admireGoldItem(LivingEntity p_34939_)
    • isAdmiringItem

      private static boolean isAdmiringItem(Piglin p_35021_)
    • isBarterCurrency

      private static boolean isBarterCurrency(ItemStack p_149968_)
    • isFood

      private static boolean isFood(ItemStack p_149970_)
    • isNearRepellent

      private static boolean isNearRepellent(Piglin p_35023_)
    • seesPlayerHoldingLovedItem

      private static boolean seesPlayerHoldingLovedItem(LivingEntity p_34972_)
    • doesntSeeAnyPlayerHoldingLovedItem

      private static boolean doesntSeeAnyPlayerHoldingLovedItem(LivingEntity p_34983_)
    • isPlayerHoldingLovedItem

      public static boolean isPlayerHoldingLovedItem(LivingEntity p_34884_)
    • isAdmiringDisabled

      private static boolean isAdmiringDisabled(Piglin p_35025_)
    • wasHurtRecently

      private static boolean wasHurtRecently(LivingEntity p_34989_)
    • isHoldingItemInOffHand

      private static boolean isHoldingItemInOffHand(Piglin p_35027_)
    • isNotHoldingLovedItemInOffHand

      private static boolean isNotHoldingLovedItemInOffHand(Piglin p_35029_)
    • isZombified

      public static boolean isZombified(EntityType<?> p_34807_)