<commit_before>package com.marcel.gameoflife.ais;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.util.math.Vec3d;

/**
 * Created by marcel on 24.06.16.
 */
public class EntityAIRandomWalking extends EntityAIBase {
    private EntityLiving walker;
    private Vec3d randomPos;

    private int runRange = 20;
    private boolean debug;

    public EntityAIRandomWalking(EntityLiving walker){
        this.walker = walker;
        this.debug = false;
    }

    @Override
    public boolean shouldExecute() {
        if(!this.walker.getNavigator().noPath()){
            if(debug){
                System.out.println("No execution!");
            }

            return false;
        }
        else{
            return true;
        }
    }

    @Override
    public void startExecuting(){
        if(debug)
            System.out.println("START EXECUTION");
    }

    @Override
    public void updateTask(){
        Entity player = this.walker.worldObj.getClosestPlayerToEntity(this.walker, 10.0);

        if(player != null){
            if(this.walker.getDistanceToEntity(player) < 5.0){
//                debug = true;
            }
            else{
                debug = false;
            }
        }

        if(shouldExecute()){
            this.startWalking();
        }

    }

    public void startWalking(){
        Vec3d pos = walker.getPositionVector();
        int randx = walker.getRNG().nextInt() % 20;
        int randz = walker.getRNG().nextInt() % 20;

        int chose = walker.getRNG().nextInt() % 2;

        if(chose == 0){
            randx *= (-1);
            randz *= (-1);
        }

        this.randomPos = new Vec3d(pos.xCoord+randx, pos.yCoord, pos.zCoord+randz);

        boolean state = this.walker.getNavigator().tryMoveToXYZ(randomPos.xCoord, randomPos.yCoord, randomPos.zCoord,2.0);

        if(!state){<commit_msg>Improved sheep's walking-ranges<commit_after>package com.marcel.gameoflife.ais;

import com.marcel.gameoflife.config.ModConfig;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.util.math.Vec3d;

/**
 * Created by marcel on 24.06.16.
 */
public class EntityAIRandomWalking extends EntityAIBase {
    private EntityLiving walker;
    private Vec3d randomPos;

    private int runRange = 20;
    private boolean debug;

    public EntityAIRandomWalking(EntityLiving walker){
        this.walker = walker;
        this.debug = false;
    }

    @Override
    public boolean shouldExecute() {
        if(!this.walker.getNavigator().noPath()){
           /* if(debug){
                System.out.println("No execution!");
            }*/

            return false;
        }
        else{
            return true;
        }
    }

    @Override
    public void startExecuting(){
        /*if(debug)
            System.out.println("START EXECUTION");*/
    }

    @Override
    public void updateTask(){
        Entity player = this.walker.worldObj.getClosestPlayerToEntity(this.walker, 10.0);

        if(player != null){
            if(this.walker.getDistanceToEntity(player) < 5.0){
                debug = true;
            }
            else{
                debug = false;
            }
        }

        if(shouldExecute()){
            this.startWalking();
        }

    }

    public void startWalking(){
        Vec3d pos = walker.getPositionVector();

        int randx = walker.getRNG().nextInt((int) (ModConfig.ARENA_GRASS_END_POS.xCoord - ModConfig.ARENA_GRASS_START_POS.xCoord));
        randx += ModConfig.ARENA_GRASS_START_POS.xCoord;

        /*int randx = walker.getRNG().nextInt((int) (ModConfig.ARENA_GRASS_END_POS.xCoord - ModConfig.ARENA_GRASS_START_POS.xCoord + 1));
        randx += (int)(ModConfig.ARENA_GRASS_START_POS.xCoord);*/

        int randz = walker.getRNG().nextInt((int) (ModConfig.ARENA_GRASS_END_POS.zCoord -  ModConfig.ARENA_GRASS_START_POS.zCoord));
        randz += ModConfig.ARENA_GRASS_START_POS.zCoord;

        /*int chose = walker.getRNG().nextInt() % 2;

        if(chose == 0){
            randx *= (-1);
            randz *= (-1);
        }*/

        this.randomPos = new Vec3d(randx, pos.yCoord, randz);

        boolean state = this.walker.getNavigator().tryMoveToXYZ(randomPos.xCoord, randomPos.yCoord, randomPos.zCoord,2.0);

        if(!state){
{'fraction_non_alphanumeric': 0.11968503937007874, 'fraction_numerical': 0.011473565804274466, 'mean_word_length': 2.1689237348538843, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2370193', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1366, 'n_words': 245}