The Best Resource for Minecraft
The Best Resource for Minecraft

एक .nbt संरचना पैलेट इंडेक्स स्टोर करती है, ब्लॉक नाम नहीं — यही कारण है कि यह इतनी छोटी होती है

एक .nbt संरचना पैलेट इंडेक्स स्टोर करती है, ब्लॉक नाम नहीं — यही कारण है कि यह इतनी छोटी होती है

तीन कुंजियाँ पूरे निर्माण को रखती हैं: size, palette और blocks। प्रत्येक ब्लॉक पैलेट की ओर इंगित करने वाला एक पूर्णांक है, इसलिए पत्थर के 32³ आयतन के लिए एक स्ट्रिंग और 32,768 संख्याएँ लगती हैं।

A .nbt structure file — the thing a structure block saves and a datapack ships — is a much simpler format than it looks from the outside. Everything a build needs sits in a handful of top-level keys, and one design decision explains why the files are as small as they are.

तीन कुंजियाँ जो निर्माण को संभालती हैं

size     [x, y, z]                       — a list of exactly three integers
palette  [ { Name, Properties } … ]      — every DISTINCT block state, once
blocks   [ { pos, state, nbt } … ]       — one entry per placed block

palette holds each distinct block state exactly once. एक प्रविष्टि है Name — the block id, like minecraft:oak_stairs — plus an optional Properties compound holding its blockstate, such as facing: north and half: bottom.

blocks never repeats a name. प्रत्येक प्रविष्टि में होता है एक pos of three integers and a state, and state is an पैलेट में इंडेक्स, ब्लॉक id नहीं। उत्तर की ओर मुंह वाली ओक की सीढ़ियाँ एक बार स्ट्रिंग डेटा होती हैं, और उसके बाद उनमें से प्रत्येक एक छोटा पूर्णांक होती है।

यही पूरी तरकीब है। सादे पत्थर का 32 × 32 × 32 आयतन एक पैलेट प्रविष्टि और 32,768 इंडेक्स संख्याएँ हैं — शब्द की 32,768 प्रतियाँ नहीं minecraft:stone. The palette grows with how many अलग-अलग चीजें जिनसे आपने निर्माण किया, और ब्लॉक सूची इस बात से बढ़ती है कि कितना बड़ा आपने निर्माण किया। वे बहुत अलग संख्याएँ हैं, और उनमें से केवल एक ही आमतौर पर बड़ी होती है।

दो परिणाम जिनके अनुसार डिज़ाइन करना उपयोगी है

Blockstates आपके पैलेट को बढ़ाते हैं, आपकी ब्लॉक सूची को नहीं। ओक की सीढ़ियाँ सिर्फ एक पैलेट प्रविष्टि नहीं हैं — वे आपके द्वारा वास्तव में उपयोग किए गए प्रति ओरिएंटेशन एक होती हैं। चार दिशाओं में मुंह, ऊपर और नीचे का आधा हिस्सा, सीधी और दोनों भीतरी व बाहरी कोने: एक ही ब्लॉक एक दर्जन पैलेट स्लॉट घेर सकता है। इसलिए बारीक विवरण वाले निर्माण में एक बड़ा पैलेट होता है और सादे निर्माण में नहीं, चाहे आकार कुछ भी हो।

केवल रखे गए ब्लॉकों को ही प्रविष्टि मिलती है। ब्लॉक सूची एक सूची है, कोई सघन 3D सरणी नहीं, और जो प्रविष्टि वहां नहीं है वह बस वहां नहीं है — इस पृष्ठ पर व्यूअर अपने ग्रिड को इससे भरता है -1 and treats a missing coordinate as nothing placed. A hollow build is genuinely cheaper to store than a solid one of the same dimensions.

nbt is per-block and optional

इसमें प्रत्येक प्रविष्टि blocks may carry its own nbt compound, and most do not. This is where a chest's contents, a sign's text, a spawner's mob and a banner's patterns live — attached to the individual block rather than to the palette.

यह अंतर मायने रखता है: palette डेटा साझा किया जाता है और block डेटा नहीं। दो चेस्ट एक पैलेट प्रविष्टि हैं, क्योंकि वे एक ही ब्लॉक स्थिति हैं — लेकिन प्रत्येक अपनी वस्तु-सूची को अपने में अलग रखता है nbt. Change the block state and you touch the palette; change what is inside it and you touch one entry in the block list.

एक समय में एक परत पढ़ना

यहाँ का व्यूअर जानबूझकर 2D है। परत खींचने के लिए y यह ब्लॉक सूची की जांच करता है, उन प्रविष्टियों को रखता है जिनका pos[1] equals y, और प्रत्येक को देखता है state up in the palette. That is the entire algorithm, and it is worth knowing because it is also how you would inspect one of these files yourself: there is no spatial index to build and no decompression beyond the gzip wrapper. The format is a flat list you filter.

जिसका अर्थ यह भी है कि एक संरचना फ़ाइल आपको इसके बारे में कुछ नहीं बताती कि कहाँ यह दुनिया में स्थित है। size is a bounding box and pos values are relative to its corner. The placement is the structure block's business, not the file's.

टूल आज़माएं: Structure & NBT Component Tools →