Ir para conteúdo

Quebra de blocos personalizada


Posts Recomendados

Bem esse skript é bem cru e só pessoas que realmente entendem vão poder retirar proveito dele.

Consiste em um sistema de quebra de blocos personalizada, usando o addon skript-packet
não é difícil para que entende do assunto, então deixo aqui pois eu mesmo não achei
em lugar algum um skript assim.


Esse skript está em desenvolvimento 
 

Citar

on load:
    
    GetMulplier()

function GetMulplier():
    
    loop {Tools::*}:
        
        clear {Tools::%loop-index%}
        
    clear {Tools::*}
    
    loop {BlockHardness::*}:
        
        set {_TypeBlock} to "%loop-index%"
        
        clear {BlockClass::%{_TypeBlock}%}
        
        clear {BlockHardness::%{_TypeBlock}%}
        
        loop {Drops-%{_TypeBlock}%::*}:
            
            clear {Drops-%{_TypeBlock}%::%loop-value-2%::*}
            
        clear {Drops-%{_TypeBlock}%::*}
        
    set {Tools::golden pickaxe} to 12
    
    set {Tools::diamond pickaxe} to 8
    
    set {Tools::iron pickaxe} to 6
    
    set {Tools::stone pickaxe} to 4
    
    set {Tools::wooden pickaxe} to 2
    
    #==================[Concreto-Fragmento de asteroide]=========================
    
    set {BlockClass::white.concrete} to "normal"
    
    set {BlockHardness::white.concrete} to 25
    
    set {Drops-white.concrete} to (player head with nbt "{display:{Name:""Fancy Cube""},SkullOwner:{Id:""4aea76ae-5471-4785-afa4-dd8e1e02529f"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWQ0ZjRmZTMyMGJjYjFhNjhjNDliOTk1YjdhYjlkNzJiZjIyMzg4ZjliNTUxY2VmMjE5YTQyYjQxNjMzNGU5NSJ9fX0=""}]}}}") named "&bFragmento de asteroide"
    
    set {Drops-white.concrete::item} to ".1.4"
    
    #==================[Concreto-poeira asteroide]=========================
    
    set {BlockHardness::white.concrete.powder} to 2.7
    
    set {Drops-white.concrete.powder} to (sugar) named "&bPó de asteroide"
    
    set {Drops-white.concrete.powder::item} to ".3.6"
    
function packetSearch(s: string, player: player):
    loop all packettypes:
        set {_packettype} to lowercase "%loop-value%"
        {_packettype} contain {_s}
        send formatted "<suggest command:%{_packettype}%>%{_packettype}%" to {_player}
        
command /b <string>:
    permission: *
    trigger:
        
        packetSearch(arg-1, player)
        
on world change:
    
    if world is "Minas":
        
        apply potion of mining fatigue of tier -1 to player for 9999 days replacing existing effect
        
        send "&7Bem vindo ao mundo de mineração!%nl%&7Aqui você poderá minerar de um geito muito especial,%nl%&7digite &b/Ferramentas &7para obter mais ajuda."
        
    else:
        
        remove mining fatigue from player
        
on packet event play_client_block_dig:
    
    if player's world is "Minas":
        
        set {_loc::*} to "%field 0 of event-packet%" parsed as "BlockPosition{x=%number%, y=%number%, z=%number%}"
        
        set {_block} to block at location at {_loc::1}, {_loc::2}, {_loc::3} in world of player
        
        if "%{_block}%" contains "concrete", "lime stained glass" or "dark green stained glass":
            
            if {_block} is not bedrock:
                
                set {_type} to "%type of {_block}%" parsed as item type
                
                set {_TypeBlock} to "%{_type}%"
                
                replace all " " with "." in {_TypeBlock}
                
                if player's gamemode is survival:
                    
                    if "%field 2 of event-packet%" is "ABORT_DESTROY_BLOCK":
                        
                        clear player's metadata "SDB"
                        
                        set {_packet} to {_block}'s metadata "bb"
                        
                        set field 2 of {_packet} to -1
                        
                        send player packet {_packet} without calling event
                        
                    if "%field 2 of event-packet%" is "START_DESTROY_BLOCK":
                        
                        if verf((player's tool), {_block}) is true:
                            
                            set player's metadata "SDB" to {_block}
                            
                            set {_sec} to getDurability(player's tool, player, {_block})
                            
                            while player's metadata "SDB" is set:
                                
                                wait 1 tick
                                
                                set {_players::*} to all players in world "Minas" where [distance between {_block} and input < 5]
                                
                                if {_block}'s metadata "Destroy" is set:
                                    
                                    clear player's metadata "SDB"
                                    
                                    set {_packet} to {_block}'s metadata "bb"
                                    
                                    set field 2 of {_packet} to -1
                                    
                                    send {_players::*} packet {_packet} without calling event
                                    
                                    stop
                                    
                                if {_block} is not player's metadata "SDB":
                                    
                                    clear player's metadata "SDB"
                                    
                                    set {_packet} to {_block}'s metadata "bb"
                                    
                                    set field 2 of {_packet} to -1
                                    
                                    send {_players::*} packet {_packet} without calling event
                                    
                                    stop
                                    
                                if {_block}'s metadata "bb" is not set:
                                    
                                    set {_packet} to new Play_Server_Block_Break_Animation packet
                                    
                                    set field 0 of {_packet} to random integer between 0 and 999999
                                    
                                    set field 1 of {_packet} to nms from location of {_block}
                                    
                                    set {_block}'s metadata "bb" to {_packet}
                                    
                                set {_packet} to {_block}'s metadata "bb"
                                
                                add 1 to {_n}
                                
                                set {_time} to ({_sec})
                                
                                set {_stage} to {_time}/9
                                
                                set {_num} to ({_n}/{_stage})
                                
                                #send action bar "%{_time}% %({_num})% %{_time}%" to player
                                
                                set field 2 of {_packet} to {_num}
                                
                                send {_players::*} packet {_packet} without calling event
                                
                                #send action bar "&b%{_time}%" to player
                                
                                if {_n} >= {_time}:
                                    
                                    clear player's metadata "SDB"
                                    
                                    set {_s} to true
                                    
                                if player's metadata "SDB" is 0:
                                    
                                    clear player's metadata "SDB"
                                    
                                    set {_s} to true
                                    
                                if {_s} is true:
                                    
                                    if {Drops-%{_TypeBlock}%} is set:
                                        
                                        set {_i} to {Drops-%{_TypeBlock}%}
                                        
                                        set {_nofd::*} to "%{Drops-%{_TypeBlock}%::*}%" parsed as ".%number%.%number%"
                                        
                                        set {_drop} to random number between ({_nofd::1}) and ({_nofd::2}) of {_i}
                                        
                                    else:
                                        
                                        set {_drop} to 1 of {_type}
                                        
                                    drop {_drop} with nbt "{pick:%random integer between 0 and 99999%}" at block above {_block} without velocity
                                    
                                    add north, south, east, west, northwest, northeast, southwest and southeast to {_directions::*}
                                    
                                    set {_push} to a random element out of {_directions::*}
                                    
                                    push dropped item {_push} at speed 0.06
                                    
                                    push dropped item upwards at speed 0.08
                                    
                                    clear player's metadata "SDB"
                                    
                                    if "%{_type}%" contains "sand" or "concrete powder":
                                        
                                        set {_so} to "BLOCK_SAND_BREAK"
                                        
                                    if "%{_type}%" contains "glass":
                                        
                                        set {_so} to "BLOCK_GLASS_BREAK"
                                        
                                    else:
                                        
                                        if {_so} is not set:
                                            
                                            set {_so} to "BLOCK_STONE_BREAK"
                                            
                                    play sound {_so} with volume 1 and pitch 0.8 at {_block}
                                    
                                    set field 2 of {_packet} to -1
                                    
                                    send {_players::*} packet {_packet} without calling event
                                    
                                    set {_block}'s metadata "Destroy" to player
                                    
                                    Bs({_block})
                                    
                                    stop
                
                        else:
                            
                            send action bar "&cVocê precisa de uma ferramenta da classe &8%{BlockClass::%{_TypeBlock}%}%" to player
                            
function Bs(block: block):
    
    set {_type} to type of {_block}
    
    set block at {_block} to bedrock
    
    wait 5 seconds
    
    set block at {_block} to {_type}
    
    clear {_block}'s metadata "Destroy"

function verf(tool: item, block: block) :: boolean:
    
    set {_id} to "%{_block}'s type%"
    
    replace all " " with "." in {_id}
    
    if {BlockClass::%{_id}%} is set:
        
        if {BlockClass::%{_id}%} = tag "classe" of {_tool}'s nbt:
            
            return true
        
        else:
            
            return false
            
    else:
        
        return true
        
function getDurability(toolMultiplier: item, player: player, block: block) :: number:
    
    set {_id} to "%type of {_block}%"
    
    replace all " " with "." in {_id}
    
    set {_BlockHardness} to block hardness of {_block}
    
    if {BlockHardness::%{_id}%} is set:
        
        set {_BlockHardness} to {BlockHardness::%{_id}%}
        
    set {_list::*} to all of the possible drops from block at location of {_block} using {_toolMultiplier}
    
    if "%{_list::*}%" is not "<none>":
        
        set {_canHarvest} to true
    
    else:
        
        set {_canHarvest} to false
        
    if {_canHarvest} is true: #(isBestTool)
        
        if "%{Tools::%{_toolMultiplier}%}%" is not "<none>":
            
            set {_speedMultiplier} to {Tools::%{_toolMultiplier}%}
            
        else:
            
            set {_speedMultiplier} to 1
            
    else: #(not canHarvest)
        
        set {_speedMultiplier} to 1
        
    if enchantment level of efficiency of {_toolMultiplier} > 0: #(toolEfficiency)
        
        if {_canHarvest} is true:
            
            add (enchantment level of efficiency of {_toolMultiplier} ^ 2)+1 to {_speedMultiplier}
            
    if tier of potion effect haste of {_player} > 1: #(hasteEffect)
        
        set {_hasteLevel} to tier of potion effect haste of {_player}
        
        set {_speedMultiplier} to {_speedMultiplier}*(1+(0.2 * {_hasteLevel}))
        
    #----======= It is not possible because this effect is used when handling a block break ======-----
    #if (miningFatigue):
    #switch (miningFatigueLevel):
    #    case 0:
    #    speedMultiplier *= 0.3
    #    case 1:
    #    speedMultiplier *= 0.09
    #    case 2:
    #    speedMultiplier *= 0.0027
    #    default:
    #    speedMultiplier *= 0.00081
    
    if {_player} is in water:# (inWater and not hasAquaAffinity)
        
        set {_speedMultiplier} to {_speedMultiplier} / 5
        
    if ground state of {_player} is false: #(not onGround)
        
        set {_speedMultiplier} to {_speedMultiplier} / 5
    
    set {_damage} to {_speedMultiplier} / {_BlockHardness}
    
    if {_canHarvest} is true: #(canHarvest)
        
        set {_damage} to {_damage} / 30
        
    else if {_canHarvest} is false:
        
        set {_damage} to {_damage} / 100
        
    # Instant breaking
    if {_damage} > 1:
        
        return 0
        
        stop
        
    #ticks = roundup(1 / damage)
    
    #seconds = ticks / 20
    
    return (1/{_damage})
    
on pickup:
    
    if tag "pick" of event-item's nbt > 1:
        
        cancel event
        
        clear event-entity
        
        set {_n} to number of "%event-item%" parsed as number
        
        if "%{_n}%" = "<none>":
            
            set {_n} to 1
            
        set {_i} to event-item
        
        add "{pick:-1}" to {_i}'s nbt
        
        give {_n} of {_i} to player
        
        play sound "ENTITY_ITEM_PICKUP" with volume 0.1 and pitch 1 at player
        
on item spawn:
    
    if world of event-entity is "Minas":
        
        if tag "pick" of item's nbt is set:
            
            wait 10 seconds
            
            clear event-entity
            
command /Picks:
    trigger:
        
        send "ok"

on block place:
    
    if event-world is "Minas":
    
        if player's gamemode is not creative:
            
            cancel event

on block damage:
    
    if event-world is "Minas":
        
        if "%tier of potion effect mining Fatigue of player%" = "<none>":
            
            apply potion of mining fatigue of tier -1 to player for 9999 days replacing existing effect
            
        if player's gamemode is not creative:
            
            cancel event
            

 

Editado por ꧁RXZ꧂(ƸMaiconJHansenƷ)
Link para o comentário
Compartilhar em outros sites

ANÁLISE DE CONTEÚDO DESATUALIZADO

Este tópico foi automaticamente arquivado devido à falta de atualizações recentes ou ao fato de o conteúdo estar desatualizado em relação às práticas ou informações atuais. Para manter a qualidade e relevância das discussões na comunidade, tópicos sem novas atualizações ou com informações obsoletas são periodicamente arquivados.

Se houver novos dados ou atualizações pertinentes ao tema, sinta-se à vontade para criar um novo tópico com as informações atualizadas.

Equipe de Moderação
Gamer's Board
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...