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

public abstract class Sensor<E extends LivingEntity> extends Object
  • Field Details

    • RANDOM

      private static final RandomSource RANDOM
    • DEFAULT_SCAN_RATE

      private static final int DEFAULT_SCAN_RATE
      See Also:
    • TARGETING_RANGE

      protected static final int TARGETING_RANGE
      See Also:
    • TARGET_CONDITIONS

      private static final TargetingConditions TARGET_CONDITIONS
    • TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING

      private static final TargetingConditions TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING
    • ATTACK_TARGET_CONDITIONS

      private static final TargetingConditions ATTACK_TARGET_CONDITIONS
    • ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING

      private static final TargetingConditions ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_TESTING
    • ATTACK_TARGET_CONDITIONS_IGNORE_LINE_OF_SIGHT

      private static final TargetingConditions 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

      public final void tick(ServerLevel pLevel, E pEntity)
    • doTick

      protected abstract void doTick(ServerLevel pLevel, E pEntity)
    • requires

      public abstract Set<MemoryModuleType<?>> requires()
    • isEntityTargetable

      public static boolean isEntityTargetable(LivingEntity pLivingEntity, LivingEntity pTarget)
      Returns:
      if the entity is remembered as a target and then tests the condition
    • isEntityAttackable

      public static boolean isEntityAttackable(LivingEntity pAttacker, LivingEntity pTarget)
      Returns:
      if entity is remembered as an attack target and is valid to attack
    • isEntityAttackableIgnoringLineOfSight

      public static boolean isEntityAttackableIgnoringLineOfSight(LivingEntity pAttacker, LivingEntity pTarget)