62 lines
1.9 KiB
Markdown
62 lines
1.9 KiB
Markdown
# patlamaduzelt.js — save() (satır 131)
|
||
|
||
[← patlamaduzelt.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 2/3 · [önceki](save.md) · [sonraki](save-3.md)
|
||
|
||
```javascript
|
||
idList.push(id);
|
||
}
|
||
|
||
blocks.push(bx);
|
||
blocks.push(by);
|
||
blocks.push(bz);
|
||
blocks.push(idIdx);
|
||
blocks.push(state.getMeta());
|
||
|
||
if (by < minY) minY = by;
|
||
if (by > maxY) maxY = by;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (blocks.length > 0) {
|
||
var historyKey = "craters_jasb";
|
||
var history = [];
|
||
if (serverStates.has(historyKey)) {
|
||
try {
|
||
history = JSON.parse(serverStates.getString(historyKey));
|
||
} catch(e) {
|
||
history = [];
|
||
}
|
||
}
|
||
|
||
// Yeni bölge kaydını ekle
|
||
var newCrater = {
|
||
cx: cx,
|
||
cy: cy,
|
||
cz: cz,
|
||
minY: minY,
|
||
maxY: maxY,
|
||
radius: radius,
|
||
blocks: blocks,
|
||
idList: idList
|
||
};
|
||
|
||
history.push(newCrater);
|
||
|
||
// Son 15 bölgeyi sakla (hafıza şişmesini önlemek için)
|
||
if (history.length > 15) {
|
||
history.shift();
|
||
}
|
||
|
||
serverStates.setString(historyKey, JSON.stringify(history));
|
||
|
||
player.send("§a[Hafıza] §fBulunduğunuz bölgedeki bloklar başarıyla hafızaya kaydedildi! (Yarıçap: " + radius + " blok)");
|
||
world.playSound("minecraft:entity.experience_orb.pickup", pos.x, pos.y + 1.0, pos.z, 1.2, 1.0);
|
||
} else {
|
||
```
|