gdpc.minecraft_tools

Provides various Minecraft-related utilities that do not require an Editor.


signData(frontLine1: str = '', frontLine2: str = '', frontLine3: str = '', frontLine4: str = '', frontColor: str = '', frontIsGlowing: bool = False, backLine1: str = '', backLine2: str = '', backLine3: str = '', backLine4: str = '', backColor: str = '', backIsGlowing: bool = False, isWaxed: bool = False) str

Returns an SNBT string with sign data.

See also: signBlock(), editor_tools.placeSign().

lecternData(bookData: str | None, page: int = 0) str

Returns an SNBT string with lectern data.

bookData should be an SNBT string defining a book. You can use bookData() to create such a string.

See also: lecternBlock(), editor_tools.placeLectern().

bookData(text: str, title: str = 'Chronicle', author: str = 'Anonymous', description: str = "I wonder what's inside?", desccolor: str = 'gold', descIsItalic: bool = True) str

Returns an SNBT string with written book data

The following special characters can be used to format the book:

  • \n: New line

  • \f: Form/page break

  • §0: Black text

  • §1: Dark blue text

  • §2: Dark green text

  • §3: Dark aqua text

  • §4: Dark red text

  • §5: Dark purple text

  • §6: Gold text

  • §7: Gray text

  • §8: Dark gray text

  • §9: Blue text

  • §a: Green text

  • §b: Aqua text

  • §c: Red text

  • §d: Light purple text

  • §e: Yellow text

  • §f: White text

  • §k: Obfuscated text

  • §l: Bold text

  • §m: ~~Strikethrough~~ text

  • §n: __Underline__ text

  • §o: Italic text

  • §r: Reset text formatting

  • \\\\s: When at start of page, print page as string directly

  • \\c: When at start of line, align text to center

  • \\r: When at start of line, align text to right side

NOTE: For supported special characters see https://minecraft.wiki/Language#Font

signBlock(wood: str = 'oak', wall: bool = False, facing: str = 'north', rotation: str | int = '0', frontLine1: str = '', frontLine2: str = '', frontLine3: str = '', frontLine4: str = '', frontColor: str = '', frontIsGlowing: bool = False, backLine1: str = '', backLine2: str = '', backLine3: str = '', backLine4: str = '', backColor: str = '', backIsGlowing: bool = False, isWaxed: bool = False) Block

Returns a sign Block with the specified properties.

If wall is True, facing is used. Otherwise, rotation is used. See also: signData(), editor_tools.placeSign().

lecternBlock(facing: str = 'north', bookData: str | None = None, page: int = 0) Block

Returns a lectern Block with the specified properties.

bookData should be an SNBT string defining a book. You can use bookData() to create such a string.

See also: lecternData(), editor_tools.placeLectern().

positionToInventoryIndex(position: Vec2iLike, inventorySize: Vec2iLike) int

Returns the flat index of the slot at position in an inventory of size inventorySize.

getObtrusiveness(block: Block) int

Deprecated

Deprecated along with lookup. See the warning at the top of the lookup page for the reasons and for alternatives.

Returns the percieved obtrusiveness of the given block.

Returns a numeric weight from 0 (invisible) to 4 (opaque).