Behavior फ़ाइल तय करती है कि मॉब क्या करता है। Client entity फ़ाइल तय करती है कि वह कैसा दिखता है: कौन-सा मॉडल, कौन-सी skin, कौन-से animations और उसका spawn egg कैसा दिखता है। यह रिसोर्स पैक में रहती है।
इसे छोटे नामों (nicknames) की एक लिस्ट की तरह सोचें। यहाँ आप हर मॉडल, texture और animation को एक छोटा नाम देते हैं, और रिसोर्स पैक की दूसरी फ़ाइलें वही नाम इस्तेमाल करती हैं।
फ़ाइलें
RP/
entity/
ruby_golem.entity.json
models/
entity/
ruby_golem.geo.json
textures/
entity/
ruby_golem.png
ruby_golem_angry.png
animations/
ruby_golem.animation.json
animation_controllers/
ruby_golem.animation_controllers.json
render_controllers/
ruby_golem.render_controllers.jsonसिर्फ़ entity फ़ाइल, एक मॉडल और एक texture ज़रूरी हैं। बाकी optional हैं: अपने खुद के लिखने की जगह आप vanilla animations और render controllers उधार ले सकते हैं।
फ़ाइल का नाम कुछ भी हो सकता है। इसे बिहेवियर पैक से identifier जोड़ता है।
एक पूरा उदाहरण
यह Entity फ़ाइल वाले Ruby Golem की client फ़ाइल है। जब golem की wiki:mood property angry होती है, तो यह गुस्से वाला texture दिखाती है।
{
"format_version": "1.10.0",
"minecraft:client_entity": {
"description": {
"identifier": "wiki:ruby_golem",
"materials": {
"default": "entity_alphatest"
},
"textures": {
"default": "textures/entity/ruby_golem",
"angry": "textures/entity/ruby_golem_angry"
},
"geometry": {
"default": "geometry.wiki.ruby_golem"
},
"animations": {
"walk": "animation.wiki.ruby_golem.walk",
"attack": "animation.wiki.ruby_golem.attack",
"look_at_target": "animation.common.look_at_target",
"attack_controller": "controller.animation.wiki.ruby_golem.attack"
},
"scripts": {
"scale": "1.2",
"animate": [
{ "walk": "q.modified_move_speed" },
"look_at_target",
"attack_controller"
]
},
"render_controllers": ["controller.render.wiki.ruby_golem"],
"spawn_egg": {
"base_color": "#9b111e",
"overlay_color": "#f4c2c2"
}
}
}
}ज़्यादातर vanilla client फ़ाइलें "format_version": "1.10.0" इस्तेमाल करती हैं, और आपकी फ़ाइल के लिए भी यह अच्छा विकल्प है। पेज का बाकी हिस्सा हर field को एक-एक करके समझाता है।
identifier
मॉब की ID, बिल्कुल वैसी ही जैसी बिहेवियर पैक में है: wiki:ruby_golem। अगर दोनों मेल नहीं खाते, तो मॉब अदृश्य हो जाता है।
materials
Material गेम को बताता है कि pixels कैसे बनाने हैं: ठोस, पारदर्शी, चमकते हुए वगैरह। आप गेम में पहले से मौजूद materials में से चुनते हैं और हर एक को एक छोटा नाम देते हैं।
"materials": {
"default": "entity_alphatest",
"glow": "entity_emissive_alpha"
}| Material | किसके लिए इस्तेमाल करें |
|---|---|
entity | पूरी तरह ठोस skins, कोई transparent pixel नहीं |
entity_alphatest | पूरी तरह transparent छेदों वाली skins। सबसे सुरक्षित default। |
entity_alphablend | आधे-पारदर्शी pixels, जैसे कांच या slime |
entity_emissive_alpha | अंधेरे में चमकने वाले हिस्से, texture के alpha से तय होते हैं |
कई vanilla मॉब के materials उनके अपने नाम पर होते हैं (pig, iron_golem)। वे एक ही मॉब के लिए tune किए गए हैं, इसलिए अपने मॉब के लिए आम entity... वाले ही इस्तेमाल करें।
textures
हर skin के लिए छोटे नाम। Paths रिसोर्स पैक के root से शुरू होते हैं और उनमें .png नहीं लिखा जाता।
"textures": {
"default": "textures/entity/ruby_golem",
"angry": "textures/entity/ruby_golem_angry"
}आप जितने चाहें उतने लिख सकते हैं। कौन-सा दिखेगा, यह render controller तय करता है। Skins पेंट करने के टिप्स Pixel textures में हैं।
geometry
हर मॉडल के लिए छोटे नाम। वैल्यू वह identifier है जो .geo.json फ़ाइल के अंदर लिखा है, फ़ाइल का नाम नहीं।
"geometry": {
"default": "geometry.wiki.ruby_golem"
}एक मॉब के कई मॉडल हो सकते हैं। जैसे vanilla मुर्गियों (chickens) का एक सामान्य, एक ठंडा और एक baby मॉडल है।
animations
Animations और animation controllers के लिए छोटे नाम। आप अपने खुद के और vanilla वाले मिला सकते हैं।
"animations": {
"walk": "animation.wiki.ruby_golem.walk",
"look_at_target": "animation.common.look_at_target",
"attack_controller": "controller.animation.wiki.ruby_golem.attack"
}सिर्फ़ नाम देना काफ़ी नहीं: ये तभी चलते हैं जब इन्हें scripts.animate में लिखा जाए (नीचे देखें) या कोई animation controller इन्हें शुरू करे।
उधार लेने लायक काम के vanilla animations, अगर आपकी bones के नाम मेल खाते हों:
| Animation | क्या हिलाता है | किन bones की उम्मीद करता है |
|---|---|---|
animation.common.look_at_target | सिर को उस ओर जिधर मॉब देख रहा है | head |
animation.quadruped.walk | चलते समय चार पैर | leg0 से leg3 |
animation.humanoid.move | चलते समय बाँहें और पैर | leftarm, rightarm, leftleg, rightleg |
animation_controllers
पुरानी client फ़ाइलें controllers को animations की जगह अपनी अलग array में लिखती हैं:
"animation_controllers": [
{ "attack": "controller.animation.wiki.ruby_golem.attack" }
]हर entry एक छोटे नाम वाला object है। यहाँ लिखे controllers scripts.animate के बिना अपने-आप चलते हैं। format_version 1.10.0 और उससे नए में, controllers को animations में रखना और उन्हें scripts.animate से शुरू करना आम तरीका है, जैसा पूरे उदाहरण में है।
render_controllers
Render controller चुनता है कि कौन-सी geometry, texture और material बनाना है। लिस्ट में कई हो सकते हैं, और सब draw होते हैं।
"render_controllers": ["controller.render.wiki.ruby_golem"]एक मॉडल, एक skin और एक material वाले मॉब के लिए आपको अपना render controller नहीं चाहिए। Vanilla controller.render.default, default नाम वालों को draw करता है। Textures बदलने के लिए अपना एक छोटा controller लिखें:
{
"format_version": "1.8.0",
"render_controllers": {
"controller.render.wiki.ruby_golem": {
"geometry": "Geometry.default",
"materials": [{ "*": "Material.default" }],
"textures": [
"q.property('wiki:mood') == 'angry' ? Texture.angry : Texture.default"
]
}
}
}Geometry.default, Material.default और Texture.angry client फ़ाइल के छोटे नामों की ओर इशारा करते हैं। materials में * का मतलब है "हर bone"। Texture वाली लाइन एक Molang सवाल है: गुस्से वाले golems को गुस्से वाली skin मिलती है।
यह सिर्फ़ इसलिए काम करता है क्योंकि बिहेवियर पैक में property पर "client_sync": true लगा है। इसके बिना रिसोर्स पैक वैल्यू देख ही नहीं सकता।
आप Molang शर्त से पूरे render controller को चालू और बंद भी कर सकते हैं। Vanilla creepers अपनी charged चमक के लिए यही करते हैं:
"render_controllers": [
"controller.render.wiki.ruby_golem",
{ "controller.render.wiki.ruby_golem_glow": "q.property('wiki:mood') == 'angry'" }
]scripts
scripts में Molang के छोटे टुकड़े होते हैं जो प्लेयर के डिवाइस पर चलते हैं।
| Script | कब चलती है | किसके लिए है |
|---|---|---|
initialize | एक बार, जब मॉब पहली बार दिखता है | Variables की शुरुआती वैल्यू सेट करने के लिए |
pre_animation | हर frame, animations से पहले | Animations को जिन वैल्यू की ज़रूरत है, उन्हें निकालने के लिए |
animate | हर frame | कौन-से animations और controllers चलाने हैं |
scale | हर frame | पूरे मॉडल को बड़ा या छोटा करने के लिए |
variables | Script नहीं: एक लिस्ट | Variables को public मार्क करने के लिए ताकि attachables उन्हें पढ़ सकें |
animate
हर entry animations का एक छोटा नाम है। इसे 0 से 1 तक की ताकत के साथ चलाने के लिए एक object में लपेटें:
"animate": [
{ "walk": "q.modified_move_speed" },
"look_at_target",
"attack_controller"
]Golem जितना तेज़ चलता है, walk उतना ज़ोर से चलता है, और उसके रुकने पर बंद हो जाता है। look_at_target हमेशा चलता है।
scale
"scale": "q.is_baby ? 0.5 : 1.2"यह सिर्फ़ बदलता है कि मॉब कैसा दिखता है। बिहेवियर पैक में सेट किया गया उसका collision box उतना ही रहता है। Vanilla चमगादड़ (bats) अपना मॉडल छोटा करने के लिए "0.35" इस्तेमाल करते हैं।
pre_animation
"pre_animation": [
"v.is_angry = q.property('wiki:mood') == 'angry';"
]हर जगह एक ही लंबा expression दोहराने की जगह, यहाँ एक बार वैल्यू निकालें और कई animations में v.is_angry इस्तेमाल करें।
spawn_egg
spawn_egg के बिना creative inventory में मॉब का कोई egg नहीं होता। इसे बनाने के दो तरीके हैं।
दो रंग। गेम background रंग और धब्बों वाला एक standard egg बनाता है:
"spawn_egg": {
"base_color": "#9b111e",
"overlay_color": "#f4c2c2"
}आपकी अपनी तस्वीर। item_texture.json का एक छोटा नाम इस्तेमाल करें, बिल्कुल आइटम icon की तरह (आइटम textures देखें):
"spawn_egg": {
"texture": "wiki_ruby_golem_egg"
}अगर उस छोटे नाम में कई textures की लिस्ट है, तो एक चुनने के लिए "texture_index" जोड़ें। यह 0 से शुरू होता है। Egg के लिए बिहेवियर पैक में "is_spawnable": true और lang फ़ाइल में एक नाम भी चाहिए:
entity.wiki:ruby_golem.name=Ruby Golem
item.spawn_egg.entity.wiki:ruby_golem.name=Ruby Golem Spawn Eggदूसरी fields
| Field | यह क्या करती है |
|---|---|
enable_attachables | true करने पर attachables से मॉब पर कवच और हाथ में पकड़े आइटम दिखते हैं |
hide_armor | true करने पर मॉब का पहना कोई भी कवच छिप जाता है |
held_item_ignores_lighting | true करने पर हाथ में पकड़े आइटम अंधेरे में भी पूरी रोशनी में दिखते हैं |
locators | मॉडल पर नाम वाले बिंदु, जैसे जहाँ lead (पट्टा) जुड़ता है |
particle_effects | Particles के छोटे नाम, animations में इस्तेमाल के लिए |
sound_effects | साउंड के छोटे नाम, animations में इस्तेमाल के लिए |
min_engine_version | यह फ़ाइल तभी लोड करें जब पैक इस game version या उससे नए को target करता हो |
जब कुछ गड़बड़ हो
| आपको क्या दिखता है | सबसे संभावित वजह |
|---|---|
| मॉब अदृश्य है, सिर्फ़ परछाई दिखती है | identifier बिहेवियर पैक से मेल नहीं खाता, या geometry का नाम गलत है |
| बैंगनी और काले चौखाने | Texture का path गलत है, या उसके आखिर में .png है |
| छेद पारदर्शी की जगह काले दिखते हैं | entity की जगह entity_alphatest इस्तेमाल करें |
| कोई animation कभी नहीं चलता | वह animations में है लेकिन scripts.animate या किसी controller में नहीं |
| कोई spawn egg नहीं | spawn_egg नहीं है, या बिहेवियर पैक में is_spawnable false है |
| Texture कभी नहीं बदलता | Property में "client_sync": true नहीं है |
ज़्यादा मदद Troubleshooting में है। मॉब बनाने की पूरी walkthrough के लिए आपका पहला custom मॉब देखें।