53 lines
1.8 KiB
Markdown
53 lines
1.8 KiB
Markdown
# patlamaduzelt.js — restoreLayerStep() (satır 237)
|
||
|
||
[← patlamaduzelt.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 1/2 · [sonraki](restoreLayerStep-2.md)
|
||
|
||
```javascript
|
||
function restoreLayerStep(c) {
|
||
var world = c.getWorld();
|
||
var blocks = c.getValue("blocksToRestore");
|
||
var idList = c.getValue("blocksIdList");
|
||
var currentY = c.getValue("currentRestoreY");
|
||
var maxY = c.getValue("maxRestoreY");
|
||
var cx = c.getValue("hitCx");
|
||
var cy = c.getValue("hitCy");
|
||
var cz = c.getValue("hitCz");
|
||
var radius = c.getValue("craterRadius");
|
||
|
||
if (blocks === null || idList === null || currentY === null || maxY === null || cx === null || cy === null || cz === null) {
|
||
return;
|
||
}
|
||
|
||
if (currentY > maxY) {
|
||
// Tamamen bittiğinde zafer sesleri ve görkemli bitiş partikülleri
|
||
world.playSound("minecraft:entity.player.levelup", cx, cy + 2.0, cz, 2.5, 1.25);
|
||
world.playSound("minecraft:block.portal.travel", cx, cy + 2.0, cz, 1.5, 1.45);
|
||
|
||
var pType = mappet.getParticleType(RESTORE_CONFIG.PARTICLE_HEAL_2);
|
||
if (pType !== null) {
|
||
world.spawnParticles(pType, false, cx, cy + 1.0, cz, 150, radius * 0.7, 4.0, radius * 0.7, 0.15);
|
||
}
|
||
return;
|
||
}
|
||
|
||
var countThisLayer = 0;
|
||
var len = blocks.length;
|
||
for (var i = 0; i < len; i += 5) {
|
||
var by = blocks[i + 1];
|
||
if (by === currentY) {
|
||
var bx = blocks[i];
|
||
var bz = blocks[i + 2];
|
||
var idIdx = blocks[i + 3];
|
||
var meta = blocks[i + 4];
|
||
|
||
var state = mappet.createBlockState(idList[idIdx], meta);
|
||
world.setBlock(state, bx, by, bz);
|
||
countThisLayer++;
|
||
}
|
||
}
|
||
|
||
if (countThisLayer > 0) {
|
||
```
|