<commit_before>package io.luna.game.model.mobile;

import io.luna.LunaContext;
import io.luna.game.model.Entity;
import io.luna.game.model.Position;
import io.luna.game.model.mobile.attr.AttributeMap;

import static com.google.common.base.Preconditions.checkArgument;

/**
 * Something that exists in the Runescape world and is able to move around.
 * 
 * @author lare96 <http://github.org/lare96>
 */
public abstract class MobileEntity extends Entity {

    /**
     * An {@link AttributeMap} instance assigned to this {@code MobileEntity}.
     */
    protected final AttributeMap attr = new AttributeMap();

    /**
     * The index of this mob in its list.
     */
    private int index = -1;

    /**
     * Creates a new {@link MobileEntity}.
     *
     * @param context The context to be managed in.
     * @param position The position of this {@code MobileEntity}.
     */
    public MobileEntity(LunaContext context, Position position) {
        super(context, position);
    }

    /**
     * Creates a new {@link MobileEntity} at the default position.
     *
     * @param context The context to be managed in.
     */
    public MobileEntity(LunaContext context) {
        super(context);
    }

    /**
     * @return The index of this {@link MobileEntity} in its list.
     */
    public int getIndex() {
        return index;
    }

    /**
     * Sets the value for {@link #index}, cannot be below {@code 1} unless the
     * value is {@code -1}.
     */
    public void setIndex(int index) {
        if (index != -1) {
            checkArgument(index >= 1, "index < 1");
        }
        this.index = index;
    }

    /**
     * @return The {@link AttributeMap} instance assigned to this {@code MobileEntity}.
     */
    public AttributeMap getAttr() {
        return attr;
    }
}<commit_msg>Update blocks within the MobileEntity class implemented.<commit_after>package io.luna.game.model.mobile;

import io.luna.LunaContext;
import io.luna.game.model.Direction;
import io.luna.game.model.Entity;
import io.luna.game.model.EntityType;
import io.luna.game.model.Position;
import io.luna.game.model.mobile.attr.AttributeMap;
import io.luna.game.model.mobile.update.UpdateFlagHolder;
import io.luna.game.model.mobile.update.UpdateFlagHolder.UpdateFlag;

import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;

/**
 * Something that exists in the Runescape world and is able to move around.
 *
 * @author lare96 <http://github.org/lare96>
 */
public abstract class MobileEntity extends Entity {

    /**
     * An {@link AttributeMap} instance assigned to this {@code MobileEntity}.
     */
    protected final AttributeMap attr = new AttributeMap();

    /**
     * An {@link UpdateFlagHolder} instance assigned to this {@code MobileEntity}.
     */
    protected final UpdateFlagHolder updateFlags = new UpdateFlagHolder();

    /**
     * The index of this mob in its list.
     */
    private int index = -1;

    /**
     * The walking direction of this {@code MobileEntity}.
     */
    private Direction walkingDirection = Direction.NONE;

    /**
     * If this {@code MobileEntity} is teleporting.
     */
    private boolean teleporting = true;

    /**
     * The {@link Animation} to perform this cycle.
     */
    private Animation animation;

    /**
     * The {@link Position} to face this cycle.
     */
    private Position facePosition;

    /**
     * The chat to forcibly display this cycle.
     */
    private String forceChat;

    /**
     * The {@link Graphic} to perform this cycle.
     */
    private Graphic graphic;

    /**
     * The {@code MobileEntity} to interact with this cycle.
     */
    private int interactionIndex = -1;

    /**
     * The primary {@link Hit} to display this cycle.
     */
    private Hit primaryHit;

    /**
     * The secondary {@link Hit} to perform this cycle.
     */
    private Hit secondaryHit;

    /**
     * Creates a new {@link MobileEntity}.
     *
     * @param context The context to be managed in.
     * @param position The position of this {@code MobileEntity}.
     */
    public MobileEntity(LunaContext context, Position position) {
        super(context, position);
    }

    /**
     * Creates a new {@link MobileEntity} at the default position.
     *
     * @param context The context to be managed in.
     */
    public MobileEntity(LunaContext context) {
        super(context);
    }

    /**
     * Clears flags specific to certain types of {@code MobileEntity}s.
     */
    public abstract void resetEntity();

    /**
     * Teleports this {@code MobileEntity} to {@code position}.
     *
     * @param position The {@link Position} to teleport to.
     */
    public final void teleport(Position position) {
        setPosition(position);
        teleporting = true;
        // TODO: Clear walking queue
    }

    /**
     * Perform {@code animation} on this cycle.
     *
     * @param animation The {@link Animation} to perform this cycle.
     */
    public final void animation(Animation animation) {
        if (this.animation == null || this.animation.getPriority().getValue() <= animation.getPriority().getValue()) {
            this.animation = requireNonNull(animation);
            updateFlags.flag(UpdateFlag.ANIMATION);
        }
    }

    /**
     * Face {@code facePosition} on this cycle.
     *
     * @param facePosition The {@link Position} to face this cycle.
     */
    public final void face(Position facePosition) {
        this.facePosition = requireNonNull(facePosition);
        updateFlags.flag(UpdateFlag.FACE_POSITION);
    }

    /**
     * Force the chat message {@code forceChat} on this cycle.
     *
     * @param forceChat The chat to forcibly display this cycle.
     */
    public final void forceChat(String forceChat) {
        this.forceChat = requireNonNull(forceChat);
        updateFlags.flag(UpdateFlag.FORCE_CHAT);
    }

    /**
     * Perform {@code graphic} on this cycle.
     *
     * @param graphic The {@link Graphic} to perform this cycle.
     */
    public final void graphic(Graphic graphic) {
        this.graphic = requireNonNull(graphic);
        updateFlags.flag(UpdateFlag.GRAPHIC);
    }

    /**
     * Interact with {@code entity} on this cycle.
     *
     * @param entity The {@code MobileEntity} to interact with this cycle.
     */
    public final void interact(MobileEntity entity) {
        this.interactionIndex =
            entity == null ? 65535 : entity.type() == EntityType.PLAYER ? entity.index + 32768 : entity.index;
        updateFlags.flag(UpdateFlag.INTERACTION);
    }

    /**
     * Display {@code primaryHit} on this cycle.
     *
     * @param primaryHit The primary {@link Hit} to display this cycle.
     */
    private final void primaryHit(Hit primaryHit) {
        this.primaryHit = requireNonNull(primaryHit);
        updateFlags.flag(UpdateFlag.PRIMARY_HIT);
    }

    /**
     * Display {@code secondaryHit} on this cycle.
     *
     * @param secondaryHit The secondary {@link Hit} to display this cycle.
     */
    private final void secondaryHit(Hit secondaryHit) {
        this.secondaryHit = requireNonNull(secondaryHit);
        updateFlags.flag(UpdateFlag.SECONDARY_HIT);
    }

    /**
     * @return The index of this {@link MobileEntity} in its list.
     */
    public final int getIndex() {
        return index;
    }

    /**
     * Sets the value for {@link #index}, cannot be below {@code 1} unless the value is {@code -1}.
     */
    public final void setIndex(int index) {
        if (index != -1) {
            checkArgument(index >= 1, "index < 1");
        }
        this.index = index;
    }

    /**
     * Clears all of the various flags for this cycle.
     */
    public final void clearFlags() {
        resetEntity();
        teleporting = false;
        animation = null;
        forceChat = null;
        facePosition = null;
        interactionIndex = -1;
        primaryHit = null;
        secondaryHit = null;
        updateFlags.clear();
    }

    /**
     * @return The {@link AttributeMap} instance assigned to this {@code MobileEntity}.
     */
    public final AttributeMap getAttr() {
        return attr;
    }

    /**
     * @return The {@link UpdateFlagHolder} instance assigned to this {@code MobileEntity}.
     */
    public final UpdateFlagHolder getUpdateFlags() {
        return updateFlags;
    }

    /**
     * @return The walking direction of this {@code MobileEntity}.
     */
    public final Direction getWalkingDirection() {
        return walkingDirection;
    }

    /**
     * Sets the value for {@link #walkingDirection}.
     */
    public final void setWalkingDirection(Direction walkingDirection) {
        this.walkingDirection = walkingDirection;
    }

    /**
     * @return {@code true} if this {@code MobileEntity} is teleporting, {@code false} otherwise.
     */
    public final boolean isTeleporting() {
        return teleporting;
    }

    /**
     * @return The {@link Animation} to perform this cycle.
     */
    public final Animation getAnimation() {
        return animation;
    }

    /**
     * @return The {@link Position} to face this cycle.
     */
    public final Position getFacePosition() {
        return facePosition;
    }

    /**
     * @return The chat to forcibly display this cycle.
     */
    public final String getForceChat() {
        return forceChat;
    }

    /**
     * @return The {@link Graphic} to perform this cycle..
     */
    public final Graphic getGraphic() {
        return graphic;
    }

    /**
     * @return The {@code MobileEntity} to interact with this cycle.
     */
    public final int getInteractionIndex() {
        return interactionIndex;
    }

    /**
     * @return The primary {@link Hit} to display this cycle.
     */
    public final Hit getPrimaryHit() {
        return primaryHit;
    }

    /**
     * @return The secondary {@link Hit} to display this cycle.
     */
    public final Hit getSecondaryHit() {
        return secondaryHit;
    }
}
{'fraction_non_alphanumeric': 0.10708254693553193, 'fraction_numerical': 0.0031787026919638424, 'mean_word_length': 2.3064039408866996, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2490587', 'n_tokens_mistral': 2795, 'n_tokens_neox': 2728, 'n_words': 885}