<commit_before>/**
 * Mine Pet Script 1.1v
 * Team META #project 2
 *
 * @since 2016.8.1
 */
var GUI;

ModPE.setItem(500, "name_tag", 0, "Name Tag");
var myPet = null;

function makePet(entity) {
    this.entity = entity;
    this.name = "이름을 지어주세요!";
    Entity.setNameTag(this.entity, this.name);
    this.target = null;
    this.dmg = 5;
    this.speed = 50;
    this.mode = 0; //0 = walk, 1 = sit, 2 = ride
    this.uid = Entity.getUniqueId(entity);
    myPet = this;
}
makePet.prototype.setName = function (name) {
    this.name = name;
    Entity.setNameTag(this.entity, this.name);
};
makePet.prototype.setHealth = function (hp) {
    Entity.setHealth(this.entity, hp);
};
makePet.prototype.setTarget = function (entity) {
    this.target = entity;
};
makePet.prototype.move = function () {
    Entity.push(this.entity, 70 * this.speed / 100);
};

function attackHook(a, v) {
    if (Player.getCarriedItem() === 500) {
        makePet(v);
    }
}

function modTick() {
    if (myPet !== null) {
        if (myPet.mode === 0) {
            Entity.setImmobile(myPet.entity, false);
            if (myPet.target !== null) {
                Entity.grab(myPet.entity, myPet.target, myPet.speed);
            } else { //if target is setting
                Entity.grab(myPet.entity, myPet.target, myPet.speed); //following the target
                /** dmg the target **/
                if (Entity.getDst(myPet.target, myPet.entity) <= 2 && myPet.target!) {
                    // Syntax error but I can't understand what this line means.
                    Entity.grab(myPet.target, myPet.entity, myPet.speed);
                    Entity.dmg(myPet.target, -myPet.dmg);
                }
            }
        }
        if (myPet.mode === 1) {
            Entity.setSneaking(myPet.entity, true);
            Entity.setImmobile(myPet.entity, false);
        }
        if (myPet.mode === 2) {
            Entity.setImmobile(myPet.entity, true);
            GUI.openMoveButton();
        } else {
            GUI.deleteMoveButton();
        }
    }
}

var Bitmap = android.graphics.Bitmap,
    BitmapFactory = android.graphics.BitmapFactory,
    Color = android.graphics.Color,
    ColorDrawable = android.graphics.drawable.ColorDrawable,
    NinePatchDrawable = android.graphics.drawable.NinePatchDrawable,
    Gravity = android.view.Gravity,
    View = android.view.View,
    Button = android.widget.Button,
    LinearLayout = android.widget.LinearLayout,<commit_msg>Update MinePet.js<commit_after>/**
 * Mine Pet Script 1.1v
 * Team META #project 2
 *
 * @since 2016.8.1
 */
var GUI = {},
  itemImageLoader = {};
ModPE.setItem(500, "name_tag", 0, "Name Tag");
var myPet = null;

function makePet(entity) {
    this.entity = entity;
    this.name = "이름을 지어주세요!";
    Entity.setNameTag(this.entity, this.name);
    this.target = null;
    this.dmg = 5;
    this.speed = 50;
    this.mode = 0; //0 = walk, 1 = sit, 2 = ride
    this.uid = Entity.getUniqueId(entity);
    myPet = this;
}
makePet.prototype.setName = function (name) {
    this.name = name;
    Entity.setNameTag(this.entity, this.name);
};
makePet.prototype.setHealth = function (hp) {
    Entity.setHealth(this.entity, hp);
};
makePet.prototype.setTarget = function (entity) {
    this.target = entity;
};
makePet.prototype.move = function () {
    Entity.push(this.entity, 70 * this.speed / 100);
};

function attackHook(a, v) {
    if (Player.getCarriedItem() === 500) {
        makePet(v);
    }
}

function modTick() {
    if (myPet !== null) {
        if (myPet.mode === 0) {
            Entity.setImmobile(myPet.entity, false);
            if (myPet.target !== null) {
                Entity.grab(myPet.entity, myPet.target, myPet.speed);
            } else { //if target is setting
                Entity.grab(myPet.entity, myPet.target, myPet.speed); //following the target
                /** dmg the target **/
                if (Entity.getDst(myPet.target, myPet.entity) <= 2 && myPet.target !== null) {
                    // Syntax error but I can't understand what this line means.
                    Entity.grab(myPet.target, myPet.entity, myPet.speed);
                    Entity.dmg(myPet.target, -myPet.dmg);
                }
            }
        }
        if (myPet.mode === 1) {
            Entity.setSneaking(myPet.entity, true);
            Entity.setImmobile(myPet.entity, false);
        }
        if (myPet.mode === 2) {
            Entity.setImmobile(myPet.entity, true);
            GUI.openMoveButton();
        } else {
            GUI.deleteMoveButton();
        }
    }
}

var Bitmap = android.graphics.Bitmap,
    BitmapFactory = android.graphics.BitmapFactory,
    Color = android.graphics.Color,
    ColorDrawable = android.graphics.drawable.ColorDrawable,
    NinePatchDrawable = android.graphics.drawable.NinePatchDrawable,
    Gravity = android.view.Gravity,
    View = android.view.View,
    Button = android.widget.Button,
    LinearLayout = android.widget.LinearLayout,
{'fraction_non_alphanumeric': 0.13775100401606424, 'fraction_numerical': 0.01285140562248996, 'mean_word_length': 2.2239482200647247, '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': '3243880', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1591, 'n_words': 326}