Shooting enemies will pull them towards you. RIght clicking will allow you to dash, clear nearby nets, and push all nearby players around you
← Back to main
api.giveItem(myId, "Diamond Bow", 1, {
customDisplayName: "Poseidon's Harpoon"
});
const HarpoonCooldowns = {};
onPlayerAltAction = (playerId) => {
const held = api.getHeldItem(playerId);
if (!held || held.name !== "Diamond Bow" || held.attributes?.customDisplayName !== "Poseidon's Harpoon" || !api.isPlayerCrouching(playerId)) return;
const now = Date.now();
const lastUse = HarpoonCooldowns[playerId] || 0;
const cooldown = 25000;
if (now - lastUse < cooldown) {
const s = Math.ceil((cooldown - (now - lastUse)) / 1000);
api.sendMessage(playerId, `Harpoon ready in ${s} seconds!`, { color: "red" });
return;
}
const dir = api.getPlayerFacingInfo(playerId).dir;
const pos = api.getPosition(playerId);
api.setVelocity(playerId, dir[0] * 65, dir[1] * 32.5, dir[2] * 65);
for (let dx = -1; dx <= 1; dx++)
for (let dy = -1; dy <= 1; dy++)
for (let dz = -1; dz <= 1; dz++) {
const bx = Math.floor(pos[0]) + dx;
const by = Math.floor(pos[1]) + dy;
const bz = Math.floor(pos[2]) + dz;
if (api.getBlock(bx, by, bz) === "Net") api.setBlock(bx, by, bz, "Air");
}
for (const otherId of api.getPlayerIds()) {
if (otherId !== playerId) {
const oPos = api.getPosition(otherId);
const dx = oPos[0] - pos[0], dz = oPos[2] - pos[2];
const distSq = dx * dx + dz * dz;
if (distSq <= 25) {
const dist = Math.sqrt(distSq);
const impulseX = (dx / dist) * 30;
const impulseZ = (dz / dist) * 30;
api.applyImpulse(otherId, impulseX, 10, impulseZ);
}
}
}
HarpoonCooldowns[playerId] = now;
};
onPlayerDamagingOtherPlayer = (attacker,victim,damage,withItem) => {
const held = api.getHeldItem(attacker);
const aPos = api.getPosition(attacker);
const vPos = api.getPosition(victim);
if (withItem === "Arrow" && held?.attributes?.customDisplayName === "Poseidon's Harpoon" && aPos && vPos) {
const dx = aPos[0] - vPos[0], dz = aPos[2] - vPos[2];
const dist = Math.sqrt(dx * dx + dz * dz);
if (dist >= 0.5) {
const force = Math.min(Math.max(dist * 3.5, 40), 70);
api.applyEffect(victim, "Frozen", 1000, { inbuiltLevel: 1 });
api.applyImpulse(victim, (dx / dist) * force, 0, (dz / dist) * force);
}
}
if (withItem === "Diamond Bow" && held?.attributes?.customDisplayName === "Poseidon's Harpoon") {
api.applyHealthChange(victim, -damage * 11);
}
};