1. विकी
  2. /एंटिटी
  3. /आपका पहला कस्टम मॉब

आपका पहला कस्टम मॉब

Minecraft Bedrock के लिए एक आसान शांत मॉब बनाएँ जो इधर-उधर घूमता है, प्लेयर्स की ओर देखता है और जिसका अपना spawn egg है।

इस गाइड में आप एक Critter बनाएँगे: चार पैरों वाला एक छोटा, दोस्ताना मॉब जो इधर-उधर घूमता है, आपकी ओर देखता है और चोट लगने पर भाग जाता है। इसका एक 3D मॉडल, एक skin, एक spawn egg है और यह घास पर अपने आप spawn हो सकता है।

मॉब ऐड-ऑन की सबसे बड़ी चीज़ हैं, क्योंकि ये दोनों पैक में रहते हैं: बिहेवियर पैक बताता है कि मॉब क्या करता है, और रिसोर्स पैक बताता है कि वह कैसा दिखता है।

आसान तरीका: GodCraft

हाथ से मॉडल बनाने का मतलब है क्यूब के coordinates टाइप करना। GodCraft में आप इसे अपनी उँगलियों से आकार देते हैं।

  1. Workshop खोलें और अपने ऐड-ऑन में एक Mob जोड़ें।
  2. 3D मॉडल एडिटर में उसका शरीर बनाएँ, फिर model painter से उसकी skin पेंट करें।
  3. उसकी health, speed और बिहेवियर सेट करें, और एक Spawn egg जोड़ें।
  4. Export दबाएँ। आपको एक .mcaddon मिलता है जिसमें नीचे दी गई हर फ़ाइल पहले से लिखी होती है, manifests, UUIDs और नामों के साथ।

हाथ से

प्रोजेक्ट सेटअप से एक बिहेवियर पैक (BP) और रिसोर्स पैक (RP) लेकर शुरू करें। हम namespace myname इस्तेमाल करते हैं, इसलिए हमारा मॉब myname:critter है।

फ़ाइलपैकयह क्या करती है
entities/critter.jsonBPHealth, चलना-फिरना और बिहेवियर
spawn_rules/critter.jsonBPयह अपने आप कहाँ spawn होता है
entity/critter.entity.jsonRPकौन-सा मॉडल, skin और ऐनिमेशन इस्तेमाल हों
models/entity/critter.geo.jsonRP3D मॉडल
textures/entity/critter.pngRPSkin
texts/en_US.langRPमॉब और उसके egg के नाम

Step 1: बिहेवियर फ़ाइल

BP/entities/critter.json
{
  "format_version": "1.26.50",
  "minecraft:entity": {
    "description": {
      "identifier": "myname:critter",
      "is_spawnable": true,
      "is_summonable": true
    },
    "components": {
      "minecraft:type_family": {
        "family": ["critter", "mob"]
      },
      "minecraft:health": {
        "value": 8,
        "max": 8
      },
      "minecraft:physics": {},
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 0.7
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:movement.basic": {},
      "minecraft:navigation.walk": {
        "avoid_water": true,
        "avoid_damage_blocks": true
      },
      "minecraft:jump.static": {},
      "minecraft:pushable_by_entity": {},
      "minecraft:pushable_by_block": {},
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.panic": {
        "priority": 1,
        "speed_multiplier": 1.4
      },
      "minecraft:behavior.random_stroll": {
        "priority": 4,
        "speed_multiplier": 0.8
      },
      "minecraft:behavior.look_at_player": {
        "priority": 5,
        "look_distance": 6.0,
        "probability": 0.02
      },
      "minecraft:behavior.random_look_around": {
        "priority": 6
      }
    }
  }
}

description में:

  • identifier मॉब की ID है, जो /summon myname:critter में इस्तेमाल होती है।
  • is_spawnable से इसका spawn egg बन सकता है और यह अपने आप spawn हो सकता है।
  • is_summonable से आप इस पर /summon इस्तेमाल कर सकते हैं।

बुनियादी कंपोनेंट:

  • minecraft:type_family मॉब को tags देता है जिन्हें दूसरे मॉब और कमांड जाँच सकते हैं, जैसे @e[family=critter]।
  • minecraft:health: value शुरुआती health है, max ज़्यादा से ज़्यादा जितनी हो सकती है। हर दिल 2 points का होता है।
  • minecraft:physics इसे gravity और टकराव देता है। इसके बिना मॉब एक जगह हवा में तैरता रहता है।
  • minecraft:collision_box वह अदृश्य बॉक्स है जो चीज़ों से टकराता है, ब्लॉक में।

चलने की तिकड़ी (चलने के लिए तीनों ज़रूरी हैं):

  • minecraft:movement speed सेट करता है। 0.25 लगभग गाय की speed है।
  • minecraft:movement.basic चलने का तरीका है: ज़मीन पर सादा चलना।
  • minecraft:navigation.walk इसे ज़मीन पर रास्ते प्लान करने देता है। यहाँ यह पानी और आग जैसी चीज़ों से बचता है।

minecraft:jump.static इसे एक ब्लॉक ऊपर कूदने देता है। pushable_by_entity और pushable_by_block कंपोनेंट से प्लेयर और pistons इसे धक्का दे सकते हैं, और minecraft:breathable पानी के अंदर हवा को कंट्रोल करता है।

बिहेवियर और priority

behavior. से शुरू होने वाले कंपोनेंट मॉब का "दिमाग" हैं। हर एक की एक priority होती है: छोटी संख्या जीतती है। जब Critter को चोट लगती है, तो panic (priority 1) random_stroll (priority 4) की जगह ले लेता है।

  • behavior.float: पानी में ऊपर तैरना ताकि डूबे नहीं।
  • behavior.panic: damage लगने के बाद तेज़ी से भाग जाना।
  • behavior.random_stroll: इधर-उधर घूमना।
  • behavior.look_at_player: पास के प्लेयर्स की ओर सिर घुमाना।
  • behavior.random_look_around: खाली बैठे होने पर इधर-उधर देखना।

Step 2: मॉडल

मॉडल bones से बनता है, और हर bone में क्यूब होते हैं। इकाई pixels है: 16 pixels मिलकर एक ब्लॉक बनाते हैं।

RP/models/entity/critter.geo.json
{
  "format_version": "1.12.0",
  "minecraft:geometry": [
    {
      "description": {
        "identifier": "geometry.myname.critter",
        "texture_width": 64,
        "texture_height": 32,
        "visible_bounds_width": 2,
        "visible_bounds_height": 1.5,
        "visible_bounds_offset": [0, 0.5, 0]
      },
      "bones": [
        {
          "name": "body",
          "pivot": [0, 4, 0],
          "cubes": [{ "origin": [-3, 4, -4], "size": [6, 5, 8], "uv": [0, 0] }]
        },
        {
          "name": "head",
          "parent": "body",
          "pivot": [0, 8, -4],
          "cubes": [{ "origin": [-2.5, 6, -8.5], "size": [5, 5, 5], "uv": [0, 13] }]
        },
        { "name": "leg0", "parent": "body", "pivot": [-2, 4, 3], "cubes": [{ "origin": [-3, 0, 2], "size": [2, 4, 2], "uv": [28, 0] }] },
        { "name": "leg1", "parent": "body", "pivot": [2, 4, 3], "cubes": [{ "origin": [1, 0, 2], "size": [2, 4, 2], "uv": [28, 0] }] },
        { "name": "leg2", "parent": "body", "pivot": [-2, 4, -3], "cubes": [{ "origin": [-3, 0, -4], "size": [2, 4, 2], "uv": [28, 0] }] },
        { "name": "leg3", "parent": "body", "pivot": [2, 4, -3], "cubes": [{ "origin": [1, 0, -4], "size": [2, 4, 2], "uv": [28, 0] }] }
      ]
    }
  ]
}

Bones के नाम head और leg0 से leg3 जानबूझकर रखे गए हैं: vanilla walk और look ऐनिमेशन ठीक इन्हीं नामों वाले bones को हिलाते हैं, इसलिए हम उन्हें मुफ़्त में दोबारा इस्तेमाल कर सकते हैं।

Step 3: skin

एक 64x32 PNG पेंट करें और उसे RP/textures/entity/critter.png के रूप में सेव करें। हर क्यूब का uv गेम को बताता है कि इमेज का कौन-सा हिस्सा उसके चारों ओर लिपटेगा। UV layout हाथ से पेंट करना झंझट भरा है, इसीलिए model painter बहुत काम आता है। टिप्स के लिए Pixel textures देखें।

Step 4: client entity

यह फ़ाइल ID को मॉडल, skin, ऐनिमेशन और spawn egg से जोड़ती है:

RP/entity/critter.entity.json
{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "myname:critter",
      "materials": { "default": "entity_alphatest" },
      "textures": { "default": "textures/entity/critter" },
      "geometry": { "default": "geometry.myname.critter" },
      "animations": {
        "walk": "animation.quadruped.walk",
        "look_at_target": "animation.common.look_at_target"
      },
      "scripts": {
        "animate": [
          { "walk": "query.modified_move_speed" },
          "look_at_target"
        ]
      },
      "render_controllers": ["controller.render.default"],
      "spawn_egg": {
        "base_color": "#c98a4b",
        "overlay_color": "#5a3a1e"
      }
    }
  }
}
  • materials: entity_alphatest skin के पूरी तरह transparent pixels को आर-पार दिखने देता है।
  • render_controllers: controller.render.default एक vanilla controller है जो default geometry को default texture और material के साथ बनाता है। एक skin वाले मॉब के लिए एकदम सही।
  • scripts.animate: walk ऐनिमेशन उतनी ही तेज़ी से चलता है जितनी तेज़ी से मॉब चलता है, Molang query query.modified_move_speed की मदद से (देखें Molang queries)।
  • spawn_egg: egg के दो रंग। इसकी जगह आप item_texture.json के किसी छोटे नाम के साथ "texture" इस्तेमाल कर सकते हैं।

Step 5: नाम

RP/texts/en_US.lang
entity.myname:critter.name=Critter
item.spawn_egg.entity.myname:critter.name=Critter Spawn Egg

Step 6: अपने आप spawn होना (optional)

इस फ़ाइल के बिना मॉब सिर्फ़ अपने egg से या /summon से आता है। इसके साथ, Critters दिन की रोशनी में घास पर छोटे झुंडों में spawn होते हैं:

BP/spawn_rules/critter.json
{
  "format_version": "1.8.0",
  "minecraft:spawn_rules": {
    "description": {
      "identifier": "myname:critter",
      "population_control": "animal"
    },
    "conditions": [
      {
        "minecraft:spawns_on_surface": {},
        "minecraft:spawns_on_block_filter": "minecraft:grass_block",
        "minecraft:brightness_filter": { "min": 7, "max": 15, "adjust_for_weather": false },
        "minecraft:weight": { "default": 8 },
        "minecraft:herd": { "min_size": 1, "max_size": 3 },
        "minecraft:biome_filter": { "test": "has_biome_tag", "operator": "==", "value": "animal" }
      }
    ]
  }
}

weight बताता है कि दूसरे मॉब की तुलना में इसे कितनी बार चुना जाता है। population_control: animal इसे world की जानवरों वाली सीमा (cap) में शामिल करता है, ताकि यह आपके world को भर न दे।

अपना मॉब टेस्ट करें

  1. दोनों पैक इंस्टॉल करें (एक्सपोर्ट और इंस्टॉल) और उन्हें किसी world पर चालू करें।
  2. Creative inventory में Critter Spawn Egg ढूँढें, या /summon myname:critter चलाएँ।
  3. उसे घूमते और आपकी ओर देखते हुए देखें। उसे एक बार मारें: उसे भाग जाना चाहिए।

अदृश्य मॉब या सिर्फ़ परछाई

गेम को बिहेवियर फ़ाइल तो मिल गई, लेकिन मॉडल या skin नहीं मिली। जाँचें कि दोनों पैक में identifier एक जैसा है, geometry का नाम geometry.myname.critter से बिल्कुल मेल खाता है, और texture path में .png नहीं है।

  • मॉब हिलता नहीं। चलने के तीनों हिस्से ज़रूरी हैं: movement, movement.basic और navigation.walk, साथ में कम से कम एक चलने वाला बिहेवियर।
  • मॉब ज़मीन से नीचे गिर जाता है या तैरता है। जाँचें कि minecraft:physics मौजूद है।

और जानकारी के लिए समस्या निवारण देखें।

आगे क्या

  • Vanilla entities में असली मॉब देखें और जानें कि गाय और सूअर कैसे बने हैं।
  • एंटिटी कंपोनेंट reference से और बिहेवियर जोड़ें, जैसे behavior.panic।
  • आपका पहला कस्टम ब्लॉक से अपने मॉब के लिए world में एक घर बनाएँ।

We use cookies to improve your experience and analyse site traffic. Learn more