<commit_before><?php

/*
 *
 *  ____            _        _   __  __ _                  __  __ ____  
 * |  _ \ ___   ___| | _____| |_|  \/  (_)_ __   ___      |  \/  |  _ \ 
 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
 * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ 
 * |_|   \___/ \___|_|\_\___|\__|_|  |_|_|_| |_|\___|     |_|  |_|_| 
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * @author PocketMine Team
 * @link http://www.pocketmine.net/
 * 
 *
*/

namespace plugin\MonsterEntity;

use pocketmine\entity\Explosive;
use pocketmine\event\entity\ExplosionPrimeEvent;
use pocketmine\level\Explosion;
use pocketmine\nbt\tag\String;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\Player;

class Creeper extends Monster implements Explosive{

    const NETWORK_ID = 33;

    public $width = 0.6;
    public $length = 0.6;
    public $height = 1.8;

	protected function initEntity(){
		$this->namedtag->id = new String("id", "Creeper");
	}

    public function getName(){
        return "크리퍼";
    }

    public function spawnTo(Player $player){
        $pk = new AddMobPacket();
        $pk->eid = $this->getID();
        $pk->type = self::NETWORK_ID;
        $pk->x = $this->x;
        $pk->y = $this->y;
        $pk->z = $this->z;
        $pk->yaw = $this->yaw;
        $pk->pitch = $this->pitch;
        $pk->metadata = $this->getData();
        $player->dataPacket($pk);

        parent::spawnTo($player);
    }

    public function explode(){
        $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 4));

        if(!$ev->isCancelled()){
            $explosion = new Explosion($this, $ev->getForce(), $this);
            if($ev->isBlockBreaking()){
                $explosion->explodeA();
            }
            $explosion->explodeB();
        }
    }

    public function onUpdate($currentTick){
        if ($this->closed === true) {
            return false;
        }

        $this->moveTime++;
        $this->attackDelay++;

        if ($this->knockBackCheck()) return true;
		
		$target = $this->getTarget();
		$x = $target->x - $this->x;
		$y = $target->y - $this->y;
		$z = $target->z - $this->z;
		$atn = atan2($z, $x);
		if ($this->onGround) {
			$this->move(cos($atn) * 0.12, 0, sin($atn) * 0.12);
		} else {
			$this->move(cos($atn) * 0.1, -0.241, sin($atn) * 0.1);
		}
		$this->setRotation(rad2deg($atn - M_PI_2), rad2deg(-atan2($y, sqrt(pow($x, 2) + pow($z, 2)))));
		if ($target instanceof Player) {
			if($this->distance($target) > 6.2){
				if($this->bombTime > 0) $this->bombTime -= min(2, $this->bombTime);
			}else{
				$this->bombTime++;
				if($this->bombTime >= 45){
					$this->explode();
					$this->close();
					$this->closed = true;
					return false;
				}
			}
		} else {
			if ($this->distance($target) <= 1) {
				$this->moveTime = 500;
			} elseif ($this->x === $this->lastX or $this->z === $this->lastZ) {
				$this->moveTime += 20;
			}
		}

        $this->entityBaseTick();
        $this->updateMovement();
        return true;
    }

}<commit_msg>Update Creeper.php<commit_after><?php

namespace plugin\MonsterEntity;

use pocketmine\entity\Explosive;
use pocketmine\event\entity\ExplosionPrimeEvent;
use pocketmine\level\Explosion;
use pocketmine\nbt\tag\String;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\Player;

class Creeper extends Monster implements Explosive{

    const NETWORK_ID = 33;

    public $width = 0.6;
    public $length = 0.6;
    public $height = 1.8;

    protected function initEntity(){
        $this->namedtag->id = new String("id", "Creeper");
    }

    public function getName(){
        return "크리퍼";
    }

    public function spawnTo(Player $player){
        $pk = new AddMobPacket();
        $pk->eid = $this->getID();
        $pk->type = self::NETWORK_ID;
        $pk->x = $this->x;
        $pk->y = $this->y;
        $pk->z = $this->z;
        $pk->yaw = $this->yaw;
        $pk->pitch = $this->pitch;
        $pk->metadata = $this->getData();
        $player->dataPacket($pk);

        parent::spawnTo($player);
    }

    public function explode(){
        $this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 4));

        if(!$ev->isCancelled()){
            $explosion = new Explosion($this, $ev->getForce(), $this);
            if($ev->isBlockBreaking()){
                $explosion->explodeA();
            }
            $explosion->explodeB();
        }
    }

    public function onUpdate($currentTick){
        if ($this->closed === true) {
            return false;
        }

        $this->attackDelay++;
        if($this->knockBackCheck()) return true;

        $this->moveTime++;
        $target = $this->getTarget();
        $x = $target->x - $this->x;
        $y = $target->y - $this->y;
        $z = $target->z - $this->z;
        $atn = atan2($z, $x);
        if ($this->onGround) {
            $this->move(cos($atn) * 0.12, 0, sin($atn) * 0.12);
        } else {
            $this->move(cos($atn) * 0.1, -0.28, sin($atn) * 0.1);
        }
        $this->setRotation(rad2deg($atn - M_PI_2), rad2deg(-atan2($y, sqrt(pow($x, 2) + pow($z, 2)))));
        if ($target instanceof Player) {
            if($this->distance($target) > 6.2){
                if($this->bombTime > 0) $this->bombTime -= min(2, $this->bombTime);
            }else{
                $this->bombTime++;
                if($this->bombTime >= 45){
                    $this->explode();
                    $this->close();
                    $this->closed = true;
                    return false;
                }
            }
        } else {
            if ($this->distance($target) <= 1) {
                $this->moveTime = 500;
            } elseif ($this->x === $this->lastX or $this->z === $this->lastZ) {
                $this->moveTime += 20;
            }
        }

        $this->entityBaseTick();
        $this->updateMovement();
        return true;
    }

}
{'fraction_non_alphanumeric': 0.1867246657000161, 'fraction_numerical': 0.013855324633478331, 'mean_word_length': 2.010669253152279, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 127, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6610945', 'n_tokens_mistral': 2304, 'n_tokens_neox': 2106, 'n_words': 393}