54 lines
1.8 KiB
Markdown
54 lines
1.8 KiB
Markdown
# chroma_trail.js — startLoop() (satır 438)
|
||
|
||
[← chroma_trail.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 5/8 · [önceki](startLoop-4.md) · [sonraki](startLoop-6.md)
|
||
|
||
```javascript
|
||
var n = [[1, 0, 0], [-1, 0, 0], [0, 0, 1], [0, 0, -1], [0, -1, 0]];
|
||
for (var i = 0; i < n.length; i++) {
|
||
var b = w.getBlock(x + n[i][0], y + n[i][1], z + n[i][2]);
|
||
if (b && NEIGH_SKIP[String(b.getBlockId())]) return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
function tryPlace(w, dim, x, y, z, k, ts, t) {
|
||
var cur = w.getBlock(x, y, z);
|
||
if (!cur || cur.isAir() || !cur.isOpaque()) return;
|
||
if (cur.isSame(ts)) return;
|
||
var id = String(cur.getBlockId());
|
||
if (ORIG_SKIP[id]) return;
|
||
if (w.hasTileEntity(x, y, z)) return;
|
||
|
||
// Ustunde cicek/cimen/mesale/ray varsa degistirme: altindaki blok
|
||
// degisince bunlar kopup esya olarak duser
|
||
var above = w.getBlock(x, y + 1, z);
|
||
if (above && !above.isAir()) return;
|
||
|
||
if (FALLING[id]) {
|
||
var below = w.getBlock(x, y - 1, z);
|
||
if (!below || !below.isOpaque()) return; // geri konunca dusmesin
|
||
}
|
||
if (neighborBlocked(w, x, y, z)) return;
|
||
|
||
w.setBlock(ts, x, y, z);
|
||
if (!w.getBlock(x, y, z).isSame(ts)) return; // yazi tutmadiysa kaydetme
|
||
|
||
var it = {
|
||
k: k, dim: dim, x: x, y: y, z: z,
|
||
id: id, meta: cur.getMeta(), ps: ts, pid: String(ts.getBlockId()), pmeta: ts.getMeta(),
|
||
t: t, dead: false
|
||
};
|
||
queue.push(it);
|
||
mine[k] = it;
|
||
claims.put(k, token);
|
||
live++;
|
||
changed();
|
||
placedNow = true;
|
||
}
|
||
|
||
function placeUnder(pp, st, t) {
|
||
if (!pp.isOnGround()) return; // havada: koyma
|
||
```
|