HyperScript
Docs

← All of the Docs The world

Noise

expressionnoise generator <kind>since 1.7.37

Makes a generator. The kind is "perlin" (soft hills), "simplex" (the same, rounder), "value" (blockier blobs), "cells" (0 at points scattered about and rising between them: cracked ground, islands), "ridged" (sharp lines: ridges, rivers) or "white" (every block on its own: static)

set {_cave} to noise generator "simplex" with seed 7
Try it
expressionnoise generator <kind> with seed <number>since 1.7.37

Which noise it is. The same seed gives the same numbers every time, on every server; without one each generator is different. A text works as a seed too

set {_cave} to noise generator "simplex" with seed 7
Try it
expressionnoise generator <kind> with scale <blocks>since 1.7.37

How many blocks one hill spans; 32 if nothing is said. Larger is smoother

set {flowers} to noise generator "cells" with seed "meadow" with scale 8
Try it
expressionnoise generator <kind> with octaves <n>since 1.7.37

How many layers are laid over each other, each finer than the last: 1 to 8, and 1 if nothing is said. More gives more detail

set {_blobs} to noise generator "value" with octaves 2
Try it
expressionnoise of <generator> at <location>since 1.7.37

The number there, between 0 and 1, as on a map: only x and z count, so it is the same at every height

set {_here} to noise of {flowers} at player's location
Try it
expressionnoise of <generator> at <x>, <z>since 1.7.37

The same for two numbers, and at <x>, <y>, <z> for three

set {_here} to noise of {flowers} at player's location
Try it
expressionsolid noise of <generator> at <location>since 1.7.37

The number at that exact spot, height included: for caves and anything else that is not a surface

if solid noise of {_cave} at player's location > 0.6:
    send "&7It feels hollow here."
Try it
Guide and examples

Noise is a number for every place that changes smoothly from one place to the next: the thing hills, caves, ore veins and patches of flowers are made of. A noise generator is a value like any other, kept in a variable and asked for a number wherever one is needed. That number is always between 0 and 1.

command /hills:
    permission: "hills.make"
    trigger:
        set {_hills} to noise generator "perlin" with seed 42 and scale 24 and octaves 3
        loop 16 times:
            set {_x} to x of player's location + loop-number
            loop 16 times:
                set {_z} to z of player's location + loop-number
                set {_height} to round(noise of {_hills} at {_x}, {_z} * 12)
                set block at {_x}, y of player's location + {_height}, {_z} to stone
        send "&aHills made."
SyntaxWhat it does
noise generator <kind>Makes a generator. The kind is "perlin" (soft hills), "simplex" (the same, rounder), "value" (blockier blobs), "cells" (0 at points scattered about and rising between them: cracked ground, islands), "ridged" (sharp lines: ridges, rivers) or "white" (every block on its own: static)
noise generator <kind> with seed <number>Which noise it is. The same seed gives the same numbers every time, on every server; without one each generator is different. A text works as a seed too
noise generator <kind> with scale <blocks>How many blocks one hill spans; 32 if nothing is said. Larger is smoother
noise generator <kind> with octaves <n>How many layers are laid over each other, each finer than the last: 1 to 8, and 1 if nothing is said. More gives more detail
noise of <generator> at <location>The number there, between 0 and 1, as on a map: only x and z count, so it is the same at every height
noise of <generator> at <x>, <z>The same for two numbers, and at <x>, <y>, <z> for three
solid noise of <generator> at <location>The number at that exact spot, height included: for caves and anything else that is not a surface
on player join:
    # The same generator every time, because it has a seed.
    set {flowers} to noise generator "cells" with seed "meadow" with scale 8
    set {_here} to noise of {flowers} at player's location
    if {_here} < 0.2:
        send "&dYou are standing in a flower patch."
    set {_cave} to noise generator "simplex" with seed 7
    if solid noise of {_cave} at player's location > 0.6:
        send "&7It feels hollow here."
    set {_static} to noise generator "white" with seed 1
    set {_ridge} to noise generator "ridged" with seed 3 with scale 64 with octaves 4
    set {_blobs} to noise generator "value" with octaves 2
    send "%noise of {_static} at 1, 2% %noise of {_ridge} at 1, 2, 3% %noise of {_blobs} at 5, 5%"
  • Several settings are joined with with or and: with seed 42 and scale 24 and octaves 3.
  • A generator can be kept in a saved variable such as {hills}; it is the recipe that is kept, not a table of numbers, so it costs nothing to store.
  • To turn the number into something else, multiply it: noise of {_n} at {_x}, {_z} * 20 is a height between 0 and 20, and if noise of ... > 0.7: picks out about the highest third.
  • Asking is fast, but a loop over a large area asks very often: keep areas to a few thousand blocks at a time, as with any loop that sets blocks.