Files

45 lines
1.9 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.
# pirt3.js — runProjectile() (satır 166)
[← pirt3.js](index.md) · [← Master](../../wiki.md)
Parça 3/6 · [önceki](runProjectile-2.md) · [sonraki](runProjectile-4.md)
```javascript
if (by > maxY) maxY = by;
}
}
}
}
}
}
// Zamanlayıcı NBT sınırlarını aşmak için sunucu durumuna JSON olarak kaydediyoruz
var restoreId = "restore_" + shooterUUID + "_" + cx + "_" + cy + "_" + cz + "_" + Date.now();
var serverStates = c.getServer().getStates();
serverStates.setString(restoreId + "_blocks", JSON.stringify(blocks));
serverStates.setString(restoreId + "_idList", JSON.stringify(idList));
// Script event durumuna basit değerleri güvenle kaydet
c.setValue("restoreId", restoreId);
c.setValue("currentRestoreY", minY);
c.setValue("maxRestoreY", maxY);
c.setValue("hitCx", cx);
c.setValue("hitCy", cy);
c.setValue("hitCz", cz);
c.setValue("craterRadius", radius);
// 2. Krateri o bölgede temizle (Patlama oyuğu oluşturur - otomatik onarılacak)
for (var dx = -radius; dx <= radius; dx++) {
for (var dy = -radius; dy <= radius; dy++) {
for (var dz = -radius; dz <= radius; dz++) {
if (dx*dx + dy*dy + dz*dz <= rSq) {
var bx = cx + dx;
var by = cy + dy;
var bz = cz + dz;
if (by >= 0 && by <= 255) {
var state = world.getBlock(bx, by, bz);
if (state !== null && !state.isAir()) {
world.removeBlock(bx, by, bz);
}
```