🧠 core#
Shared state, definition classes, constants and helpers every plugin builds on.
constants#
- CATEGORY: str = 'manual_category'[source]#
Key for the category, used for recipes and the manual, ex: CATEGORY:”material” or CATEGORY:”equipment”.
- CUSTOM_BLOCK_VANILLA: str = 'minecraft:furnace'[source]#
Vanilla block used as base for custom blocks, must have the “facing” blockstate.
- CUSTOM_BLOCK_ALTERNATIVE: str = 'minecraft:item_frame'[source]#
Same purpose as previous, but useful for blocks that can be placed on walls or on player’s position (ex: flowers)
- CUSTOM_BLOCK_HEAD: str = 'minecraft:player_head'[source]#
Same purpose as previous, but useful for blocks does not have a custom model data.
- CUSTOM_ITEM_VANILLA: str = 'minecraft:recovery_compass'[source]#
Vanilla item used as base for custom items, must not have any survival vanilla behaviour.
- VANILLA_BLOCK: str = 'vanilla_block'[source]#
Key to a vanilla block that will be placed for custom block interaction, value needs to be a dict like {“id”:”minecraft:chest[type=single,waterlogged=false]”, “block_facing”: “player”} or a VanillaBlock instance.
- NO_SILK_TOUCH_DROP: str = 'no_silk_touch_drop'[source]#
Key to no-silk drop data for ores: item id string, deterministic dict-like data (
NoSilkTouchDrop), or a beetLootTable.
- OVERRIDE_MODEL: str = 'override_model'[source]#
Key to a dictionnary that will be used to override the whole model.
- SMITHED_CRAFTER_COMMAND: str = 'smithed_crafter_command'[source]#
Key to a command that will be used in a recipe in the Smithed Crafter library. If not present, the command will be defaulted to a loot table. Ex: {“result”:…,SMITHED_CRAFTER_COMMAND: “function your_namespace:calls/smithed_crafter/do_something_else”}.
- PAINTING_DATA: str = 'painting_data'[source]#
Key to a dict that contains the painting data, like {“author”:””,”title”:””,”width”:1,”height”:1} where author and title defaults to beet config values if not given.
- GROWING_SEED: str = 'growing_seed'[source]#
Key to a seed that has multiple growth stages, value needs to be a dict like {“texture_basename”:”wheat”,”stages”:8,”seconds”:600,”planted_on”:”stone”,”loots”:[{“id”:”minecraft:wheat_seeds”,”min_count”:1,”max_count”:3}]} where loots can be either this format or a loot table path “namespace:blocks/loot_table_name”.
- WIKI_COMPONENT: str = 'wiki_buttons'[source]#
Key to a text component that will be used to generate the wiki button in the manual.
- RESULT_OF_CRAFTING: str = 'result_of_crafting'[source]#
Key to a list of recipes to craft the item, ex: “adamantium”: {RESULT_OF_CRAFTING: […]}.
- USED_FOR_CRAFTING: str = 'used_for_crafting'[source]#
Should not be used unless you are crafting a vanilla item (ex: iyc.chainmail -> chainmail armor)
- COMMON_SIGNAL: str = 'custom_data={"common_signals":{"temp":true}}'[source]#
NBT to add to items to mark them as temporary for Common Signals library.
- COMMON_SIGNAL_HIDDEN: str = 'tooltip_display={"hide_tooltip":true},custom_data={"common_signals":{"temp":true}}'[source]#
Same as previous but also hide the tooltip (Useful for GUIs)
- FORCELOAD_BLOCK: tuple[int, int] = (-30000000, 1600)[source]#
Block x and z of the forceloaded chunk holding persistent utility entities, the same one Bookshelf and Furnace NBT Recipes use.
- FACES: tuple[str, ...] = ('down', 'up', 'north', 'south', 'west', 'east')[source]#
Faces of a block, used for resource pack and blocks orientation.
- SIDES: tuple[str, ...] = ('_bottom', '_top', '_front', '_back', '_left', '_right', '_side')[source]#
Sides of a block, used for resource pack.
- CUSTOM_BLOCK_HEAD_CUBE_RADIUS: tuple[int, int, int] = (16, 16, 16)[source]#
Size of the region to check around the player when placing a CUSTOM_BLOCK_HEAD.
- CUSTOM_BLOCKS_FOLDER: str = 'custom_blocks'[source]#
Folder holding every custom block function, e.g. “{ns}:custom_blocks/{id}/place_main”.
WARNING: plugins.finalyze.custom_blocks_ticking discovers ticking functions by matching this prefix against every function path. Changing it without updating that plugin silently breaks ticking.
- ITEMS_LOOT_FOLDER: str = 'i'[source]#
Folder holding the “give this item” loot tables, e.g. “{ns}:i/{id}”.
- SEEDS_FOLDER: str = 'seeds'[source]#
Folder holding growing seed loot tables and item models, e.g. “{ns}:seeds/{id}”.
- PLAYER_HEAD_FOLDER: str = 'custom_blocks/_player_head'[source]#
Folder holding the search functions of player head based custom blocks.
- EXTERNAL_RECIPES_FOLDER: str = 'recipes'[source]#
Folder holding the loot tables generated for external/vanilla ingredients, e.g. “{ns}:recipes/minecraft/stick”.
- class Conventions[source]#
Bases:
objectDefines conventions for tags used in datapacks.
- AVOID_NO_KILL: str = 'tag=!smithed.strict,tag=!global.ignore.kill'[source]#
Deprecated, use Conventions.NO_KILL_TAGS.avoid instead. String of tags to avoid when killing entities. Example of use: execute as @e[{Conventions.AVOID_NO_KILL}] run function your_namespace:kill_entity
- AVOID_ENTITY_TAGS: str = 'tag=!smithed.entity,tag=!global.ignore'[source]#
Deprecated, use Conventions.ENTITY_TAGS.avoid instead. String of tags to avoid when executing an entity command. Example of use: execute as @e[{Conventions.AVOID_ENTITY_TAGS}] run function your_namespace:kill_entity
- AVOID_BLOCK_TAGS: str = 'tag=!smithed.block,tag=!smithed.entity,tag=!global.ignore'[source]#
Deprecated, use Conventions.BLOCK_TAGS.avoid instead. String of tags to avoid when executing a block command. Example of use: execute as @e[{Conventions.AVOID_BLOCK_TAGS}] run function your_namespace:kill_entity
- AVOID_ENTITY_TAGS_NO_KILL: str = 'tag=!smithed.entity,tag=!global.ignore,tag=!smithed.strict,tag=!global.ignore.kill'[source]#
Deprecated, use Conventions.ENTITY_TAGS_NO_KILL.avoid instead. String of tags to avoid when executing an entity command. Example of use: execute as @e[{Conventions.AVOID_ENTITY_TAGS_NO_KILL}] run function your_namespace:kill_entity
- AVOID_BLOCK_TAGS_NO_KILL: str = 'tag=!smithed.block,tag=!smithed.entity,tag=!global.ignore,tag=!smithed.strict,tag=!global.ignore.kill'[source]#
Deprecated, use Conventions.BLOCK_TAGS_NO_KILL.avoid instead. String of tags to avoid when executing a block command. Example of use: execute as @e[{Conventions.AVOID_BLOCK_TAGS_NO_KILL}] run function your_namespace:kill_entity
placeholder_context#
- create_placeholder_context() Context[source]#
Build a lightweight stand-in Context so code touching Mem.ctx works out of a build (doctests, scripts).
Its packs are empty and every path points to a scratch directory that is never created: nothing on disk is read or written unless a real build replaces the context.
- Returns:
A placeholder context with project_id “your_namespace” and empty packs.
- Return type:
Context
>>> from stewbeet.core.placeholder_context import create_placeholder_context >>> ctx = create_placeholder_context() >>> ctx.project_id, ctx.project_name ('your_namespace', 'Your Namespace') >>> bool(ctx.data), bool(ctx.assets) # Both packs are empty (False, False)
- PLACEHOLDER_CTX: Context = Context(project_id='your_namespace', project_name='Your Namespace', project_description='', project_author='', project_version='0.0.0', project_root=False, minecraft_version='', directory=PosixPath('/tmp/stewbeet_placeholder_context'), output_directory=None, assets=ResourcePack(name=None, description='', pack_format=None, min_format=(97, 1), max_format=(97, 1)), data=DataPack(name=None, description='', pack_format=None, min_format=(121, 0), max_format=(121, 0)))[source]#
The placeholder context Mem.ctx defaults to. Compare with
Mem.ctx is PLACEHOLDER_CTXto detect “not in a build”.
source_paths#
Where a pack file came from, and what it was called before a refactor moved it.
beet drops a file’s source_path as soon as any plugin reads its text, and mecha names a compilation unit after that path.
A build running beet.contrib.find_replace over the whole pack, which is what versioning a datapack takes,
leaves every unit unable to say which file it was authored in. Noting the paths while beet still has them,
and giving them back once mecha has compiled, is what these do.
- remember_source_path(
- file: TextFileBase[Any],
Note where one file was loaded from, unless beet has forgotten or somebody got there first.
- restore_filenames(mc: Mecha, directory: str) None[source]#
Give every compilation unit back the
filenamebeet stopped mecha from recording.The database is keyed by the objects mecha parsed, which is the one handle a rename cannot move and a substitution cannot change, so a unit meets its file again whatever the build did to the pack in between. A unit mecha assembled in memory never had a file and keeps none.
- Parameters:
directory – beet’s project directory, which
filenameis relative to.
- origin_path(path: str) str[source]#
Resource location a function was first put in the pack under, before any refactor moved it.
A versioning plugin deletes each
ns:impl/**key and puts the very same object back underns:v1.2.3/**, and anything filing its work by resource location loses track of it there.