Class PiglinAi
java.lang.Object
net.minecraft.world.entity.monster.piglin.PiglinAi
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
private static final UniformInt
private static final UniformInt
private static final int
static final Item
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final float
static final int
static final int
private static final UniformInt
private static final UniformInt
private static final UniformInt
private static final float
private static final float
private static final float
private static final float
private static final float
private static final float
private static final float
private static final float
protected static final UniformInt
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
admireGoldItem
(LivingEntity p_34939_) static void
angerNearbyPiglins
(Player p_34874_, boolean p_34875_) private static BehaviorControl<PathfinderMob>
private static BehaviorControl<Piglin>
private static BehaviorControl<Piglin>
private static BehaviorControl<LivingEntity>
protected static void
broadcastAngerTarget
(AbstractPiglin p_34896_, LivingEntity p_34897_) private static void
broadcastRetreat
(Piglin p_34930_, LivingEntity p_34931_) protected static void
broadcastUniversalAnger
(AbstractPiglin p_34825_) protected static boolean
protected static void
cancelAdmiring
(Piglin p_34928_) private static RunOne<LivingEntity>
private static com.google.common.collect.ImmutableList<com.mojang.datafixers.util.Pair<OneShot<LivingEntity>,
Integer>> private static boolean
protected static void
private static void
private static Optional<? extends LivingEntity>
findNearestValidAttackTarget
(Piglin p_35001_) private static List<AbstractPiglin>
getAdultPiglins
(AbstractPiglin p_34961_) private static Optional<LivingEntity>
getAngerTarget
(AbstractPiglin p_34976_) static Optional<LivingEntity>
getAvoidTarget
(Piglin p_34987_) getBarterResponseItems
(Piglin p_34997_) private static Vec3
getRandomNearbyPos
(Piglin p_35017_) private static SoundEvent
getSoundForActivity
(Piglin p_34855_, Activity p_34856_) static Optional<SoundEvent>
getSoundForCurrentActivity
(Piglin p_34948_) protected static List<AbstractPiglin>
getVisibleAdultPiglins
(Piglin p_35005_) private static boolean
hasCrossbow
(LivingEntity p_34919_) private static boolean
hasEatenRecently
(Piglin p_35019_) private static boolean
hoglinsOutnumberPiglins
(Piglin p_35013_) private static void
holdInOffhand
(Piglin p_34933_, ItemStack p_34934_) private static void
initAdmireItemActivity
(Brain<Piglin> p_34941_) private static void
initCelebrateActivity
(Brain<Piglin> p_34921_) private static void
initCoreActivity
(Brain<Piglin> p_34821_) private static void
initFightActivity
(Piglin p_34904_, Brain<Piglin> p_34905_) private static void
initIdleActivity
(Brain<Piglin> p_34892_) protected static void
initMemories
(Piglin p_219206_, RandomSource p_219207_) private static void
initRetreatActivity
(Brain<Piglin> p_34959_) private static void
initRideHoglinActivity
(Brain<Piglin> p_34974_) private static boolean
isAdmiringDisabled
(Piglin p_35025_) private static boolean
isAdmiringItem
(Piglin p_35021_) private static boolean
isBabyRidingBaby
(Piglin p_34993_) private static boolean
isBarterCurrency
(ItemStack p_149968_) private static boolean
private static boolean
isHoldingItemInOffHand
(Piglin p_35027_) protected static boolean
isIdle
(AbstractPiglin p_34943_) protected static boolean
isLovedItem
(ItemStack p_149966_) private static boolean
isNearAvoidTarget
(Piglin p_35003_) private static boolean
isNearestValidAttackTarget
(Piglin p_34901_, LivingEntity p_34902_) private static boolean
isNearRepellent
(Piglin p_35023_) private static boolean
isNearZombified
(Piglin p_34999_) private static boolean
isNotHoldingLovedItemInOffHand
(Piglin p_35029_) static boolean
isPlayerHoldingLovedItem
(LivingEntity p_34884_) static boolean
isWearingGold
(LivingEntity p_34809_) static boolean
isZombified
(EntityType<?> p_34807_) protected static Brain<?>
protected static void
maybeRetaliate
(AbstractPiglin p_34827_, LivingEntity p_34828_) static InteractionResult
mobInteract
(Piglin p_34847_, Player p_34848_, InteractionHand p_34849_) protected static void
pickUpItem
(Piglin p_34844_, ItemEntity p_34845_) private static boolean
piglinsEqualOrOutnumberHoglins
(Piglin p_35011_) private static void
putInInventory
(Piglin p_34953_, ItemStack p_34954_) private static ItemStack
removeOneItemFromItemEntity
(ItemEntity p_34823_) private static void
retreatFromNearestTarget
(Piglin p_34950_, LivingEntity p_34951_) private static boolean
seesPlayerHoldingLovedItem
(LivingEntity p_34972_) protected static void
setAngerTarget
(AbstractPiglin p_34925_, LivingEntity p_34926_) private static void
setAngerTargetIfCloserThanCurrent
(AbstractPiglin p_34963_, LivingEntity p_34964_) private static void
setAngerTargetToNearestTargetablePlayerIfFound
(AbstractPiglin p_34945_, LivingEntity p_34946_) private static void
setAvoidTargetAndDontHuntForAWhile
(Piglin p_34968_, LivingEntity p_34969_) protected static void
stopHoldingOffHandItem
(Piglin p_34868_, boolean p_34869_) private static void
stopWalking
(Piglin p_35007_) private static void
throwItems
(Piglin p_34861_, List<ItemStack> p_34862_) private static void
throwItemsTowardPlayer
(Piglin p_34851_, Player p_34852_, List<ItemStack> p_34853_) private static void
throwItemsTowardPos
(Piglin p_34864_, List<ItemStack> p_34865_, Vec3 p_34866_) private static void
throwItemsTowardRandomPos
(Piglin p_34913_, List<ItemStack> p_34914_) protected static void
updateActivity
(Piglin p_34899_) private static boolean
wantsToDance
(LivingEntity p_34811_, LivingEntity p_34812_) protected static boolean
wantsToPickup
(Piglin p_34858_, ItemStack p_34859_) private static boolean
wantsToStopFleeing
(Piglin p_35009_) private static boolean
wantsToStopRiding
(Piglin p_34835_, Entity p_34836_) protected static void
wasHurtBy
(Piglin p_34838_, LivingEntity p_34839_) private static boolean
wasHurtRecently
(LivingEntity p_34989_)
-
Field Details
-
REPELLENT_DETECTION_RANGE_HORIZONTAL
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL- See Also:
-
REPELLENT_DETECTION_RANGE_VERTICAL
public static final int REPELLENT_DETECTION_RANGE_VERTICAL- See Also:
-
BARTERING_ITEM
-
PLAYER_ANGER_RANGE
private static final int PLAYER_ANGER_RANGE- See Also:
-
ANGER_DURATION
private static final int ANGER_DURATION- See Also:
-
ADMIRE_DURATION
private static final int ADMIRE_DURATION- See Also:
-
MAX_DISTANCE_TO_WALK_TO_ITEM
private static final int MAX_DISTANCE_TO_WALK_TO_ITEM- See Also:
-
MAX_TIME_TO_WALK_TO_ITEM
private static final int MAX_TIME_TO_WALK_TO_ITEM- See Also:
-
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:
-
CELEBRATION_TIME
private static final int CELEBRATION_TIME- See Also:
-
TIME_BETWEEN_HUNTS
-
BABY_FLEE_DURATION_AFTER_GETTING_HIT
private static final int BABY_FLEE_DURATION_AFTER_GETTING_HIT- See Also:
-
HIT_BY_PLAYER_MEMORY_TIMEOUT
private static final int HIT_BY_PLAYER_MEMORY_TIMEOUT- See Also:
-
MAX_WALK_DISTANCE_TO_START_RIDING
private static final int MAX_WALK_DISTANCE_TO_START_RIDING- See Also:
-
RIDE_START_INTERVAL
-
RIDE_DURATION
-
RETREAT_DURATION
-
MELEE_ATTACK_COOLDOWN
private static final int MELEE_ATTACK_COOLDOWN- See Also:
-
EAT_COOLDOWN
private static final int EAT_COOLDOWN- See Also:
-
DESIRED_DISTANCE_FROM_ENTITY_WHEN_AVOIDING
private static final int DESIRED_DISTANCE_FROM_ENTITY_WHEN_AVOIDING- See Also:
-
MAX_LOOK_DIST
private static final int MAX_LOOK_DIST- See Also:
-
MAX_LOOK_DIST_FOR_PLAYER_HOLDING_LOVED_ITEM
private static final int MAX_LOOK_DIST_FOR_PLAYER_HOLDING_LOVED_ITEM- See Also:
-
INTERACTION_RANGE
private static final int INTERACTION_RANGE- See Also:
-
MIN_DESIRED_DIST_FROM_TARGET_WHEN_HOLDING_CROSSBOW
private static final int MIN_DESIRED_DIST_FROM_TARGET_WHEN_HOLDING_CROSSBOW- See Also:
-
SPEED_WHEN_STRAFING_BACK_FROM_TARGET
private static final float SPEED_WHEN_STRAFING_BACK_FROM_TARGET- See Also:
-
DESIRED_DISTANCE_FROM_ZOMBIFIED
private static final int DESIRED_DISTANCE_FROM_ZOMBIFIED- See Also:
-
AVOID_ZOMBIFIED_DURATION
-
BABY_AVOID_NEMESIS_DURATION
-
PROBABILITY_OF_CELEBRATION_DANCE
private static final float PROBABILITY_OF_CELEBRATION_DANCE- See Also:
-
SPEED_MULTIPLIER_WHEN_AVOIDING
private static final float SPEED_MULTIPLIER_WHEN_AVOIDING- See Also:
-
SPEED_MULTIPLIER_WHEN_RETREATING
private static final float SPEED_MULTIPLIER_WHEN_RETREATING- See Also:
-
SPEED_MULTIPLIER_WHEN_MOUNTING
private static final float SPEED_MULTIPLIER_WHEN_MOUNTING- See Also:
-
SPEED_MULTIPLIER_WHEN_GOING_TO_WANTED_ITEM
private static final float SPEED_MULTIPLIER_WHEN_GOING_TO_WANTED_ITEM- See Also:
-
SPEED_MULTIPLIER_WHEN_GOING_TO_CELEBRATE_LOCATION
private static final float SPEED_MULTIPLIER_WHEN_GOING_TO_CELEBRATE_LOCATION- See Also:
-
SPEED_MULTIPLIER_WHEN_DANCING
private static final float SPEED_MULTIPLIER_WHEN_DANCING- See Also:
-
SPEED_MULTIPLIER_WHEN_IDLING
private static final float SPEED_MULTIPLIER_WHEN_IDLING- See Also:
-
-
Constructor Details
-
PiglinAi
public PiglinAi()
-
-
Method Details
-
makeBrain
-
initMemories
-
initCoreActivity
-
initIdleActivity
-
initFightActivity
-
initCelebrateActivity
-
initAdmireItemActivity
-
initRetreatActivity
-
initRideHoglinActivity
-
createLookBehaviors
private static com.google.common.collect.ImmutableList<com.mojang.datafixers.util.Pair<OneShot<LivingEntity>,Integer>> createLookBehaviors() -
createIdleLookBehaviors
-
createIdleMovementBehaviors
-
avoidRepellent
-
babyAvoidNemesis
-
avoidZombified
-
updateActivity
-
isBabyRidingBaby
-
pickUpItem
-
holdInOffhand
-
removeOneItemFromItemEntity
-
stopHoldingOffHandItem
-
cancelAdmiring
-
putInInventory
-
throwItems
-
throwItemsTowardRandomPos
-
throwItemsTowardPlayer
-
throwItemsTowardPos
-
getBarterResponseItems
-
wantsToDance
-
wantsToPickup
-
isLovedItem
-
wantsToStopRiding
-
isNearestValidAttackTarget
-
isNearZombified
-
findNearestValidAttackTarget
-
angerNearbyPiglins
-
mobInteract
public static InteractionResult mobInteract(Piglin p_34847_, Player p_34848_, InteractionHand p_34849_) -
canAdmire
-
wasHurtBy
-
maybeRetaliate
-
getSoundForCurrentActivity
-
getSoundForActivity
-
isNearAvoidTarget
-
getVisibleAdultPiglins
-
getAdultPiglins
-
isWearingGold
-
stopWalking
-
babySometimesRideBabyHoglin
-
broadcastAngerTarget
-
broadcastUniversalAnger
-
setAngerTarget
-
setAngerTargetToNearestTargetablePlayerIfFound
private static void setAngerTargetToNearestTargetablePlayerIfFound(AbstractPiglin p_34945_, LivingEntity p_34946_) -
setAngerTargetIfCloserThanCurrent
private static void setAngerTargetIfCloserThanCurrent(AbstractPiglin p_34963_, LivingEntity p_34964_) -
getAngerTarget
-
getAvoidTarget
-
getNearestVisibleTargetablePlayer
-
broadcastRetreat
-
retreatFromNearestTarget
-
wantsToStopFleeing
-
piglinsEqualOrOutnumberHoglins
-
hoglinsOutnumberPiglins
-
setAvoidTargetAndDontHuntForAWhile
-
dontKillAnyMoreHoglinsForAWhile
-
eat
-
getRandomNearbyPos
-
hasEatenRecently
-
isIdle
-
hasCrossbow
-
admireGoldItem
-
isAdmiringItem
-
isBarterCurrency
-
isFood
-
isNearRepellent
-
seesPlayerHoldingLovedItem
-
doesntSeeAnyPlayerHoldingLovedItem
-
isPlayerHoldingLovedItem
-
isAdmiringDisabled
-
wasHurtRecently
-
isHoldingItemInOffHand
-
isNotHoldingLovedItemInOffHand
-
isZombified
-