Files

49 lines
1.4 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.
# Grim.js — applyBlockbusterSkin() (satır 480)
[← Grim.js](index.md) · [← Master](../../wiki.md)
```javascript
function applyBlockbusterSkin(nbt, url) {
var skin = null;
try { skin = nbt.get("Skin"); } catch (e1) {}
if (skin && skin.isList && skin.isList()) {
var list = nbt.getList("Skin");
if (list.size() > 0) {
var rawArray = [];
try { rawArray = list.toArray(); } catch (e2) {}
var index = findSkinPathIndex(list, rawArray);
var raw = rawArray[index];
if (getNbtType(raw) === 8) {
list.setString(index, url);
nbt.setList("Skin", list);
return true;
}
var child = list.getCompound(index);
child.setString("Path", url);
list.setCompound(index, child);
nbt.setList("Skin", list);
return true;
}
var emptyChild = mappet.createCompound();
emptyChild.setString("Path", url);
list.addCompound(emptyChild);
nbt.setList("Skin", list);
return true;
}
if (skin && String(skin).length > 0 && skin.isCompound && skin.isCompound()) {
skin.setString("Path", url);
nbt.setCompound("Skin", skin);
return true;
}
nbt.setNBT("Skin", '[{Path:"' + escapeNBT(url) + '"}]');
return true;
}
```