Npc nin yakındaki ağacı bulup onu kırması

HqeS

Elmas Madencisi
Mesajlar
888
En iyi cevaplar
0
Beğeniler
134
Puanları
570
Ruh hali
NOT: Npc nin odun kırma özelliği yoktur. sadece görsel efekt. Geliştirip kendiniz sistemlere ekleyebilirsiniz.

Kod:
import:
    org.bukkit.Bukkit

option NMS:
    get:
        return Bukkit.getServer().getClass().getPackage().getName().split("\.")[3]

import:
    net.minecraft.server.{@NMS}.BlockPosition
    net.minecraft.server.{@NMS}.PacketPlayOutBlockBreakAnimation

effect packet block break animation with id %number% at %block% state %number% [for %-players%]:
    trigger:
        set {_world} to (world of expr-2).getHandle()
        set {_blockpos} to new BlockPosition(floor(x coord of expr-2), floor(y coord of expr-2) and floor(z coord of expr-2))
   
        set {_packet} to new PacketPlayOutBlockBreakAnimation(expr-1, {_blockpos} and expr-3)
   
        if exprs-4 is set:
            loop exprs-4:
                loop-value.getHandle().playerConnection.sendPacket({_packet})
        else:
            loop all players:
                loop-value.getHandle().playerConnection.sendPacket({_packet})
           
function makeEntityLookAt(entity: living entity, target: object):
    set {_direction} to (vector between {_target} and {_entity}) ** vector(-1, -1 and -1)
    set {_loc} to location of {_entity}
    {_loc}.setDirection({_direction})
    teleport {_entity} to {_loc}






command /oduncu:
    trigger:
        if {oduncu::%player%} is not set:
            create a npc with name "Lumberjack" type player at player
            set {oduncu::%player%} to the id of last created citizen
            set {_npc} to last created citizen
            set tool of {_npc} to iron axe
        else:
            destroy citizen from id {oduncu::%player%}
            delete {oduncu::%player%}
            delete {gui::%{oduncu::%player%}%::*}


command /kir:
    trigger:
        loop all blocks in radius 10 around player:
            loop-block is log
            make citizen from id {oduncu::%player%} move to location of loop-block
            set {_block} to false
            while loop-block is not air:
                loop all blocks in radius 5 around citizen from id {oduncu::%player%}:
                    loop-block-2 is log
                    if distance between citizen from id {oduncu::%player%} and loop-block-2 is greater than 6:
                        stop loop
                    if loop-value-2 is loop-value-1:
                        set {_block} to true
                if {_block} is true:
                    kirmaEfekt(citizen from id {oduncu::%player%},loop-block)
                    wait 3 seconds
                    stop this loop
                wait 1 ticks

       
function kirmaEfekt(citizen: citizen, target:block):
    set {_particle} to "%{_target}% break" parsed as visual effect
    if distance between {_citizen} and {_target} is greater than 6:
        make {_citizen} move to location of {_target}
        kirmaEfekt({_citizen}, {_target})
        stop
    else:
        while {_target} is log:
            makeEntityLookAt({_citizen}, {_target})
            make {_citizen} arm swing
            play sound "block.wood.hit" with volume 0.2 and pitch 0.2 at {_target}
            add 0.2 to {_index}
            loop 2 times:
                show {_particle} at {_target}
            packet block break animation with id 25 at {_target} state floor({_index})
            if {_index} is 10:
           
                set block at {_target} to air
                play sound "block.wood.break" with volume 1 and pitch 1 at {_target}
                loop 20 times:
                    show {_particle} at {_target}
                    show {_particle} at {_target}
                    show {_particle} at {_target}
                packet block break animation with id 25 at {_target} state 11
                chance of 50%:
                    show angry villager at {_citizen}'s head
            wait 1 ticks





Böyle kodları paylaştığımız sunucumuz var buyrun beklerim
 


Melihoper

mc.TurkLion.net
Mesajlar
395
En iyi cevaplar
4
Beğeniler
191
Puanları
490
Ruh hali
Cidden başarılı bir skript olmuş , ilk defa böyle bir şey gördüm verdim şukunu
 

Üst