Jump to content

I need help to improve the performance of my skript


TheFakeOri

Recommended Posts

my skript works well without problems but it makes the tps drop really fast to around 13 

can someone help me improve it? its pretty long i use skript and skbee

on load:
    register new shaped recipe for {Tridentofthesea} using diamond, diamond, diamond, air, heart of the sea, air, air and diamond with id "tridentofthesea"
    register new shaped recipe for {drillCore} using iron ingot, redstone block, iron ingot, redstone block, diamond, redstone block, iron ingot, redstone block and iron ingot with id "drillcore"
    register new shaped recipe for {smelter} using iron block, coal block, iron block, coal block, flint and steel, coal block, iron block, coal block and iron block with id "smelter"


#bedrock drill
on place of a redstone lamp:
    if name of player's tool is "&7&lBedrock drill core":
        set {_loc} to event-blocks's location
        set {drills::%player%::%{_loc}%} to event-blocks's location
        play sound "block.note_block.pling"

on break of a redstone lamp:
    if {drills::%player%::*} contains event-block's location:
        remove event-blocks's location from {drills::%player%::*}
        drop {drillCore}
        cancel drops
        play sound "block.anvil.land"

every 1 second in "world":
    loop all players:
        loop all blocks in radius 20 around loop-player:
            if {drills::%loop-player%::*} contains loop-block's location:
                loop all blocks in radius 1 around loop-block:
                    loop-block-2 is bedrock:
                        loop all blocks in radius 2 around loop-block-1:
                            loop-block-3 is a gold block:
                                add 1 to {_gold}
                                {_gold} > 4:
                                    chance of 5%:
                                        drop gold ore at loop-block-1
                                        remove 4 from {_gold}
                            loop-block-3 is a iron block:
                                add 1 to {_iron}
                                {_iron} > 4:
                                    chance of 5%:
                                        drop iron ore at loop-block-1
                                        remove 4 from {_iron}
                            loop-block-3 is a coal block:
                                add 1 to {_coal}
                                {_coal} > 4:
                                    chance of 5%:
                                        drop coal at loop-block-1
                                        remove 4 from {_coal}

#smelter
on place of a chiseled polished blackstone:
    if name of player's tool is "&7&lOre smelter":
        set {_loc} to event-blocks's location
        set {smelters::%player%::%{_loc}%} to event-blocks's location
        play sound "block.note_block.pling"

on break of a chiseled polished blackstone:
    if {smelters::%player%::*} contains event-block's location:
        remove event-blocks's location from {smelters::%player%::*}
        drop {smelter}
        cancel drops
        play sound "block.anvil.land"

every 1 tick:
    loop all players:
        if {smelters::%loop-player%::*} is set:
            loop all blocks in radius 20 around loop-player:
                if {smelters::%loop-player%::*} contains loop-block's location:
                    loop all blocks in radius 0.1 of location of (block above loop-block):
                        loop-block-2 is a chest or a hopper:
                            loop all items in loop-block-2's inventory:
                                loop-item is a iron ore:
                                    remove 1 iron ore from loop-block-2's inventory
                                    add 1 iron ingot to loop-block-2's inventory

                                loop-item is a gold ore:
                                    remove 1 gold ore from loop-block-2's inventory
                                    add 1 gold ingot to loop-block-2's inventory

Edited by TheFakeOri
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...