Class Sensor<E extends LivingEntity>
java.lang.Object
net.minecraft.world.entity.ai.sensing.Sensor<E>
- Direct Known Subclasses:
AdultSensor
,DummySensor
,GolemSensor
,HoglinSpecificSensor
,HurtBySensor
,IsInWaterSensor
,MobSensor
,NearestBedSensor
,NearestItemSensor
,NearestLivingEntitySensor
,NearestVisibleLivingEntitySensor
,PiglinBruteSpecificSensor
,PiglinSpecificSensor
,PlayerSensor
,SecondaryPoiSensor
,TemptingSensor
,VillagerBabiesSensor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final TargetingConditions
private static final TargetingConditions
private static final TargetingConditions
private static final TargetingConditions
private static final int
private static final int
private static final RandomSource
private final int
private static final TargetingConditions
private static final TargetingConditions
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
doTick
(ServerLevel pLevel, E pEntity) static boolean
isEntityAttackable
(ServerLevel pLevel, LivingEntity pEntity, LivingEntity pTarget) static boolean
isEntityAttackableIgnoringLineOfSight
(ServerLevel pLevel, LivingEntity pEntity, LivingEntity pTarget) static boolean
isEntityTargetable
(ServerLevel pLevel, LivingEntity pEntity, LivingEntity pTarget) (package private) static <T,
U> BiPredicate <T, U> rememberPositives
(int pTicks, BiPredicate<T, U> pPredicate) abstract Set
<MemoryModuleType<?>> requires()
final void
tick
(ServerLevel pLevel, E pEntity) private void
updateTargetingConditionRanges
(E pEntity) static BiPredicate
<ServerLevel, LivingEntity> wasEntityAttackableLastNTicks
(LivingEntity pEntity, int pTicks)
-
Field Details
-
RANDOM
-
DEFAULT_SCAN_RATE
private static final int DEFAULT_SCAN_RATE- See Also:
-
DEFAULT_TARGETING_RANGE
private static final int DEFAULT_TARGETING_RANGE- See Also:
-
TARGET_CONDITIONS
-
TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING
-
ATTACK_TARGET_CONDITIONS
-
ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING
-
ATTACK_TARGET_CONDITIONS_IGNORE_LINE_OF_SIGHT
-
ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT
private static final TargetingConditions ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT -
scanRate
private final int scanRate -
timeToTick
private long timeToTick
-
-
Constructor Details
-
Sensor
public Sensor(int pScanRate) -
Sensor
public Sensor()
-
-
Method Details
-
tick
-
updateTargetingConditionRanges
-
doTick
-
requires
-
isEntityTargetable
public static boolean isEntityTargetable(ServerLevel pLevel, LivingEntity pEntity, LivingEntity pTarget) -
isEntityAttackable
public static boolean isEntityAttackable(ServerLevel pLevel, LivingEntity pEntity, LivingEntity pTarget) -
wasEntityAttackableLastNTicks
public static BiPredicate<ServerLevel,LivingEntity> wasEntityAttackableLastNTicks(LivingEntity pEntity, int pTicks) -
isEntityAttackableIgnoringLineOfSight
public static boolean isEntityAttackableIgnoringLineOfSight(ServerLevel pLevel, LivingEntity pEntity, LivingEntity pTarget) -
rememberPositives
-