Creates a new block mask.
The filters for the block mask.
Optional
type: "include" | "exclude" = "include"The type of the block mask.
A new block mask.
Private
#blocksThe filters in the block mask.
Private
#blockThe block IDs and filters types in the block mask.
Private
#hasWhether the block mask has any filters with block states.
The type of the block mask.
"include" will make it only select blocks included in the block mask
"exclude" will make it only select blocks that are not included in the block mask
The filters in the block mask.
The block IDs and filters types in the block mask.
Whether the block mask has any filters with block states.
Evaluates the block IDs and filters types in the block mask.
This method does the following things:
raw
, rawsb
, or rawns
getter to a BlockMaskFilter that does have the getters.Pushes new filters to the block mask.
The filters to push to the block mask.
The new amount of filters in the block mask.
Tests if a block matches the block mask.
The block to test.
Optional
mode: "include" | "exclude" = ...The mode to test in. If specified, this paramter will override the block mask's type property.
Whether the block matches the block mask.
Converts the block mask to a string.
It returns the same value as BlockMask.prototype.raw.
The raw string representation of the block mask.
Static
extractExtracts a block mask from a string.
The string to extract the block mask from.
Optional
extraIdParsingEnabled: boolean = trueWhether to enable extra ID parsing. If emabled, filters with block IDs of "none" or "any" will be removed.
Optional
modeOverride: "include" | "exclude"Override the mode of the block mask. If not provided, the mode will be determined based on the string.
The block mask extracted from the string.
Static
extractExtracts all block masks from a string.
The string to extract the block masks from.
Optional
extraIdParsingEnabled: boolean = trueWhether to enable extra ID parsing. If emabled, filters with block IDs of "none" or "any" will be removed.
Optional
modeOverride: "include" | "exclude"Override the mode of the block mask. If not provided, the mode will be determined based on the string.
The block masks extracted from the string.
Static
extractExtracts the raw strings of all block masks from a string.
The string to extract the block masks from.
The raw strings of the block masks extracted from the string, or null if no block masks were found.
Static
extractExtracts all block masks from a string and their raw strings.
The string to extract the block masks from.
Optional
extraIdParsingEnabled: boolean = trueWhether to enable extra ID parsing. If emabled, filters with block IDs of "none" or "any" will be removed. Only applies to the block masks, the raw strings are not affected.
Optional
modeOverride: "include" | "exclude"Override the mode of the block mask. If not provided, the mode will be determined based on the string. Only applies to the block masks, the raw strings are not affected.
An object containing the raw strings and the block masks extracted from the string.
Static
extractExtracts a raw block mask from a string.
The string to extract the raw block mask from.
The raw block mask, or null if no raw block mask was found.
Static
extractWRawExtracts a block mask and its raw string from a string.
The string to extract the block mask from.
Optional
extraIdParsingEnabled: boolean = trueWhether to enable extra ID parsing. If emabled, filters with block IDs of "none" or "any" will be removed. Only applies to the block mask, the raw string is not affected.
Optional
modeOverride: "include" | "exclude"Override the mode of the block mask. If not provided, the mode will be determined based on the string. Only applies to the block mask, the raw string is not affected.
The raw string and the block mask extracted from the string.
Static
parseStatic
testTests if the states in the first parameter extend the states in the second parameter.
The states to test.
The states to test against.
True if the states in the first parameter extend the states in the second parameter, false otherwise.
const BlockMask = modules.cmds.BlockMask;
const states = {
"foo": true,
"bar": false,
};
const statesMask = {
"foo": true,
"bar": true,
};
const result = BlockMask.testForStatesMatch(states, statesMask);
console.log(result); // false
A class that represents a block mask.
Block masks are used to filter blocks in a world.
Many things use them, such as the spawn protection system, and many WorldEdit commands.