Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Onion Generate Command (v2) | by MelonBP
- This command procedurally creates an onion shape in your selection. The size of the onion adapts to the dimensions of your selection, so you can change the height or radius of your onion by making the appropriate expansions or contractions to the selection region.
- ## The command
- //g [pattern] x^2+z^2<=4*(y+1)*e^-((1.5*(y+1))^2)
- It's a lot more simple now because the command uses generated coordinates instead of offset raw coordinates from the Minecraft world, so there's no need for all the annoying variables from the old command. Enjoy!
- --
- ### The nerd shit:
- Generated coordinates mean that each axis inside the selection ranges from -1 to 1. This is different from raw coordinates, where the range of the axes was the same as the actual dimensions of the selection. Since the generated coordinates that //g uses to calculate *always* range from -1 to 1, scaling the selected region (input space) also scales the output space accordingly.
- I came up with a function that looks like the cross section of an onion between the inputs of -1 and 1, and I'll refer to this function as the "onion function" (You can visualize the onion function via this link, if you would like: https://www.desmos.com/calculator/0uvshivoex). What the command does is it creates cylinders at every height in the selection with a radius equal to the "onion function" of that height's generated y-value. The equation for a vertically-oriented cylinder with Minecraft's coordinate axes is just x^2 + z^2 = r^2, where 'r' is the radius of the cylinder. So in the place of 'r', we have the "onion function" with the y-value as the input. A way to read what the command is doing in words would be: "place a block from the pattern if the radius from the center at that point is less than the "onion function" evaluation at that height". And thus, an onion is created.
Advertisement