Placeholder for random block in area
A very powerful placeholder that allows you to get a random block in the specified area.
Meaning
Allows you to get a random block in the specified area, using the many different useful options and filters.
Format
%CEP_randomBlock_<world>_<minX>_<minY>_<minZ>_<maxX>_<maxY>_<maxZ>_<output1>_<output2>_<outputN>_(optional) <filters>_(optional) highest-|+<number>_(optional) blocks=<block1>,<block2>,<blockN>;block-data=<block_data1>|<block_data2>|<block_dataN>;coords=<location1>|<location2>|<locationN>%<world>_<minX>_<minY>_<minZ>_<maxX>_<maxY>_<maxZ> – the area to choose the block from; (MANDATORY)
<outputs> – may be type, x, y, z or world (you can combine them via "_", but at least one should exists); (MANDATORY)
<filters> – may be solid, fluid or !air (you can combine them via "_" too); (OPTIONAL)
highest-|+<number> – allows you to specify at what height you want to search for a block, starting from the highest block in the specified area, before the number comes the sign + or -, then the number itself, the highest blocks in the specified area can be many, and if starting from it, adding your number, there will be a suitable block, it will be selected; (OPTIONAL)
blocks=<block1>,<block2>,<blockN>;block-data=<block_data1>|<block_data2>|<block_dataN>;coords=<location1>|<location2>|<locationN> – the additional filters, their order and presence is not important, the main thing is to separate them by semicolons, you can use the “contains”, “startsWith”, “endsWith” and their !-versions in the "blocks" and "block-data", but not in the "coords"! You can use everywhere "!" before something to exclude it, and this is already available in "coords". If you choose not to specify “contains” and the like in "block-data", but a full expression with ! or not, you need to specify the full data format as minecraft:<block>[<data>=<value>]. You can use "~" to specify the coordinate ranges in the "coords", you can exclude coordinates from the current range or add coordinates outside the current range, and coordinates added in the current range will take precedence over those excluded in the current range. (OPTIONAL)
Use "ᵕ" symbol instead of underscores in <block-data> and <coords> additional filters!
Big but important information:
If no filters are specified, all blocks will be taken into account. If filters like blocks= are specified, and no regular filters, they should contain at least one positive value, otherwise no blocks will be taken into account. If regular filters are specified too, then positive blocks= and block-data= will be added to them, and negative ones will be excluded (this means that if you specify, for example, filter solid, and in blocks=, for example, STONE, nothing will change, because solid already contains this type of block, only, for example, specifying !STONE, that is, excluding it from the list, will matter, or, for example, if you specify fluid and add STONE to it, will matter too). That is, the MAIN RULE of filters is that every POSITIVE filter is ADDED to the total list of blocks in the range, not exclude everything else, and every NEGATIVE filter is EXCLUDED and takes into account other filters, for example: blocks=contains CAMPFIRE;block-data=contains lit=true - will take ALL campfires and ALL blocks with lit=true in the data (that is, torches too etc). If you want to take ONLY CAMPFIRES with lit=true, you should specify like: blocks=contains CAMPFIRE;block-data=!contains lit=false - this will take ALL blocks with lit=true in the data and select ONLY CAMPFIRES from them (this is not the only way of such selection, but it is one of the most reliable and easy to understand). Specifying the highest- will have the almost highest priority between all filters, and only coords= will be the highest, overriding all possible options, adding or excluding coordinates from the list.
Where is useful
Can be useful in creating some mini-games with random blocks choosing and in many other cases.
Examples
%CEP_randomBlock_{player_world}_{math_0:DOWN_{player_x}-5}_{math_0:DOWN_{player_y}-5}_{math_0:DOWN_{player_z}-5}_{math_0:DOWN_{player_x}+5}_{math_0:DOWN_{player_y}+5}_{math_0:DOWN_{player_z}+5}_type_x_y_z_!air_solid_fluid_highest-3_blocks=!DIRT,!ANDESITE% # Output the type and coordinates of a random block within 5 blocks radius of the current player, excluding air, including solid and liquid blocks, at a height of -3 blocks from some highest block, excluding dirt and andesite, that is, it can be, for example, stone, water, lava etc%CEP_randomBlock_{player_world}_{math_0:DOWN_{player_x}-5}_{math_0:DOWN_{player_y}-5}_{math_0:DOWN_{player_z}-5}_{math_0:DOWN_{player_x}+5}_{math_0:DOWN_{player_y}+5}_{math_0:DOWN_{player_z}+5}_type_x_y_z_blocks=endsWith WOOL,!startsWith L;block-data=contains lit=true;coords=coords=!world,53,23,424~47,19,418|world,52,22,422|testᵕworld,10,52,1152% # Output the type and coordinates of a random block within 5 blocks radius of the current player, including only wool which is not starting with "L" letter, also including any blocks with data "lit=true", excluding the specified range of coordinates from the current search, including one block back from that range and including one block from world test_world (that is, significantly another location), that is, it can be, for example green wool, orange wool, campfires, torches and some different blocks by coordinates