Files

64 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.
# kalkan.js — toggleShield() (satır 26)
[← kalkan.js](index.md) · [← Master](../../wiki.md)
Parça 2/3 · [önceki](toggleShield.md) · [sonraki](toggleShield-3.md)
```javascript
var dx = epos.x - cx;
var dy = epos.y - cy;
var dz = epos.z - cz;
var dist = Math.sqrt(dx*dx + dz*dz);
if (e.isLivingBase()) {
if (dist > 0.01 && dist < 3.0) {
e.addMotion((dx / dist) * 1.4, 0.35, (dz / dist) * 1.4);
}
} else {
var em = null;
try {
em = e.getMotion();
} catch (err) {}
if (em && (em.x !== 0 || em.y !== 0 || em.z !== 0)) {
var toMeX = cx - epos.x;
var toMeY = cy - epos.y;
var toMeZ = cz - epos.z;
var dot =
em.x * toMeX +
em.y * toMeY +
em.z * toMeZ;
if (dot > 0.05) {
try {
e.setMotion(
-em.x * 1.8,
-em.y * 1.8 + 0.2,
-em.z * 1.8
);
ww.playSound(
"minecraft:block.glass.break",
epos.x,
epos.y,
epos.z,
1.0,
1.7
);
} catch (e2) {}
}
}
}
}
if (t % 12 === 0) {
ww.playSound(
"minecraft:block.beacon.ambient",
cx,
```