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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddThreat(net.minecraft.world.entity.LivingEntity attacker, int additionalThreat) Adds X threat to the given entityGet the current targetnet.minecraft.world.entity.LivingEntityOnly gets the currently targeted mobintgetThreatFor(net.minecraft.world.entity.LivingEntity attacker) Get the threat value for the given entityvoidSets the current target to be invalid until it does a threatening action againvoidReset current target threat to 0voidReset current target threat to 0voidReset all entries in the table
-
Constructor Details
-
ThreatTable
-
-
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 toadditionalThreat- 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
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
-