Class ThreatTable<T extends net.minecraft.world.entity.LivingEntity & IThreatTableEntity>

java.lang.Object
com.minecolonies.api.entity.ai.combat.threat.ThreatTable<T>

public class ThreatTable<T extends net.minecraft.world.entity.LivingEntity & IThreatTableEntity> extends Object
Threat table class, basically a list of entities with an associated threat value
  • Constructor Details

    • ThreatTable

      public ThreatTable(T owner)
  • Method Details

    • addThreat

      public void addThreat(net.minecraft.world.entity.LivingEntity attacker, int additionalThreat)
      Adds X threat to the given entity
      Parameters:
      attacker - entity to add the value to
      additionalThreat - threat value to add
    • getThreatFor

      public int getThreatFor(net.minecraft.world.entity.LivingEntity attacker)
      Get the threat value for the given entity
      Parameters:
      attacker - entity
      Returns:
      threat value
    • getTarget

      public ThreatTableEntry getTarget()
      Get the current target
      Returns:
      target or null
    • getTargetMob

      public net.minecraft.world.entity.LivingEntity getTargetMob()
      Only gets the currently targeted mob
      Returns:
    • resetCurrentTargetThreat

      public void resetCurrentTargetThreat()
      Reset current target threat to 0
    • markInvalidTarget

      public void markInvalidTarget()
      Sets the current target to be invalid until it does a threatening action again
    • removeCurrentTarget

      public void removeCurrentTarget()
      Reset current target threat to 0
    • resetTable

      public void resetTable()
      Reset all entries in the table