How to change prefab material

Tags: #<Tag:0x00007fa0e4476cd8> #<Tag:0x00007fa0e4476c10>

Other languages: :ru:

How you may know, I spent a lot of time working on “Zendikar Hedrons” prefab. Hedrons is a floating pieces of rock which have octahedron shape. During this process I faced with some troubles and tried to resolve it by nontrivial method.

Here is my ideal visual aim.

Hedrons must be located on different height because in other way it will be too boring. And it must be created from different kind of rocks. So, this necessity begot two problems:

• How to make instances of complicated object with different altitude?
• How to make instances of complicated object of different materials?

I could reassemble every instance for few times. It would required only eleven times more time for each kind of hedrons. But World Builder was very buggy programm, so this task turned impossible - it required infinity time to be completed. Futhermore bigger hedrons are required more efforts to be reassemble.

So I was need to find more easy method passed over World Builder. Any configs from World Builder are stored in .json files like a text. Therefore I decide to tweak prefab contents post factum. Here is a picture with Nyuudles’ tree before and after transformation as illustration of effectivenes of this method:

Below is a screenshot of simple .json file with my hedrons in AkelPad editor.

Here are represented:

  1. Meta structure
  2. Block structure
  3. Size of object
  4. Starting point

Let’s look that bottom-up.

Size and starting point

It’s unlikely what somebody will need to change prefab size. I’ll tell you later why I don’t recommend to do that.

If you will change starting point, all object will move such way. It’s very useful in case when you want have equal object with different altitude. Here you can move it by single number instead of rebuild it from single block.

Block structure of object

This part is more complicated.

Structure data looks as “this quantity of same blocks”. It sense as single string and size of object is needed to reconstruct form. As I understood World Builder unravel this string into the row of blocks and pack it up in box of set size. First of all WB build column from bottom to top at position (0, 0). When high limit is reached, it build neightbour column at (1, 0). When width of object is reached, next column is builded at (0, 1) and go on to whole object will be filled up. If the size will be changed, all reaming of object will be broken.

This letters and numbers follow in groups by four symbols. Every group coded a string of few blocks. It actually isn’t true but the easiest way to understand it like this: first three symbols are mean material and the last one are means quantity.

The simplest one is a quantity but here is a little ruse.
A = 1, B = 2, C = 3, … Z = 26,
a = 27, b = 28, c = 29, … z = 52,
0 = 53, 1 = 54, … 9 = 62, + = 63, / = 64.
And so when quantity of blocks exceed 64 then next to the last symbol are changing to next value: kA = 1, lA = 65, mA = 129, nA = 193. This rule is over after 256. Likely there starts new row of blocks but I didn’t check that.

Note what the next to the last symbol may be different: “k” for blocks and “o” for props ~ approximately. For empty space – air – and three base grass blocks are used another symbols.

[details=Sheet of material codes]AAA - Air
BAA - Verdant Grass Block
BAM - Barbed Grass Block
BAY - Gnarled Grass Block
oQk - Ancient Corruption
mwk - Ash
mQk - Gleam
1Ak - Gleam Lantern
Ggo - Refined Gleam
Gwo - Refined Gleam …
DQo - Natural Crystal
0gk - Dark Glass
dwk - Dark Glass …
/z8 - DEBUG DELETECHUNK
8gk - Door Piece
9Ak - Trapdoor Piece
8wk - Windowed Door Piece
CQo - Flower 1
Cgo - Flower 2
Cwo - Flower 3
DAo - Flower 4
Bwo - Fibrous Plant
CAo - Inky Plant
Mwo - Amantia Fungus
NAo - Bracket Fungus
NQo - Coral Fungus
Nwo - Dripping Fungus
OAo - Glowing Fungus
Ngo - Scatter Fungus
+wk - Chair
+gk - Table
tAk - Compact Ametyst …
tQk - Compact Diamond …
tgk - Compact Emerald …
uAk - Compact Ruby …
uQk - Compact Sapphire …
twk - Compact Topaz …
0Qk - Glass
jgk - Gravel
oAk - Growth
mAk - Ice
Bwk - Glacier
BQo - Ladder
0wk - Lantern
FAo - Amethyst Torch
9wk - Basic Torch
FQo - Diamond Torch
Fgo - Emerald Torch
Ewo - Torch
GAo - Ruby Torch
GQo - Sapphire Torch
Fwo - Topaz Torch
cgk - Compact Copper …
bQk - Refined Copper …
dQk - Compact Gold Alloy …
cAk - Refined Gold Alloy …
cwk - Compact Iron …
bgk - Refined Iron …
dAk - Compact Silver Alloy …
bwk - Refined Silver Alloy …
dgk - Compact Titanium Alloy …
cQk - Refined Titanium Alloy …
nwk - Mould
mgk - Mud
1wk - Slide
1gk - Trampoline
Kgo - Aloe Plant
KQo - Cactus Plant
LAo - Fiddlehead Plant
Jwo - Lotus Plant
Kwo - Snowdrop Plant
KAo - Yucca Plant
LQo - Boulder
ggk - Alphabet Brick
qwk - Glyph Brick
BQk - Igneous Rock
Ygk - Igneous Rock …
gQk - Igneous Brick …
iAk - Decorative Igneous Rock 1
iwk - Decorative Igneous Rock 2
hQk - Refined Igneous Rock
ZQk - Refined Igneous Rock …
fQk - Igneous Stone
EAo - Igneous Stone …
BAk - Metamorphic Rock
YQk - Metamorphic Rock …
gAk - Metamorphic Brick …
hwk - Decorative Metamorphic Rock 1
igk - Decorative Metamorphic Rock 2
hAk - Refined Metamorphic Rock
ZAk - Refined Metamorphic Rock …
fAk - Metamorphic Stone
Dwo - Metamorphic Stone …
MAo - Rock Ring
Bgk - Sedimentary Rock
Ywk - Sedimentary Rock …
fwk - Sedimentary Brick …
iQk - Decorative Sedimentary Rock 1
jAk - Decorative Sedimentary Rock 2
hgk - Refined Sedimentary Rock
Zgk - Refined Sedimentary Rock …
fgk - Sedimentary Stone
EQo - Sedimentary Stone …
MQo - Rock Shard
Lwo - Rock Stack
Mgo - Stalagmite
Lgo - Tall Rock
jQk - Sand
AgA - Clay Soil
egk - Compact Clay
AwA - Peaty Soil
ewk - Compact Peat
AQA - Silty Soil
eQk - Compact Silt
wwk - Compact Blink …
xAk - Compact Dark Matter …
xQk - Compact Oort Stone …
wgk - Compact Rift …
nAk - Sponge
nQk - Tangle
ngk - Thorns
lgk - Ancient Wood Timber
awk - Ancient Wood Timber …
kgk - Ancient Wood Trunk
aAk - Ancient Wood Trunk …
kAk - Exotic Leaves
jwk - Lush Leaves
lwk - Lustrous Wood Timber
bAk - Lustrous Wood Timber …
lAk - Lustrous Wood Trunk
aQk - Lustrous Wood Trunk …
lQk - Twisted Wood Timber
agk - Twisted Wood Timber …
kwk - Twisted Wood Trunk
Zwk - Twisted Wood Trunk …[/details]

So now you know what “mAkT” means twenty ice blocks. If you change material code in prefab data sufficiently accurately from one to other, you can transform lead to gold in a literal sense!
Except that here in :boundless: lead aren’t exist :smiley:

Well let’s see how looks the prefab which text data are represented above:

Metastructure

This part is the most complicated. Generally it describes sloped blocks but not only that.

There in list above where is “…” it means what coded not full block itself but its derivatives - slabs, stairs and walls. Configuration of concrete block is determined by meta.

Here is examples of derevatives’ meta:

  • BAA - Slab
  • DAA - Slab x2
  • UAA - Stairs
  • IAA - Wall
  • yAA - Door part
  • QAA - Trapdoor part

Other variants have to investigate more detailed.

However, besides slopes and derivatives meta also determine orientation of blocks, long grass presence and possibly even more. I had a feeling what it need to be readed at three symbols per group instead of four. But this hypothesis have to futher research because structure of meta a lot complicated then blocks structure. And meta might be just nonlinear, who knows.

Conclusion

When I worked on the Nyuudles’ tree I faced with few challenges. Be careful when you change materials this way.

Please, note:

  • Not each material can be sloped.
  • Not each material have derivatives like slabs, stairs and walls.
  • Strings you try to replace may be found between groups, particularly if it’s something like" kQk".
  • You always must to have backup copy of file.

And finally codes for slopes are equal to codes of derivatives of unslopable blocks, but derivatives of slopable blocks have another material code.

But if you just need to replace sedimentary rock to igneous or lush leaves to waxy this method will show itself very useful for such task. :wink:

8 Likes