1.9 KiB
1.9 KiB
Jade.js — restoreLayerStep() (satır 509)
Parça 1/2 · sonraki
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");
if (blocks === null || idList === null || currentY === null || maxY === null) {
return;
}
if (currentY > maxY) {
// Tamamen bittiğinde zafer sesi ve bitiş partikülleri
world.playSound("minecraft:entity.player.levelup", cx, cy, cz, 2.5, 1.2);
spawnSpellParticle(world, SPELL_CONFIG.PARTICLE_RESTORE_3, cx, cy, cz, 100, 5.0, 5.0, 5.0, 0.1);
spawnSpellParticle(world, SPELL_CONFIG.PARTICLE_RESTORE_1, cx, cy, cz, 50, 4.0, 4.0, 4.0, 0.05);
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) {
var p1 = SPELL_CONFIG.PARTICLE_RESTORE_1;
var p2 = SPELL_CONFIG.PARTICLE_RESTORE_2;
var p3 = SPELL_CONFIG.PARTICLE_RESTORE_3;
var dy = Math.abs(currentY - cy);
var layerRadius = Math.sqrt(SPELL_CONFIG.CRATER_RADIUS * SPELL_CONFIG.CRATER_RADIUS - dy * dy);