import os
import json
import zipfile
import uuid
def create_mcaddon():
bp_dir = "BP_Lukas_Co"
rp_dir = "RP_Lukas_Co"
os.makedirs(f"{bp_dir}/entities", exist_ok=True)
os.makedirs(f"{rp_dir}/models/entity", exist_ok=True)
# 1. Behavior Manifest
with open(f"{bp_dir}/manifest.json", "w", encoding="utf-8") as f:
json.dump({
"format_version": 2,
"header": {
"description": "Lukas & Co Behavior Pack",
"name": "Lukas & Co BP",
"uuid": str(uuid.uuid4()),
"version": [1, 0, 0],
"min_engine_version": [1, 20, 0]
},
"modules": [{"type": "data", "uuid": str(uuid.uuid4()), "version": [1, 0, 0]}]
}, f, indent=2)
# 2. Resource Manifest
with open(f"{rp_dir}/manifest.json", "w", encoding="utf-8") as f:
json.dump({
"format_version": 2,
"header": {
"description": "Lukas & Co Resource Pack",
"name": "Lukas & Co RP",
"uuid": str(uuid.uuid4()),
"version": [1, 0, 0],
"min_engine_version": [1, 20, 0]
},
"modules": [{"type": "resources", "uuid": str(uuid.uuid4()), "version": [1, 0, 0]}]
}, f, indent=2)
# 3. Alle 10 Mobs generieren
mobs = [
("darko", "Darko", 300, 15, True),
("wolfi", "Wolfi", 180, 10, True),
("kitty_cat", "Kitty Cat", 160, 8, True),
("frocky", "Frocky", 90, 4, False),
("dogi", "Dogi", 110, 6, False),
("hopy", "Hopy", 80, 3, False),
("fledy", "Fledy", 140, 9, True),
("blumi", "Blumi", 220, 12, True),
("timo", "Timo", 130, 5, False),
("barry", "Barry Prototype", 350, 18, True)
]
for mob_id, mob_name, hp, dmg, is_boss in mobs:
# Entity JSON (BP)
ent = {
"format_version": "1.16.0",
"minecraft:entity": {
"description": {"identifier": f"lukas:{mob_id}", "is_spawnable": True, "is_summonable": True},
"components": {
"minecraft:health": {"value": hp, "max": hp},
"minecraft:movement": {"value": 0.3},
"minecraft:attack": {"damage": dmg},
"minecraft:physics": {},
"minecraft:pushable": {"is_pushable": True}
}
}
}
if is_boss:
ent["minecraft:entity"]["components"]["minecraft:boss"] = {"name": mob_name, "hud_range": 20}
ent["minecraft:entity"]["components"]["minecraft:behavior.melee_attack"] = {"priority": 2}
ent["minecraft:entity"]["components"]["minecraft:behavior.nearest_attackable_target"] = {
"priority": 1,
"entity_types": [{"filters": {"test": "is_family", "subject": "other", "value": "player"}, "max_dist": 16}]
}
else:
ent["minecraft:entity"]["components"]["minecraft:behavior.random_stroll"] = {"priority": 5}
with open(f"{bp_dir}/entities/{mob_id}.json", "w", encoding="utf-8") as f:
json.dump(ent, f, indent=2)
# Geo Model JSON (RP)
geo = {
"format_version": "1.12.0",
f"geometry.lukas_{mob_id}": {
"texturewidth": 64, "textureheight": 64,
"bones": [
{"name": "root", "pivot": [0, 0, 0]},
{"name": "body", "parent": "root", "pivot": [0, 12, 0], "cubes": [{"origin": [-4, 6, -3], "size": [8, 12, 6], "uv": [0, 0]}]},
{"name": "head", "parent": "body", "pivot": [0, 18, 0], "cubes": [{"origin": [-4, 18, -4], "size": [8, 8, 8], "uv": [28, 0]}]}
]
}
}
with open(f"{rp_dir}/models/entity/{mob_id}.geo.json", "w", encoding="utf-8") as f:
json.dump(geo, f, indent=2)
# 4. In .mcaddon (Zip-Archiv) packen
addon_name = "Lukas_und_Co.mcaddon"
with zipfile.ZipFile(addon_name, 'w', zipfile.ZIP_DEFLATED) as zipf:
for folder in [bp_dir, rp_dir]:
for root, _, files in os.walk(folder):
for file in files:
full_path = os.path.join(root, file)
rel_path = os.path.relpath(full_path, ".")
zipf.write(full_path, rel_path)
print(f"ERFOLGREICH! D
eine Datei wurde erstellt: {os.path.abspath(addon_name)}")
if __name__ == "__main__":
create_mcaddon()

