### Input Whole Numbers with 'int' Variable Source: https://axiomdocs.moulberry.com/print The 'int' variable creates a slider to input whole numbers into a script. It allows setting a default value, minimum, and maximum for the slider. This example demonstrates creating pink wool pillars with a height controlled by the 'Height' slider. ```lua __ --Creates pink wool pillars with a height which can be modified using the 'Height' slider $once$ height=$int(Height,5,1,10)$ --default value of 5, minimum value of 1 and maximum value of 10. for yo=1, height do setBlock(x,y+yo,z,blocks.pink_wool) end ``` -------------------------------- ### Check Block Solidity and Set Visual Representation Source: https://axiomdocs.moulberry.com/print The `isSolid` function determines if a block has a solid collision box, returning a boolean. This example uses `isSolid` to check the current block and then sets it to lime wool if solid, or red stained glass if not. ```lua currentBlock=getBlock(x,y,z) if isSolid(currentBlock) then setBlock(x,y,z,blocks.lime_wool) else setBlock(x,y,z,blocks.red_stained_glass) end ``` -------------------------------- ### Apply Block Properties to Blockstate IDs Source: https://axiomdocs.moulberry.com/print The `withBlockProperty` function allows modifying existing Blockstate IDs by adding specific properties and their values. This overcomes the limitation of the `blocks` object. The example replaces wheat with its fully aged variant by setting the 'age' property to 7. ```lua if getBlock(x,y,z)==blocks.wheat then agedWheat=withBlockProperty(blocks.wheat,'age=7') setBlock(x,y,z,agedWheat) end ``` -------------------------------- ### Placing Blocks with Offsets using setBlock (Lua) Source: https://axiomdocs.moulberry.com/tools/painting/scriptbrush Demonstrates the setBlock function in Lua for placing blocks with optional XYZ offsets. This allows for placing multiple blocks per target block process and setting conditions for placement. ```lua carpetFitForAKing=blocks.pink_carpet if getBlock(x,y-1,z)~=blocks.air and getBlock(x,y,z)==blocks.air then -- only allows blocks with an empty block above setBlock(x,y,z,carpetFitForAKing) -- changes the block at the target block position end ``` -------------------------------- ### Get Exact Blockstate ID at Coordinate Source: https://axiomdocs.moulberry.com/print Unlike `getBlock`, `getBlockState` returns the precise Blockstate ID, including all properties, for a given coordinate. The example checks if the current block state is fully aged wheat and replaces it with new wheat if it is. ```lua currentBlockState=getBlockState(x,y,z) --gets the exact blockstate ID for the target block agedWheat=withBlockProperty(blocks.wheat,'age=7') newWheat=withBlockProperty(blocks.wheat,'age=0') --defines fully aged wheat and new wheat if currentBlockState==agedWheat then --check if the target block is wheat with the age of 7 setBlock(x,y,z,newWheat) end ``` -------------------------------- ### Input Floating-Point Numbers with 'float' Variable Source: https://axiomdocs.moulberry.com/print Similar to 'int', the 'float' variable enables input of floating-point numbers via a slider. It supports default, minimum, and maximum values. This example uses the 'Threshold' slider to control the placement of white and black concrete based on simplex noise. ```lua __ --Allows for control over the threshold using the 'Threshold' slider threshold=$float(Threshold,0.5,0,1)$ if getSimplexNoise(x,y,z)>threshold then setBlock(x,y,z,blocks.white_concrete) else setBlock(x,y,z,blocks.black_concrete) end ``` -------------------------------- ### Get Block Property Value and Apply Waterlogging Source: https://axiomdocs.moulberry.com/print The `getBlockProperty` function retrieves the value of a specific property for a given Blockstate ID. This example checks if a block is waterloggable by examining the 'waterlogged' property. If not waterlogged, it applies the 'waterlogged=true' property using `withBlockProperty`. ```lua currentBlockState=getBlockState(x,y,z) if getBlockProperty(currentBlock,'waterlogged')=='false' then --Checks if the block isn't waterlogged. Only waterloggable blocks have this property waterloggedBlock=withBlockProperty(currentBlock,'waterlogged=true') --Gets the waterlogged variant of the current block setBlock(x,y,z,waterloggedBlock) end ``` -------------------------------- ### Getting Block Property Value with getBlockProperty (Lua) Source: https://axiomdocs.moulberry.com/tools/painting/scriptbrush Demonstrates using the getBlockProperty function in Lua to retrieve the value of a specific property for a given Blockstate ID, such as checking if a block is waterloggable. ```lua --Checks if the target block can be waterlogged, and waterlogs it if possible currentBlockState=getBlockState(x,y,z) if getBlockProperty(currentBlock,'waterlogged')=='false' then --Checks if the block isn't waterlogged. Only waterloggable blocks have this property waterloggedBlock=withBlockProperty(currentBlock,'waterlogged=true') --Gets the waterlogged variant of the current block setBlock(x,y,z,waterloggedBlock) end ``` -------------------------------- ### getSimplexNoise Source: https://axiomdocs.moulberry.com/print Generates 3D noise using the OpenSimplex algorithm, returning a float between 0 and 1 based on coordinates and a seed. ```APIDOC ## getSimplexNoise(x,y,z,`seed`) ### Description The 'getSimplexNoise' function is used to generate 3D noise using the OpenSimplex noise algorithm. The function will return a 'random' float between 1 and 0 depending on the four inputs. The seed value only accepts integer values. If the seed value is invalid, it will default to 0. If the seed value is left empty, the seed will be randomized. __ ### Function Signature `getSimplexNoise(x, y, z, seed)` ### Parameters #### Path Parameters - **x** (number) - Required - The X coordinate. - **y** (number) - Required - The Y coordinate. - **z** (number) - Required - The Z coordinate. - **seed** (integer) - Optional - The seed for the noise generation. Defaults to a random value if not provided or invalid. ### Request Example ```lua --Places black and white and black concrete using a noise threshold, making an equally distributed pattern. niceSeed=69 threshold=0.5 if getSimplexNoise(x,y,z,niceSeed)>threshold then setBlock(x,y,z,blocks.white_concrete) else setBlock(x,y,z,blocks.black_concrete) end ``` ### Response #### Success Response (200) - **noise_value** (float) - A float value between 0 and 1 representing the generated noise. ``` -------------------------------- ### Getting Exact Blockstate ID with getBlockState (Lua) Source: https://axiomdocs.moulberry.com/tools/painting/scriptbrush Shows how to use the getBlockState function in Lua to retrieve the precise Blockstate ID of a block at a given coordinate, including its properties, and then replacing it conditionally. ```lua --Replaces fully grown wheat with new wheat currentBlockState=getBlockState(x,y,z) --gets the exact blockstate ID for the target block agedWheat=withBlockProperty(blocks.wheat,'age=7') newWheat=withBlockProperty(blocks.wheat,'age=0') --defines fully aged wheat and new wheat if currentBlockState==agedWheat then --check if the target block is wheat with the age of 7 setBlock(x,y,z,newWheat) end ``` -------------------------------- ### Checking Block Solidity and Replacing with isSolid (Lua) Source: https://axiomdocs.moulberry.com/tools/painting/scriptbrush Shows how to use the isSolid function in Lua to determine if a block has a solid collision box and then replace it with different blocks based on the result. ```lua --Represents solid blocks with lime wool, everything else is represented with red glass currentBlock=getBlock(x,y,z) if isSolid(currentBlock) then setBlock(x,y,z,blocks.lime_wool) else setBlock(x,y,z,blocks.red_stained_glass) end ```