1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Modify Plugin

Discussion in 'Plugin Help' started by Howtodoit, Aug 22, 2020.

  1. Howtodoit

    Howtodoit Spider Jockey

    Messages:
    35
    I want to modify the plugin so it can damage monsters other than players.
    ( api : [3.0.0-ALPHA7, 3.0.0-ALPHA8, 3.0.0-ALPHA9] ) ( MCPE 1.1.5 )

    PHP:

    function move ($player,$eid,$damage,$type,$value true)
        {
            
    //$typeは将来使うかもだから一応keep
            
    if (!isset($this->pos[$eid])) return false;
            
    $S $this->pos[$eid];
            
    $F $this->motion[$eid];
            if (
    $value$F->y-=0.05;
            
    $this->pos[$eid] = new Vector3($S->x+$F->x$S->y+$F->y$S->z+$F->z);
            for (
    $K 1$K 4$K++) {
                
    $G = new Vector3($S->x+$F->x/$K$S->y+$F->y/$K$S->z+$F->z/$K);
                if (
    $player->level->getBlock($G)->isSolid()) {
                    
    $this->close($eid);
                    break;
                    return 
    false;
                }
                foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                    
    $x $p->x;
                    
    $y $p->y;
                    
    $z $p->z;
                    
    $c = new Vector2($x$z);
                    if ((new 
    Vector2($S->x$S->z))->distance($c) <= 1.2 && $S->y-$p-><= 2.6 && $S->y-$p->0) {
                        if(
    $p->getName() != $player->getName()) {
                            
    $d $this->getFinalDamage($p$damage);
                            
    $ev = new EntityDamageByEntityEvent($player$pEntityDamageEvent::CAUSE_ENTITY_ATTACK$d);
                            
    $p->attack($d$ev);
                        }
                        return 
    $this->close($eid);
                    }
                }
            }
            
    $this->getScheduler()->scheduleDelayedTask(new Callback([$this,"move"],[$player,$eid,$damage]),1);
        }
     
  2. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    i didnt understand what do you want?!
    what is error?
    what do you need?
    what do you want to do?
     
  3. Howtodoit

    Howtodoit Spider Jockey

    Messages:
    35
  4. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
  5. Howtodoit

    Howtodoit Spider Jockey

    Messages:
    35
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.