Second Hand
On this page(6)
An enchant with mode: second-hand gives the player a passive copy of their sword. It floats beside them while they fight in a zone. When the enchant procs, it darts out, curves onto the target, hits it and jumps on to the next mobs.
modules/sword/enchants/second-hand.yml (shipped)
display-name: '&b&lSecond Hand'
max-level: 100
chance: { min: 2, max: 20 }
trigger: swing
cooldown-ticks: 10
cost: { currency: souls, starting-cost: 500, increase-cost-by: 250 }
mode: second-hand
follow:
side: 0.9
back: 0.35
height: 1.5
stiffness: 0.18
damping: 0.78
sway: 0.12
rest-pose: look
bob: 0.08
bob-speed: 0.12
face-speed: 0.05
max-turn: 60
scale: 1
glow: none
dash:
speed: 1.2
turn-rate: 12
targets: 3
chain-radius: 6
pass-through: 1.5
damage: '{damage}'
proc-enchants: { mode: blacklist, enchants: [] }
# Optional: these run on each mob the copy hits.
actions:
- { type: particle, particle: CRIT, at: '{target_center}', count: 12, spread: '0.3, 0.4, 0.3', speed: 0.3 }
- { type: sound, sound: ENTITY_PLAYER_ATTACK_SWEEP, at: '{target_pos}', pitch: 1.3 }When the copy shows
The copy floats beside the player (only they see it) while all of these hold:
- they have level 1 or more in the enchant (with several second-hand enchants, the first by id);
- they own a sword tier (the sword does not need to be in their hand);
- they stand in a zone: in the columns of its mob area, widened by
mobs.leave-area-distance.
Outside the zone it goes, and it comes back when they return. It also goes on a world change, a far teleport, a respawn, a reload or a module switch off. It shows again on the next check, every half second.
With Enchant Entities off in /settings the player no longer sees it, but it follows, dashes and
hits the same.
How a dash works
- The enchant procs on a swing. It rolls only while the copy follows the player, so its cooldown never starts for nothing.
- The copy darts up and out, then curves onto the target. It turns at most
dash.turn-ratedegrees per tick, up todash.speed. - It hits the mob for
dash.damage. Withdash.targetsabove 1 it jumps on to the nearest living mob it has not hit yet. That mob must be withindash.chain-radiusof the last one. - After the last mob it flies
pass-throughblocks on, and the spring brings it back. - A jump that does not arrive within 3 seconds ends the dash.
Each hit counts as an extra swing. The player's other swing enchants can proc from it, and their kill enchants when it kills. It never procs a second hand or an enchant with a proc-enchants
action, so there is no loop. Then the enchant's own actions run, if it has any, with
{target_pos} on the mob hit.
trigger: kill does not apply to a second hand: it is a warning and reads as swing.
follow: how it floats
It follows on a spring: it is pulled toward a point beside the player, turned with their facing. A step is 2 ticks.
| Key | Default | Range | What it does |
|---|---|---|---|
follow.side | 0.9 | -4 to 4 | Blocks to your right (negative = left) |
follow.back | 0.35 | -4 to 4 | Blocks behind you (negative = in front) |
follow.height | 1.5 | -1 to 4 | Blocks above your feet |
follow.stiffness | 0.18 | 0.01 to 1 | How hard the spring pulls it to its place |
follow.damping | 0.78 | 0 to 0.99 | How much speed it keeps each step (lower = calmer) |
follow.sway | 0.12 | 0 to 1 | Blocks it drifts about its place |
follow.model-rotation | '0 90 45' | -36000 to 36000 each | 'yaw pitch roll' that lines the blade up with its flight (a vanilla sword) |
follow.rest-pose | look | look, up | At rest the tip points where you look, or the blade stands up and turns |
follow.rest-spin | 4 | 0 to 45 | Degrees per step it turns at rest (up only) |
follow.bob | 0.08 | 0 to 1 | Blocks it floats up and down |
follow.bob-speed | 0.12 | 0 to 1 | How fast it bobs (radians per step) |
follow.face-speed | 0.05 | 0 to 2 | Blocks per step above which the tip points where it flies (walking is about 0.2) |
follow.max-turn | 60 | 5 to 180 | Degrees per step it turns at most, so the switch is never a snap |
follow.scale | 1 | 0.1 to 4 | The size of the copy |
follow.glow | none | a glow color | Its glow (none or false = none) |
follow.model | none | a model | Shown instead of the sword. An item model keeps the flight rotations; an engine model turns with the hand and plays its attack animation on each dash. Without its engine, the sword |
dash: how it attacks
| Key | Default | Range | What it does |
|---|---|---|---|
dash.speed | 1.2 | 0.2 to 4 | Blocks per tick, its top speed |
dash.turn-rate | 12 | 1 to 45 | Degrees per tick it turns toward the mob (lower = wider curves) |
dash.targets | 1 | 1 to 10 | Mobs hit per dash (a whole number) |
dash.chain-radius | 6 | 1 to 32 | Blocks from the last mob hit to the next one |
dash.pass-through | 1.5 | 0 to 6 | Blocks past the last mob |
dash.damage | '{damage}' | an expression | Each hit ({damage} = the swing that procced it). A dash with no damage does not proc |
dash.proc-enchants | every enchant | mode, enchants | Which of your enchants its hits may proc: { mode: blacklist | whitelist, enchants: [ids] } |
A number out of range is clamped, and one that is not a number takes its default, each with one warning.
Custom sword models
The default model-rotation fits a vanilla sword. For a sword with a model of its own, find the
rotation in game:
/dungeons admin sword handrotation <yaw> <pitch> <roll>It turns the copy on your own hand until a reload or a quit. When the tip points forward, write
those three numbers in follow.model-rotation.
Testing
/dungeons admin sword testenchant <player> <enchant> on a second-hand enchant shows the hand for 15 seconds anywhere, even without a level. It dashes on the next swing. The
player must be online and own a sword tier.
Its placeholders, menu tiles and price work like any enchant.