Solved How to set blocks from position 1 to position 2?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

pepper82

Member
Jan 26, 2017
272
1
18
41
I want to set all blocks within two locations to a specific block but only using Skript (no addons). Is it possible? If so, what is the correct syntax?
 
This is probably the easiest way to do it. This is a function utilizing MC's built-in fill command
code_language.skript:
function fill(l1: location, l2: location, b: itemtype, t: text):
    if {_t} = "destroy", "hollow", "keep", "outline" or "replace":
        set {_type} to {_t}
    else:
        set {_type} to "replace"
    set {_x1} to rounded x coord of {_l1}
    set {_y1} to rounded y coord of {_l1}
    set {_z1} to rounded z coord of {_l1}
    set {_x2} to rounded x coord of {_l2}
    set {_y2} to rounded y coord of {_l2}
    set {_z2} to rounded z coord of {_l2}

    execute console command "/fill %{_x1}% %{_y1}% %{_z1}% %{_x2}% %{_y2}% %{_z2}% %minecraft name of {_b}% %{_type}%"

# used like:
# these are obviously just examples
command /test:
    trigger:
        fill({loc1}, {loc2}, water, "replace")
        fill({loc1}, {loc2}, stone, "hollow")
 
  • Like
Reactions: pepper82
Thanks, looks nice, didn't know minecraft itself can do this. Will test it out.
 
It actually works @ShaneBee . Only downside of this is that every server admin receives a message like "[Server: 180 blocks set ... ]". Or is there a way to disable these messages?

Another problem is that you can not enter a world name, so it only works on the main world.
 
Last edited:
It actually works @ShaneBee . Only downside of this is that every server admin receives a message like "[Server: 180 blocks set ... ]". Or is there a way to disable these messages?
I'm guessing your admins are OPd? de-op them! No one on your server should be OP'd, just give them the correct permissions they need.
If they are not OPd then I'm not sure why they are receiving console messages. They shouldn't!

Another problem is that you can not enter a world name, so it only works on the main world.
Yes, that part sucks. I'm not entirely sure why MC did it that way.

This is the only way I know how to do it via Skript, especially with no addons.
 
Status
Not open for further replies.