1.9 KiB
1.9 KiB
kalkan.js — toggleShield() (satır 26)
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,