Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Swings per second
- As fast as you can click?
- // Invulnerability
- maxHurtResistance = 20
- // It looks like you can get hurt again before the half way point if it does more damage than the previous attack
- // It doesn't reset the invuln. timer though
- // Knockback on attack
- knockback = 0
- if ( target instanceof EntityLiving )
- {
- // ...
- knockback += Knockback enchantment level
- }
- if ( sprinting )
- {
- knockback += 1
- }
- if ( total damage > 0 )
- {
- // ...
- // If entity's NBT tag "Invulnerable" is true, there will be no knockback
- // No knockback for the enderdragon
- // No knockback for the wither from arrows in the second stage
- // Probably more exceptions as well
- if ( entity can be knocked back for this damage source )
- {
- x velocity += attacker direction * knockback * 0.5f
- y velocity += 0.1
- z velocity += attacker direction * knockback * 0.5f
- x velocity *= 0.6;
- z velocity *= 0.6;
- }
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement