All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minestom.server.entity.ai.TargetSelector Maven / Gradle / Ivy

There is a newer version: 7320437640
Show newest version
package net.minestom.server.entity.ai;

import net.minestom.server.entity.Entity;
import net.minestom.server.entity.EntityCreature;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * The target selector is called each time the entity receives an "attack" instruction
 * without having a target.
 */
public abstract class TargetSelector {

    protected final EntityCreature entityCreature;

    public TargetSelector(@NotNull EntityCreature entityCreature) {
        this.entityCreature = entityCreature;
    }

    /**
     * Finds the target.
     * 

* Returning null means that this target selector didn't find any entity, * the next {@link TargetSelector} will be called until the end of the list or an entity is found. * * @return the target, null if not any */ @Nullable public abstract Entity findTarget(); /** * Gets the entity linked to this target selector. * * @return the entity */ @NotNull public EntityCreature getEntityCreature() { return entityCreature; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy