Files

42 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# potion_rain.js — q() (satır 160)
[← potion_rain.js](index.md) · [← Master](../../wiki.md)
Parça 2/11 · [önceki](q.md) · [sonraki](q-3.md)
```javascript
// =====================================================================
// Blockbuster resim morph'u. angle: billboard'da duzlem ici (Rotation),
// degilse Y ekseni etrafinda (Pose R). anim > 0: onceki kareden yumusak gecis
function imageMorph(k, angle, anim, size) {
var s = fx3(size) + "f";
var nbt = '{Name:"blockbuster.image",Texture:' + q(k.tex) + ',ForcedSettings:0b';
if (k.billboard) {
nbt += ',Billboard:1b,FacingMode:"lookat_xyz",RemoveParentSpace:1b,Rotation:' + fx3(angle) + 'f' +
',Pose:{S:[' + s + ',' + s + ',' + s + ']}';
} else {
nbt += ',Pose:{S:[' + s + ',' + s + ',' + s + '],R:[0f,' + fx3(angle) + 'f,0f]}';
}
nbt += anim > 0 ? ',Animation:{Animates:1b,Duration:' + anim + ',Interp:0}' : ',Animation:{Animates:0b}';
return nbt + '}';
}
// Donen resim: 0 (aninda) -> 90 -> 180 -> 270 -> 360 (yumusak), dongu.
// 360'tan 0'a gecis animasyonsuz oldugu icin geri donus olmaz.
function spinMorph(k, size) {
var list = ['{Morph:' + imageMorph(k, 0, 0, size) + ',Duration:1f}'];
for (var i = 1; i <= 4; i++) {
list.push('{Morph:' + imageMorph(k, i * 90, SPIN_STEP_TICKS, size) + ',Duration:' + SPIN_STEP_TICKS + 'f}');
}
return '{Name:"sequencer",List:[' + list.join(',') + '],Loop:1b}';
}
// Tur icin morph NBT'si (rastgele egim mermi Transform'unda)
function morphFor(k, cfg) {
if (k.type === "image") return cfg.spin ? spinMorph(k, cfg.size) : imageMorph(k, Math.random() * 360, 0, cfg.size);
if (k.type === "skin") return '{Name:"blockbuster.fred",Skin:' + q(cfg.skin) + '}';
if (k.type === "custom") return cfg.morph;
return k.morph;
}
```