Gem is a Python library that makes Minecraft Datapack/Resoursepack creation process easier
A utility class for handling Minecraft version information and pack formats.
Key Methods:
get_pack_format(version, pack_type): Returns the pack format number for a given versionget_namespace_folders(): Returns a dictionary of all supported namespace folder typesversion_compare(v1, v2): Compares two Minecraft versions
Defines the two types of Minecraft packs:
DATA: For data packsRESOURCE: For resource packs
The base class for all pack types with common functionality.
Key Methods:
set_icon(icon_path): Sets the pack iconcreate_root(): Creates the root directory structureadd_namespace(namespace): Adds a namespace to the packbuild(output_path): Builds the pack into a directory or zip file
Extends Pack for creating data packs specifically.
Extends Pack for creating resource packs with additional functionality for custom content.
Key Methods:
add_texture(): Adds a texture to the resource packadd_block_model(): Adds a custom block modeladd_blockstate(): Adds block state definitionsadd_language(): Adds language translationsadd_sound(): Adds custom soundsadd_custom_item(): Creates a custom item with componentsadd_custom_block(): Creates a custom block with associated functionality- ...
Represents a namespace within a pack, containing folders and files.
Represents a folder within a namespace with methods for creating various Minecraft content types.
Key Methods:
add_folder(name): Adds a subfolderadd_file(name, content): Adds a file with content- Various
create_*()methods for different Minecraft content types
Class related to custom items
Class related to custom blocks obviously
# Create a data pack
datapack = DataPack(
name="MyDataPack",
description="My custom data pack",
version="1.21.4"
)
# Add a namespace
myns = datapack.add_namespace("myns")
# Create a function
myns.folder.create_function("test", "say Hello from my data pack!")
# Build the pack
datapack.build()# Create a resource pack
resourcepack = ResourcePack(
name="MyResourcePack",
description="My custom resource pack",
version="1.21.4"
)
# Add a texture
resourcepack.add_texture("myns", "item/diamond_sword", "some_sword_ig.png")
# Build the pack
resourcepack.build()# Create both packs first
datapack = DataPack("MyPack", "Custom items", "1.21.4")
resourcepack = ResourcePack("MyPack", "Custom items", "1.21.4")
# Create a custom item
custom_item = resourcepack.add_custom_item(
namespace="myns",
item_id="minecraft:stick",
custom_name="some_cool_sword",
texture_path="some_cool_sword.png",
datapack=datapack,
item_name="Magic Wand",
enchantments={"minecraft:sharpness": 5}
)
# Add a crafting recipe
recipe = {
"type": "minecraft:crafting_shaped",
"pattern": [
" S",
" S ",
"S "
],
"key": {
"S": {"item": "minecraft:stick"}
}
}
custom_item.add_crafting_recipe(recipe)
# Build both packs
datapack.build()
resourcepack.build()# Create both packs first
datapack = DataPack("MyPack", "Custom blocks", "1.21.4")
resourcepack = ResourcePack("MyPack", "Custom blocks", "1.21.4")
# Create a custom block
custom_block = resourcepack.add_custom_block(
datapack=datapack,
base_block="minecraft:stone",
namespace="myns",
texture_path="block_texture.png",
custom_name="custom_stone",
item_name="Custom Stone Block"
)
# Build both packs
datapack.build()
resourcepack.build()