🧱 definitions_helper#
Helpers filling item definitions: missing components, equipments, materials, records, ores and SimplEnergy items.
completion#
- add_item_model_component(
- black_list: list[str] | None = None,
Add an item model component to all items in the definitions.
- Parameters:
black_list – The list of items to ignore.
ignore_paintings – Whether to ignore items that are paintings (have PAINTING_DATA).
- add_item_name_and_lore_if_missing(
- is_external: bool = False,
- black_list: list[str] | None = None,
Add item name and lore to all items in the definitions if they are missing.
- Parameters:
is_external – Whether the definitions is the external one or not (meaning the namespace is in the item name).
black_list – The list of items to ignore.
- add_private_custom_data_for_namespace(
- is_external: bool = False,
- black_list: list[str] | None = None,
Add private custom data for namespace to all items in the definitions if they are missing.
- Parameters:
is_external – Whether the definitions is the external one or not (meaning the namespace is in the item name).
black_list – The list of items to ignore.
- add_smithed_ignore_vanilla_behaviours_convention() None[source]#
Add smithed convention to all items in the definitions if they are missing.
Refer to https://wiki.smithed.dev/conventions/tag-specification/#custom-items for more information.
- resolve_use_remainders() None[source]#
Give each item with a
remaindertheuse_remaindercomponent holding that container, with its components at this point.The plugins reading final components call it first, once the definitions gave the container its name, model and custom data.
- set_manual_components(white_list: list[str]) None[source]#
Override the components to include in the manual when hovering items.
- Parameters:
white_list – The list of components to include.
- export_all_definitions_to_json(
- file_name: str,
- is_external: bool | JsonDict = False,
- verbose: bool = True,
Export all definitions to a single json file for debugging purposes.
- Parameters:
file_name – The name of the file to export to.
is_external – Whether to export external definitions or not. If a JsonDict is provided, it is the source of definitions instead of Mem.definitions or Mem.external_definitions.
verbose – Whether to print a debug message or not.
equipments#
- UNIQUE_SLOTS_VALUES: list[str] = ['head', 'chest', 'legs', 'feet', 'mainhand'][source]#
Slot values without duplicates, in declaration order.
- class VanillaEquipments(*values)[source]#
Bases:
EnumDefault vanilla equipments values (durability, armor, armor_toughness, knockback_resistance, attack_damage, attack_speed)
- HELMET = {DefaultOre.CHAINMAIL: {'armor': 2, 'durability': 165}, DefaultOre.COPPER: {'armor': 2, 'durability': 121}, DefaultOre.DIAMOND: {'armor': 3, 'armor_toughness': 2, 'durability': 363}, DefaultOre.GOLD: {'armor': 2, 'durability': 77}, DefaultOre.IRON: {'armor': 2, 'durability': 165}, DefaultOre.LEATHER: {'armor': 1, 'durability': 55}, DefaultOre.NETHERITE: {'armor': 3, 'armor_toughness': 3, 'durability': 407, 'knockback_resistance': 0.1}}[source]#
- CHESTPLATE = {DefaultOre.CHAINMAIL: {'armor': 5, 'durability': 240}, DefaultOre.COPPER: {'armor': 4, 'durability': 176}, DefaultOre.DIAMOND: {'armor': 8, 'armor_toughness': 2, 'durability': 528}, DefaultOre.GOLD: {'armor': 5, 'durability': 112}, DefaultOre.IRON: {'armor': 6, 'durability': 240}, DefaultOre.LEATHER: {'armor': 3, 'durability': 80}, DefaultOre.NETHERITE: {'armor': 8, 'armor_toughness': 3, 'durability': 592, 'knockback_resistance': 0.1}}[source]#
- LEGGINGS = {DefaultOre.CHAINMAIL: {'armor': 4, 'durability': 225}, DefaultOre.COPPER: {'armor': 3, 'durability': 165}, DefaultOre.DIAMOND: {'armor': 6, 'armor_toughness': 2, 'durability': 495}, DefaultOre.GOLD: {'armor': 3, 'durability': 105}, DefaultOre.IRON: {'armor': 5, 'durability': 225}, DefaultOre.LEATHER: {'armor': 2, 'durability': 75}, DefaultOre.NETHERITE: {'armor': 6, 'armor_toughness': 3, 'durability': 555, 'knockback_resistance': 0.1}}[source]#
- BOOTS = {DefaultOre.CHAINMAIL: {'armor': 1, 'durability': 195}, DefaultOre.COPPER: {'armor': 1, 'durability': 143}, DefaultOre.DIAMOND: {'armor': 3, 'armor_toughness': 2, 'durability': 429}, DefaultOre.GOLD: {'armor': 1, 'durability': 95}, DefaultOre.IRON: {'armor': 2, 'durability': 195}, DefaultOre.LEATHER: {'armor': 1, 'durability': 65}, DefaultOre.NETHERITE: {'armor': 3, 'armor_toughness': 3, 'durability': 481, 'knockback_resistance': 0.1}}[source]#
- SWORD = {DefaultOre.CHAINMAIL: {'attack_damage': 5, 'attack_speed': -2.4, 'durability': 131}, DefaultOre.COPPER: {'attack_damage': 5, 'attack_speed': -2.4, 'durability': 190}, DefaultOre.DIAMOND: {'attack_damage': 7, 'attack_speed': -2.4, 'durability': 1561}, DefaultOre.GOLD: {'attack_damage': 4, 'attack_speed': -2.4, 'durability': 32}, DefaultOre.IRON: {'attack_damage': 6, 'attack_speed': -2.4, 'durability': 250}, DefaultOre.LEATHER: {'attack_damage': 4, 'attack_speed': -2.4, 'durability': 59}, DefaultOre.NETHERITE: {'attack_damage': 8, 'attack_speed': -2.4, 'durability': 2031}}[source]#
- PICKAXE = {DefaultOre.CHAINMAIL: {'attack_damage': 3, 'attack_speed': -2.8, 'durability': 131}, DefaultOre.COPPER: {'attack_damage': 3, 'attack_speed': -2.8, 'durability': 190}, DefaultOre.DIAMOND: {'attack_damage': 5, 'attack_speed': -2.8, 'durability': 1561}, DefaultOre.GOLD: {'attack_damage': 2, 'attack_speed': -2.8, 'durability': 32}, DefaultOre.IRON: {'attack_damage': 4, 'attack_speed': -2.8, 'durability': 250}, DefaultOre.LEATHER: {'attack_damage': 2, 'attack_speed': -2.8, 'durability': 59}, DefaultOre.NETHERITE: {'attack_damage': 6, 'attack_speed': -2.8, 'durability': 2031}}[source]#
- AXE = {DefaultOre.CHAINMAIL: {'attack_damage': 9, 'attack_speed': -3.2, 'durability': 131}, DefaultOre.COPPER: {'attack_damage': 9, 'attack_speed': -3.2, 'durability': 190}, DefaultOre.DIAMOND: {'attack_damage': 9, 'attack_speed': -3.0, 'durability': 1561}, DefaultOre.GOLD: {'attack_damage': 7, 'attack_speed': -3.0, 'durability': 32}, DefaultOre.IRON: {'attack_damage': 9, 'attack_speed': -3.1, 'durability': 250}, DefaultOre.LEATHER: {'attack_damage': 7, 'attack_speed': -3.2, 'durability': 59}, DefaultOre.NETHERITE: {'attack_damage': 10, 'attack_speed': -3.0, 'durability': 2031}}[source]#
- SHOVEL = {DefaultOre.CHAINMAIL: {'attack_damage': 3.5, 'attack_speed': -3.0, 'durability': 131}, DefaultOre.COPPER: {'attack_damage': 3.5, 'attack_speed': -3.0, 'durability': 190}, DefaultOre.DIAMOND: {'attack_damage': 5.5, 'attack_speed': -3.0, 'durability': 1561}, DefaultOre.GOLD: {'attack_damage': 2.5, 'attack_speed': -3.0, 'durability': 32}, DefaultOre.IRON: {'attack_damage': 4.5, 'attack_speed': -3.0, 'durability': 250}, DefaultOre.LEATHER: {'attack_damage': 2.5, 'attack_speed': -3.0, 'durability': 59}, DefaultOre.NETHERITE: {'attack_damage': 6.5, 'attack_speed': -3.0, 'durability': 2031}}[source]#
- HOE = {DefaultOre.CHAINMAIL: {'attack_damage': 1, 'attack_speed': -2.0, 'durability': 131}, DefaultOre.COPPER: {'attack_damage': 1, 'attack_speed': -2.0, 'durability': 190}, DefaultOre.DIAMOND: {'attack_damage': 1, 'attack_speed': 0.0, 'durability': 1561}, DefaultOre.GOLD: {'attack_damage': 1, 'attack_speed': -3.0, 'durability': 32}, DefaultOre.IRON: {'attack_damage': 1, 'attack_speed': -1.0, 'durability': 250}, DefaultOre.LEATHER: {'attack_damage': 1, 'attack_speed': -3.0, 'durability': 59}, DefaultOre.NETHERITE: {'attack_damage': 1, 'attack_speed': 0.0, 'durability': 2031}}[source]#
- SPEAR = {DefaultOre.CHAINMAIL: {'attack_damage': 2, 'attack_speed': -2.666, 'durability': 131}, DefaultOre.COPPER: {'attack_damage': 2, 'attack_speed': -2.824, 'durability': 190}, DefaultOre.DIAMOND: {'attack_damage': 4, 'attack_speed': -3.048, 'durability': 1561}, DefaultOre.GOLD: {'attack_damage': 1, 'attack_speed': -2.947, 'durability': 32}, DefaultOre.IRON: {'attack_damage': 3, 'attack_speed': -2.947, 'durability': 250}, DefaultOre.LEATHER: {'attack_damage': 1, 'attack_speed': -2.462, 'durability': 59}, DefaultOre.NETHERITE: {'attack_damage': 5, 'attack_speed': -3.13, 'durability': 2031}}[source]#
materials#
- class Gear(
- name: str,
- shape: tuple[str, ...],
- vanilla: VanillaEquipments,
Bases:
objectAn armor piece or a tool: its crafting shape, and the vanilla equipment its stats scale from.
- vanilla: VanillaEquipments[source]#
- ARMOR: tuple[Gear, ...] = (Gear(name='helmet', shape=('XXX', 'X X'), vanilla=<VanillaEquipments.HELMET: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 55, 'armor': 1}, <DefaultOre.COPPER: 'copper'>: {'durability': 121, 'armor': 2}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 165, 'armor': 2}, <DefaultOre.IRON: 'iron'>: {'durability': 165, 'armor': 2}, <DefaultOre.GOLD: 'golden'>: {'durability': 77, 'armor': 2}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 363, 'armor': 3, 'armor_toughness': 2}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 407, 'armor': 3, 'armor_toughness': 3, 'knockback_resistance': 0.1}}>), Gear(name='chestplate', shape=('X X', 'XXX', 'XXX'), vanilla=<VanillaEquipments.CHESTPLATE: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 80, 'armor': 3}, <DefaultOre.COPPER: 'copper'>: {'durability': 176, 'armor': 4}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 240, 'armor': 5}, <DefaultOre.IRON: 'iron'>: {'durability': 240, 'armor': 6}, <DefaultOre.GOLD: 'golden'>: {'durability': 112, 'armor': 5}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 528, 'armor': 8, 'armor_toughness': 2}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 592, 'armor': 8, 'armor_toughness': 3, 'knockback_resistance': 0.1}}>), Gear(name='leggings', shape=('XXX', 'X X', 'X X'), vanilla=<VanillaEquipments.LEGGINGS: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 75, 'armor': 2}, <DefaultOre.COPPER: 'copper'>: {'durability': 165, 'armor': 3}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 225, 'armor': 4}, <DefaultOre.IRON: 'iron'>: {'durability': 225, 'armor': 5}, <DefaultOre.GOLD: 'golden'>: {'durability': 105, 'armor': 3}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 495, 'armor': 6, 'armor_toughness': 2}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 555, 'armor': 6, 'armor_toughness': 3, 'knockback_resistance': 0.1}}>), Gear(name='boots', shape=('X X', 'X X'), vanilla=<VanillaEquipments.BOOTS: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 65, 'armor': 1}, <DefaultOre.COPPER: 'copper'>: {'durability': 143, 'armor': 1}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 195, 'armor': 1}, <DefaultOre.IRON: 'iron'>: {'durability': 195, 'armor': 2}, <DefaultOre.GOLD: 'golden'>: {'durability': 95, 'armor': 1}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 429, 'armor': 3, 'armor_toughness': 2}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 481, 'armor': 3, 'armor_toughness': 3, 'knockback_resistance': 0.1}}>))[source]#
Armor pieces,
Xbeing the material.
- TOOLS: tuple[Gear, ...] = (Gear(name='sword', shape=('X', 'X', 'S'), vanilla=<VanillaEquipments.SWORD: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 59, 'attack_damage': 4, 'attack_speed': -2.4}, <DefaultOre.COPPER: 'copper'>: {'durability': 190, 'attack_damage': 5, 'attack_speed': -2.4}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 131, 'attack_damage': 5, 'attack_speed': -2.4}, <DefaultOre.IRON: 'iron'>: {'durability': 250, 'attack_damage': 6, 'attack_speed': -2.4}, <DefaultOre.GOLD: 'golden'>: {'durability': 32, 'attack_damage': 4, 'attack_speed': -2.4}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 1561, 'attack_damage': 7, 'attack_speed': -2.4}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 2031, 'attack_damage': 8, 'attack_speed': -2.4}}>), Gear(name='pickaxe', shape=('XXX', ' S ', ' S '), vanilla=<VanillaEquipments.PICKAXE: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 59, 'attack_damage': 2, 'attack_speed': -2.8}, <DefaultOre.COPPER: 'copper'>: {'durability': 190, 'attack_damage': 3, 'attack_speed': -2.8}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 131, 'attack_damage': 3, 'attack_speed': -2.8}, <DefaultOre.IRON: 'iron'>: {'durability': 250, 'attack_damage': 4, 'attack_speed': -2.8}, <DefaultOre.GOLD: 'golden'>: {'durability': 32, 'attack_damage': 2, 'attack_speed': -2.8}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 1561, 'attack_damage': 5, 'attack_speed': -2.8}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 2031, 'attack_damage': 6, 'attack_speed': -2.8}}>), Gear(name='axe', shape=('XX', 'XS', ' S'), vanilla=<VanillaEquipments.AXE: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 59, 'attack_damage': 7, 'attack_speed': -3.2}, <DefaultOre.COPPER: 'copper'>: {'durability': 190, 'attack_damage': 9, 'attack_speed': -3.2}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 131, 'attack_damage': 9, 'attack_speed': -3.2}, <DefaultOre.IRON: 'iron'>: {'durability': 250, 'attack_damage': 9, 'attack_speed': -3.1}, <DefaultOre.GOLD: 'golden'>: {'durability': 32, 'attack_damage': 7, 'attack_speed': -3.0}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 1561, 'attack_damage': 9, 'attack_speed': -3.0}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 2031, 'attack_damage': 10, 'attack_speed': -3.0}}>), Gear(name='shovel', shape=('X', 'S', 'S'), vanilla=<VanillaEquipments.SHOVEL: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 59, 'attack_damage': 2.5, 'attack_speed': -3.0}, <DefaultOre.COPPER: 'copper'>: {'durability': 190, 'attack_damage': 3.5, 'attack_speed': -3.0}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 131, 'attack_damage': 3.5, 'attack_speed': -3.0}, <DefaultOre.IRON: 'iron'>: {'durability': 250, 'attack_damage': 4.5, 'attack_speed': -3.0}, <DefaultOre.GOLD: 'golden'>: {'durability': 32, 'attack_damage': 2.5, 'attack_speed': -3.0}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 1561, 'attack_damage': 5.5, 'attack_speed': -3.0}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 2031, 'attack_damage': 6.5, 'attack_speed': -3.0}}>), Gear(name='hoe', shape=('XX', ' S', ' S'), vanilla=<VanillaEquipments.HOE: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 59, 'attack_damage': 1, 'attack_speed': -3.0}, <DefaultOre.COPPER: 'copper'>: {'durability': 190, 'attack_damage': 1, 'attack_speed': -2.0}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 131, 'attack_damage': 1, 'attack_speed': -2.0}, <DefaultOre.IRON: 'iron'>: {'durability': 250, 'attack_damage': 1, 'attack_speed': -1.0}, <DefaultOre.GOLD: 'golden'>: {'durability': 32, 'attack_damage': 1, 'attack_speed': -3.0}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 1561, 'attack_damage': 1, 'attack_speed': 0.0}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 2031, 'attack_damage': 1, 'attack_speed': 0.0}}>), Gear(name='spear', shape=(' X', ' S ', 'S '), vanilla=<VanillaEquipments.SPEAR: {<DefaultOre.LEATHER: 'wooden'>: {'durability': 59, 'attack_damage': 1, 'attack_speed': -2.462}, <DefaultOre.COPPER: 'copper'>: {'durability': 190, 'attack_damage': 2, 'attack_speed': -2.824}, <DefaultOre.CHAINMAIL: 'stone'>: {'durability': 131, 'attack_damage': 2, 'attack_speed': -2.666}, <DefaultOre.IRON: 'iron'>: {'durability': 250, 'attack_damage': 3, 'attack_speed': -2.947}, <DefaultOre.GOLD: 'golden'>: {'durability': 32, 'attack_damage': 1, 'attack_speed': -2.947}, <DefaultOre.DIAMOND: 'diamond'>: {'durability': 1561, 'attack_damage': 4, 'attack_speed': -3.048}, <DefaultOre.NETHERITE: 'netherite'>: {'durability': 2031, 'attack_damage': 5, 'attack_speed': -3.13}}>))[source]#
Tools,
Xbeing the material andSa stick.
- ARMOR_MATERIALS: dict[str, str] = {'stone': 'chainmail', 'wooden': 'leather'}[source]#
The vanilla armor of a tier whose armor is not named after it.
- class Material(
- name: str,
- base: str,
- main: Ingr,
- textures: dict[str, str],
- textures_folder: str,
- config: EquipmentsConfig | None,
- ignore_recipes: bool,
- durability_factor: float,
Bases:
objectA material being generated: its names, the textures found for it, and how its equipment is configured.
- durability_factor: float[source]#
Durability of this material’s equipment relative to the vanilla tier it is equivalent to.
- classmethod of(
- material: str,
- config: EquipmentsConfig | None,
- ignore_recipes: bool,
- textures_folder: str,
A material from its name: the base is cut before the last
_, or is the whole name when it ends with!.
- has(name: str) bool[source]#
Whether a texture named
<name>.pngexists, which is what decides that an item is generated.
- smelt_and_blast(
- ingredient: Ingr,
- result: Ingr | None = None,
A smelting recipe and the twice faster blasting one,
resultdefaulting to the item the recipe is put on.
- generate_everything_about_this_material(
- material: str = 'adamantium_fragment',
- equipments_config: EquipmentsConfig | None = None,
- ignore_recipes: bool = False,
Generate everything related to the ore (armor, tools, weapons, ore, and ingredients (raw, nuggets, blocks)).
The function will try to find textures in the assets folder to each item And return a list of generated items if you want to do something with it.
- Parameters:
material – The ore/material to generate everything about (ex: “adamantium_fragment”, “steel_ingot”, “minecraft:emerald”, “minecraft:copper_ingot”, “awakened_stardust!”) When the material ends with “!”, the material base will be the material without the “!”
equipments_config – The base multiplier to apply
ignore_recipes – If True, no recipes will be added in the definitions.
- write_ingredient(
- m: Material,
- item: str,
Define an ingredient of the material (ingot, nugget, raw, dust, stick…) and the recipes making it.
- ingredient_recipes(
- m: Material,
- item: str,
The recipes making an ingredient, from the other forms of the material that have a texture.
- refined_recipes(
- m: Material,
The recipes making the refined material: out of its block and its nuggets, and by smelting its raw form, dust or ores.
- dust_recipes(
- m: Material,
- dust: str,
The recipes around the dust: smelting it back into the material, and pulverizing the material, its raw form and its ores.
- write_placeable(
- m: Material,
- block: str,
Define a block of the material: its storage block, raw block or ores, which drop the raw material without silk touch.
- write_equipment_asset(
- m: Material,
The equipment asset drawing the material’s armor on a player, from its
_layer_1and_layer_2textures.- Returns:
Whether the top layer and the leggings layer were found.
- copy_armor_layer(
- m: Material,
- model_data: JsonDict,
- layer_num: int,
- gear_types: tuple[str, ...],
- humanoid_type: str,
Copy one layer texture into the assets and add it to
model_data, when it and one of the pieces it draws exist.
- write_armor( ) None[source]#
Define an armor piece, wearable with the material’s look when the layer drawing it exists.
- write_tool( ) None[source]#
Define a tool, mining like the vanilla tier the material is configured to equal.
- generate_everything_about_these_materials(
- ores: dict[str, EquipmentsConfig | None],
- ignore_recipes: bool = False,
Uses function ‘generate_everything_about_this_material’ for each ore in the ores dictionary.
- Parameters:
ores – The ores to apply. The ore/material (key) to generate everything about (ex: “adamantium_fragment”, “steel_ingot”, “minecraft:emerald”, “minecraft:copper_ingot”, “awakened_stardust!”) When the material ends with “!”, the material base will be the material without the “!”, else we try to cut before the last “_”.
ignore_recipes – If True, no recipes will be added in the definitions.
- add_recipes_for_dust(
- material: str,
- pulverize: list[str | JsonDict],
- smelt_to: Ingr,
Add recipes for dust (pulverize and smelt). If dust isn’t found in the definitions, it will be added automagically.
All items in the pulverize list will be pulverized to get 2 times the dust.
If the item is a string, their Ingr will be used as “minecraft:{item}”
- Parameters:
material – The material to add dust recipes for, ex: “copper” will add recipes for “copper_dust”.
pulverize – The list of items to pulverize to get 2 times the dust, ex: [“raw_copper”, “copper_ore”, “deepslate_copper_ore”, Ingr(“custom_copper”, “some_namespace”)]
smelt_to – The ingredient representation of the result of smelting the dust, ex: Ingr(“minecraft:copper_ingot”)}
- add_recipes_for_all_dusts(
- dusts_configs: dict[str, tuple[list[str | JsonDict], Ingr]],
Add recipes for all dusts in the dusts_configs dictionary using the add_recipes_for_dust function.
- Parameters:
dusts_configs – The dusts to add recipes for.
{ "copper": ( ["raw_copper", "copper_ore", "deepslate_copper_ore", Ingr("custom_copper", "some_namespace")], Ingr("minecraft:copper_ingot") ) }
records#
- clean_record_name(name: str) str[source]#
Clean a record name by removing special characters and converting to lowercase.
- Parameters:
name – The name to clean
- Returns:
The cleaned name containing only lowercase letters, numbers and underscores
- Return type:
str
- generate_custom_records(
- records: dict[str, str] | str | None = 'auto',
- category: str | None = None,
- attenuation_distance: int | None = None,
Generate custom records from the files in assets/records/, copying them to the definitions and the resource pack.
- Parameters:
records – The custom records to apply. Ex: {“record_1”: “My first Record.ogg”, “record_2”: “A second one.ogg”}
category – The definitions category to apply to the custom records (ex: “music”).
attenuation_distance – Blocks after which the record stops being heard, None for the vanilla 16.
simplenergy#
- format_energy_number(number: int) str[source]#
Formats a number into a string with appropriate unit suffix (k, M, G, T).
- Parameters:
number – The number to format
- Returns:
Formatted string with unit suffix, ex: 12000 -> “12 M”, 1200 -> “1200 k”
- Return type:
str
- create_energy_lore(
- energy_data: dict[str, int],
Creates lore entries for energy-related blocks based on their energy data.
- Parameters:
energy_data – Dictionary containing energy configuration values
- Returns:
Formatted text component with energy lore
- Return type:
TextComponent
smart_ore_generation#
- class CustomOreGeneration(*, dimensions: list[str], maximum_height: int = 70, minimum_height: int | None = None, veins_per_region: float = 4, vein_size_logic: float = 0.4, provider: str | list[str] = <factory>, vein_conditions: list[str] = <factory>, block_conditions: list[str] = <factory>, placer_command: str = '')[source]#
Bases:
StMappingWhere, how often and how large the veins of one custom ore generate, through the Smart Ore Generation library.
The library scans 96x96 regions around players and starts each vein at a random position next to air. Conditions are execute subcommands starting with “if “ or “unless “, all of which must hold.
vein_conditionsare checked once at the start of the vein and cancel all of it, which suits biomes.block_conditionsare checked at every block of the vein, which suits neighbouring blocks.CustomOreGeneration( dimensions=["minecraft:overworld"], provider=["#minecraft:terracotta"], vein_conditions=["if biome ~ ~ ~ #minecraft:is_badlands"], block_conditions=["if block ~ ~1 ~ #minecraft:terracotta"], )
- OVERWORLD_REPLACEABLES: ClassVar[tuple[str, ...]] = ('#minecraft:base_stone_overworld', '#minecraft:substrate_overworld', '#minecraft:sand', '#minecraft:terracotta', '#minecraft:iron_ores', '#minecraft:copper_ores', '#minecraft:snow', 'minecraft:gravel', 'minecraft:suspicious_gravel', 'minecraft:sandstone', 'minecraft:red_sandstone', 'minecraft:calcite', 'minecraft:packed_ice', 'minecraft:raw_iron_block', 'minecraft:raw_copper_block', 'minecraft:cinnabar', 'minecraft:sulfur', 'minecraft:potent_sulfur')[source]#
Blocks of the #minecraft:overworld_carver_replaceables tag, which 26.3 removed.
- NETHER_REPLACEABLES: ClassVar[tuple[str, ...]] = ('#minecraft:base_stone_overworld', '#minecraft:base_stone_nether', '#minecraft:substrate_overworld', '#minecraft:nylium', '#minecraft:wart_blocks', 'minecraft:soul_sand', 'minecraft:soul_soil')[source]#
Blocks of the #minecraft:nether_carver_replaceables tag, which 26.3 removed.
- dimensions: list[str][source]#
Dimensions to generate in, ex: [“minecraft:overworld”, “stardust:cavern”].
- veins_per_region: float[source]#
The decimal part is the chance of one more vein: 1.2 is one vein plus a 20% chance of a second.
- vein_size_logic: float[source]#
Higher means larger veins: 0.0 is a single block, 0.4 a small vein, 1.0 a large one.
- provider: str | list[str][source]#
Blocks or block tags the ore replaces. Defaults to the blocks vanilla carvers replace in the overworld.
- vein_conditions: list[str][source]#
Checked once at the start of the vein, ex: [“if biome ~ ~ ~ #minecraft:is_badlands”].
- block_conditions: list[str][source]#
Checked at every block of the vein, ex: [“if block ~ ~-1 ~ #minecraft:terracotta”].
- placer_command: str[source]#
Execute subcommands ending with “run …”, placing one ore at ~ ~ ~. Empty places the custom block of the ore.
- origin: SourceOrigin | None[source]#
Where this configuration was declared, so the source_maps plugin maps the generated functions back to it.
- static all_with_config(
- ore_configs: dict[str | Block, list[CustomOreGeneration]],
Generate the files of every configuration, several configurations of one ore getting numbered veins.
CustomOreGeneration.all_with_config({ "super_iron_ore": [ CustomOreGeneration(dimensions=["minecraft:overworld"], minimum_height=0, maximum_height=50, veins_per_region=2), ], "deepslate_super_iron_ore": [ CustomOreGeneration(dimensions=["minecraft:overworld"], maximum_height=0, veins_per_region=2), CustomOreGeneration(dimensions=["stardust:cavern"], maximum_height=0, veins_per_region=8, vein_size_logic=0.8), ], })
- generate_files(
- custom_ore: str,
- number: int | None = None,
Write the functions (and block tag if needed) generating this ore.
- Parameters:
custom_ore – Custom block id, ex: “adamantium_ore”
number – Suffix telling apart several configurations of the same ore, ex: 1 for “adamantium_ore_1”
- write_main_function(
- beautify_ore: str,
- vein_path: str,
Append to the generate_ores signal the calls to the vein function, once per vein.
- write_vein_function(
- beautify_ore: str,
- vein_path: str,
- provider: str,
- placer_command: str,
Write the function picking the start of a vein and placing the ore around it.
- Parameters:
provider – Block or block tag the ore replaces, usable in
if blockplacer_command – Execute subcommands ending with “run …”, placing one ore at ~ ~ ~
text#
- create_gradient_text(
- text: str,
- start_hex: str = '#c24a17',
- end_hex: str = '#c77e36',
- text_length: int | None = None,
Create a gradient text effect by interpolating colors between start and end hex.
- Parameters:
text – The text to apply the gradient to.
start_hex – Starting color in hex format (e.g. ‘#c24a17’).
end_hex – Ending color in hex format (e.g. ‘#c77e36’).
text_length – Optional length override for the text. If provided, uses this instead of len(text).
- Returns:
List of text components, each with a letter and its color.
- Return type:
list[JsonDict]
- rainbow_gradient_text(
- text: str,
Create a rainbow gradient text effect that cycles through the color spectrum from red to red.
- Parameters:
text – The text to apply the rainbow gradient to.
- Returns:
List of text components, each with a letter and its rainbow color.
- Return type:
list[JsonDict]
- gradient_text_to_string(
- gradient_text: list[JsonDict],
- color_pos: int = 0,
Convert a gradient text back to a string, optionally getting the color at a specific position.
- Parameters:
gradient_text – The gradient text to convert back to a string.
color_pos – The position to get the color from.
- Returns:
A dictionary containing the concatenated text and its color at the specified position.
- Return type:
dict[str, str]