Bonemeal

  • 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 community!

    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.

Blobbyguy

Member
Feb 2, 2017
25
0
0
Bloblandia
Is there a way to bonemeal or simulate bonemeal in blocks around a player
e.g.
<code>
loop blocks in radius 5 of player:
Apply bonemeal to event-block
</code>
 
code_language.skript:
grow|create|generate) tree [of type %tree type%] %directions% %locations%

Example:
code_language.skript:
grow a tall redwood tree above the clicked block
 
code_language.skript:
grow|create|generate) tree [of type %tree type%] %directions% %locations%

Example:
code_language.skript:
grow a tall redwood tree above the clicked block
last i checked bonemeal doesnt make trees grow
 
Bonemeal is used for that too.
ya but i think he wants what happens if you just click bonemeal on grass
[doublepost=1499895580,1499895072][/doublepost]maybe he wants that too idk
 
By the way , maybe he want just that:
code_language.skript:
        loop all blocks in radius 5 of player:
            if loop-block is grass:
                if block above loop-block is air:
                    set block above loop-block to tall grass or red poppy
 
I need it for basically anything haha.
Like wheat, carrots etc mainly crops :emoji_slight_smile:
I was hoping there was an effect like "apply bonemeal to event-block" or something.
[doublepost=1500157288,1499935379][/doublepost]bump
 
I gotchu. This snippet is only for wheat but you can do it with all the crops. here you can see each stage of wheat is called crops:1, crops:2 and so on. I find that if you use the numeric ID in your skript first when it warns you to not use numeric ID's it will often give you the alias of the item you were trying to use the ID for.
code_language.skript:
on right click with bonemeal:
    loop blocks in radius 5 of player:
        if loop-block is crops:6:
            set loop-block to crops:7
        if loop-block is crops:5:
            set loop-block to crops:6
        if loop-block is crops:4:
            set loop-block to crops:5
        if loop-block is crops:3:
            set loop-block to crops:4
        if loop-block is crops:2:
            set loop-block to crops:3
        if loop-block is crops:1:
            set loop-block to crops:2
        if loop-block is crops:0:
            set loop-block to crops:1

Edit:: edited code, the number check has to go in descending order, elsewise it will make the crop mature all the way.
 
Last edited by a moderator:
sry, same code but make it as quicker. :emoji_grinning:

code_language.skript:
on right click with bonemeal:
    loop blocks in radius 5 of player:
        if loop-block is crops:
            set {_l::*} to "%loop-block%" split at ":"
            add 1 to {_l::2} parsed as number
            set loop-block to crops:%{_l::2}%
 
sry, same code but make it as quicker. :emoji_grinning:

code_language.skript:
on right click with bonemeal:
    loop blocks in radius 5 of player:
        if loop-block is crops:
            set {_l::*} to "%loop-block%" split at ":"
            add 1 to {_l::2} parsed as number
            set loop-block to crops:%{_l::2}%
This return erros though. I don't think you can split it at the colon:
http://puu.sh/wKABh/8c6cb3039a.png
 
nah you can split at anything. it just doesnt work if you dont set it to a variable first (atleast for me). ex:
code_language.skript:
set {_crop} to "%loop-block%"
set {_l::*} to {_crop} split at ":"
I still get errors but I'm sure there's a proper way to simplify it. I'm not so good at the simplifying. at least the long version works. small victories lol
 
sry, same code but make it as quicker. :emoji_grinning:

code_language.skript:
on right click with bonemeal:
    loop blocks in radius 5 of player:
        if loop-block is crops:
            set {_l::*} to "%loop-block%" split at ":"
            add 1 to {_l::2} parsed as number
            set loop-block to crops:%{_l::2}%
code_language.skript:
    loop blocks in radius 5 of player where [block input is crops]:
      set loop-block to "crops:%(check [data value of loop-block is 7] ? 7 : data value of loop-block + 1)%" parsed as an item
using skquery, and it can be done w/o the check i just cbf to figure out which operator to use
 
Last edited by a moderator:
code_language.skript:
    loop blocks in radius 5 of player where [block input is crops]:
      set loop-block to "crops:%(check [data value of loop-block is 7] ? 7 : data value of loop-block + 1)%" parsed as an item
using skquery, and it can be done w/o the check i just cbf to figure out which operator to use
or just:
code_language.skript:
loop blocks in radius 5 of player where [block input is crops]->[data value of block input isn't crops:7]:
    add 1 to data value of loop-block
 
  • Like
Reactions: Blobbyguy
I know it's an old thread, but I decided to have another go at this today. Here is working code on 1.8.8
code_language.skript:
on script load:
  import "org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack"
  import "net.minecraft.server.v1_8_R3.ItemDye"
  import "net.minecraft.server.v1_8_R3.BlockPosition"

function getNMSCopy(i: itemtype) :: object:
  return {CraftItemStack}.asNMSCopy(({_i}.getRandom()))

function getNMSWorld(world: world) :: object:
  return {_world}.getHandle()

function getNMSLoc(location: location) :: object:
  return new {BlockPosition}(x-loc of {_location}, y-loc of {_location} and z-loc of {_location})

function bonemeal(location: location):
  {ItemDye}.a(getNMSCopy(bonemeal), getNMSWorld(world of {_location}) and getNMSLoc({_location}));
 
I know it's an old thread, but I decided to have another go at this today. Here is working code on 1.8.8
code_language.skript:
on script load:
  import "org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack"
  import "net.minecraft.server.v1_8_R3.ItemDye"
  import "net.minecraft.server.v1_8_R3.BlockPosition"

function getNMSCopy(i: itemtype) :: object:
  return {CraftItemStack}.asNMSCopy(({_i}.getRandom()))

function getNMSWorld(world: world) :: object:
  return {_world}.getHandle()

function getNMSLoc(location: location) :: object:
  return new {BlockPosition}(x-loc of {_location}, y-loc of {_location} and z-loc of {_location})

function bonemeal(location: location):
  {ItemDye}.a(getNMSCopy(bonemeal), getNMSWorld(world of {_location}) and getNMSLoc({_location}));
You managed to make skript look like Java. That's ironic. Also pretty good.

Now while checking the thread I noticed something too and I'm intrigued, can you even add 1 to a crops item durability when it's already 7 (the max), or will it give an error?
 
You managed to make skript look like Java. That's ironic. Also pretty good.

Now while checking the thread I noticed something too and I'm intrigued, can you even add 1 to a crops item durability when it's already 7 (the max), or will it give an error?
It will print a stacktrace
 
  • Like
Reactions: xUndefined
Status
Not open for further replies.