The Best Resource for Minecraft
The Best Resource for Minecraft

कस्टम मॉडल डेटा: बिना कुछ बदले एक आइटम को कई मॉडल देना

कस्टम मॉडल डेटा: बिना कुछ बदले एक आइटम को कई मॉडल देना

item-model सिस्टम ने पुराने CustomModelData predicate की जगह ले ली है। यहाँ फ़ोल्डर लेआउट, वह JSON जो मानों को मॉडल से मैप करता है, और आपका टेक्सचर बैंगनी क्यूब के रूप में क्यों दिखता है, यह बताया गया है।

कस्टम आइटम मॉडल सर्वर को एक "जादुई छड़ी" देने की अनुमति देते हैं जो असल में एक अलग मॉडल वाली carrot on a stick होती है। तंत्र बदल गया है, और अधिकांश ट्यूटोरियल अभी भी पुराने का वर्णन करते हैं।

क्या बदला

पुराना तरीका — a predicate block inside the base item's model file, keyed on custom_model_data as a number:

{ "predicate": { "custom_model_data": 1 }, "model": "item/wand" }

वर्तमान तरीका — एक items/ definition that selects a model:

assets/minecraft/items/carrot_on_a_stick.json
{
  "model": {
    "type": "minecraft:range_dispatch",
    "property": "minecraft:custom_model_data",
    "fallback": { "type": "minecraft:model", "model": "minecraft:item/carrot_on_a_stick" },
    "entries": [
      { "threshold": 1, "model": { "type": "minecraft:model", "model": "minecraft:item/wand" } }
    ]
  }
}

The fallback is what a plain carrot on a stick still looks like. Without it, every unmodified one in the world turns into your wand.

फ़ोल्डर लेआउट

pack.mcmeta
assets/minecraft/
├── items/carrot_on_a_stick.json      the dispatch
├── models/item/wand.json             the model
└── textures/item/wand.png            the texture

models/item/wand.json at its simplest:

{ "parent": "minecraft:item/generated", "textures": { "layer0": "minecraft:item/wand" } }

ध्यान दें कि टेक्सचर पाथ में है कोई नहीं textures/ prefix and no .png — यह बैंगनी-और-काले क्यूब का सबसे आम कारण है।

आइटम देना

/give @p carrot_on_a_stick[custom_model_data={floats:[1]}]

कंपोनेंट अब केवल एक पूर्णांक नहीं, बल्कि टाइप की गई सूचियों वाला एक ऑब्जेक्ट लेता है। custom_model_data=1 is the old syntax and silently does nothing.

यह बैंगनी क्यूब के रूप में क्यों दिखता है

संभावना के क्रम में:

  1. टेक्सचर पाथ गलत है — शामिल है textures/ or .png, or the file is not where the

पाथ कहता है।

  1. फ़ाइल नाम केस — खेल केस-संवेदी है, भले ही आपका OS न हो।
  2. pack_format too low — पैक लोड होता है लेकिन items/ folder is ignored. Match

प्रारूप उस संस्करण के अनुसार जिस पर आप हैं।

  1. गलत तरीके से ज़िप किया गयाpack.mcmeta must be at the रूट ज़िप का, इसके अंदर नहीं

ज़िप के अंदर फ़ोल्डर।

अन्य चयनकर्ता

range_dispatch on a number is only one option. You can also dispatch on minecraft:display_context (different model in hand versus in a frame), minecraft:using_item, or minecraft:selected — which is how a bow shows a drawn state.

डिस्पैच JSON, मॉडल फ़ाइल और give कमांड को एक साथ बनाएं Custom Model & Item Component Tools.

टूल आज़माएं: Custom Model & Item Component Tools →