Overview
The melee system:- Cancels vanilla damage - Replaces default Minecraft melee with custom system
- Attack multiplier - Scales damage by attack cooldown percentage
- Moveset integration - Detects weak hits, crits, sprint attacks, uppercuts, and aerial attacks
- Vanilla knockback - Replicates Minecraft’s exact knockback behavior
- Ground detection - Different knockback for grounded vs airborne targets
Basic Usage
melee_core.yml:5
Melee Start
The entry point that cancels vanilla damage and sets up the attack:melee_core.yml:12
Key Features
- cancelEvent - Prevents vanilla damage from applying
- attack_cooldown scaling - Uses
<caster.attack_cooldown>to scale damage (0.0-1.0) - knockback_direction - Sets forward direction for knockback
- Moveset detection - Automatically detects attack type
Attack Types
The moveset system detects different attack types:| Type | Trigger | Damage | Knockback |
|---|---|---|---|
| Sweep | Full charge + multiple targets | 100% | Weak |
| Weak | Partial charge | 100% | Weak |
| Sprint | Sprinting | 100% | Strong |
| Critical | Falling + full charge | 150% | Weak + effects |
| Uppercut | Looking up | 100% | Vertical launch |
| Aerial | In air | 150% | Strong + air chase |
Damage Variants
Sweep Attack
melee_core.yml:28
Weak Attack
melee_core.yml:33
Sprint Attack
melee_core.yml:39
Critical Attack
melee_core.yml:44
Uppercut Attack
melee_core.yml:53
Aerial Attack
melee_core.yml:60
Knockback Variants
All knockback variants use vanilla-accurate values:Weak Knockback
melee_core.yml:82
kb=1.25, kby=0.75 (slight upward launch)
Airborne: kb=1.25, kby=-0.75 (push downward)
Strong Knockback
melee_core.yml:88
kb=1.5, kby=0.75 (stronger horizontal)
Airborne: kb=1.5, kby=-0.75 (stronger push down)
Critical Knockback
melee_core.yml:95
Uppercut Knockback
melee_core.yml:100
kb=1.25, kby=1.6 (strong vertical launch)
Ground Detection
Knockback changes based on whether the target is on the ground:- Grounded: Positive
kby(launch upward) - Airborne: Negative
kby(push downward)
Origin Point
Knockback origin is set to the horizontal position of the attacker at the vertical position of the target:Attack Cooldown Scaling
Damage scales with Minecraft’s attack cooldown:melee_core.yml:17
<caster.attack_cooldown>= 0.0 to 1.0 (0% to 100% charged)- Partial swings deal reduced damage
- Full charge deals 100% damage
Knockback Denial
Targets with thedenykb aura resist knockback:
melee_core.yml:69
Example: Custom Melee Weapon
Example: Melee with Custom Damage
Example: Disable Knockback
Switch-Based Knockback
The handler includes a switch-based knockback system:melee_core.yml:69
Vanilla Parity
The melee core achieves 1:1 vanilla behavior by:- Canceling vanilla damage - Prevents double damage
- Attack cooldown scaling - Matches vanilla charge system
- Exact knockback values - Replicates vanilla knockback strength
- Ground detection - Matches vanilla airborne knockback behavior
- Critical effects - Uses vanilla crit animation (playAnimation 4)
- Sound effects - Uses vanilla attack sounds
Integration with Other Systems
Damage Core
Usesdamage-weapon for weapon-tagged damage:
Knockback Core
Uses the knockback handler for physics:Spell Handler
Wrapped in the spell system for consistency:Related Systems
- Damage Core - Handles weapon damage calculation
- Knockback Core - Physics-based knockback system
- Spell Casting Handler - Wraps melee in spell framework