Class PiglinAi
java.lang.Object
net.minecraft.world.entity.monster.piglin.PiglinAi
-
Field Summary
Modifier and TypeFieldDescriptionprivate static int
private static int
private static UniformInt
private static UniformInt
private static int
static Item
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static int
private static float
static int
static int
private static UniformInt
private static UniformInt
private static UniformInt
private static float
private static float
private static float
private static float
private static float
private static float
private static float
private static float
private static 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 SetWalkTargetAwayFrom<BlockPos>
private static CopyMemoryWithExpiry<Piglin,LivingEntity>
private static CopyMemoryWithExpiry<Piglin,LivingEntity>
private static RunSometimes<Piglin>
protected static void
broadcastAngerTarget(AbstractPiglin p_34896_, LivingEntity p_34897_)
protected static void
broadcastDontKillAnyMoreHoglinsForAWhile(Piglin p_34978_)
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 boolean
doesntSeeAnyPlayerHoldingLovedItem(LivingEntity p_34983_)
protected static void
dontKillAnyMoreHoglinsForAWhile(AbstractPiglin p_34923_)
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_)
getNearestVisibleTargetablePlayer(AbstractPiglin p_34894_)
private static Vec3
getRandomNearbyPos(Piglin p_35017_)
private static SoundEvent
getSoundForActivity(Piglin p_34855_, Activity p_34856_)
static Optional<SoundEvent>
getSoundForCurrentActivity(Piglin p_34948_)
private static List<AbstractPiglin>
getVisibleAdultPiglins(Piglin p_35005_)
protected static boolean
hasAnyoneNearbyHuntedRecently(Piglin p_34966_)
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_34833_)
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_)
private static boolean
seesPlayerHoldingWantedItem(Piglin p_149972_)
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:
- Constant Field Values
-
REPELLENT_DETECTION_RANGE_VERTICAL
public static final int REPELLENT_DETECTION_RANGE_VERTICAL- See Also:
- Constant Field Values
-
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
-
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
-
RIDE_DURATION
-
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
-
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
-
initMemories
-
initCoreActivity
-
initIdleActivity
-
initFightActivity
-
initCelebrateActivity
-
initAdmireItemActivity
-
initRetreatActivity
-
initRideHoglinActivity
-
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
-
hasAnyoneNearbyHuntedRecently
-
getVisibleAdultPiglins
-
getAdultPiglins
-
isWearingGold
-
stopWalking
-
babySometimesRideBabyHoglin
-
broadcastAngerTarget
-
broadcastUniversalAnger
-
broadcastDontKillAnyMoreHoglinsForAWhile
-
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
-
seesPlayerHoldingWantedItem
-
eat
-
getRandomNearbyPos
-
hasEatenRecently
-
isIdle
-
hasCrossbow
-
admireGoldItem
-
isAdmiringItem
-
isBarterCurrency
-
isFood
-
isNearRepellent
-
seesPlayerHoldingLovedItem
-
doesntSeeAnyPlayerHoldingLovedItem
-
isPlayerHoldingLovedItem
-
isAdmiringDisabled
-
wasHurtRecently
-
isHoldingItemInOffHand
-
isNotHoldingLovedItemInOffHand
-
isZombified
-