Sword Block 1.8 ViaVersion inaccurate
MeFisto94 opened this issue ยท 4 comments
Information
- Server Version: Paper 1.15.2
- OldCombatMechanics version: 1.8.1
- Server Log File: Unfortunately the debug log isn't in the logfile, only for the players.
- OldCombatMechanics config file: default
Problem Description
Sword Blocking with ViaVersion depends on the client version.
We've disabled the shield functionality from via-version.
When joining with a 1.8 client, incoming damage is possible (it logs EntityDamageByEntityListener).
When joining with an 1.15.2 client, incoming damage is completely absorbed by the armor. When not wearing armor, I get the damage which is exactly 50% of the incoming damage (ShieldDamageReduction applied, but the EntityDamageByEntityListener does not print).
What I guess happens is that for the 1.8 client, the armor is reducing the damage before the shield reduction is applied or anything.
To Reproduce
Steps to reproduce the behavior:
Try to hit eachother with 1.8.8 and 1.15.2 while being sword blocked.
Hitting an 1.8 player from 1.15.2:
Hitting an 1.15.2 player from 1.8:
Expected Behaviour
Actual Behaviour
See Problem Description
Sorry for the bad problem description, we try to dig into it ourselves as well.
EDIT:
Debugging showed a lot: The incoming EntityDamageEvent has a different final damage.
For the 1.15.2 player, the following modificators are present:
modifier = BASE double = 14.25
modifier = BLOCKING double = -14.25
modifier = ARMOR double = -0.0
modifier = RESISTANCE double = -0.0
modifier = MAGIC double = -0.0
modifier = ABSORPTION double = -0.0
For the 1.8.8 player, the following modificators are present:
modifier = BASE double = 14.25
modifier = BLOCKING double = -0.0
modifier = ARMOR double = -9.369375228881836
modifier = RESISTANCE double = -0.0
modifier = MAGIC double = -3.1235997676849365
modifier = ABSORPTION double = -0.0
The problem is now I don't know which modifiers are those that OCM needs, I guess the 1.15.2 ones, but I also don't know if I can hijack the event with reflection.
Edit 2:
So blocking is not set for the 1.8.8 player due to via version / our config / something. I need to find out why Armor and Magic are set, though and probably fix that the damage reduction in combination with the armor lead to invulnerability
i'm a little unclear on what to look into here, since it seems you've done a large amount of investigation yourself. can you reproduce this with a minimum setup of just OCM + ViaVersion + your particular configs for the two? if so, could you please share both of those here?
@MeFisto94 the values should be taken server-side, so this seems to be something to do with how ViaVersion is doing things. Also, this plugin was not built for 1.8 and so there is always the possibility of wacky stuff happening there.
So I guess this is reproducable with a default setup of OCM and ViaVersion (that being said ViaVersion needs ViaBackwards and ViaRewind for this to work):
The catch is, we want to provide a 1.8 combat experience, where the users even use 1.8 clients (as opposed to more recent ones). We just want the latest API improvements, peformance and other advancements and thus we don't use an 1.8 server, but an 1.15 one.
So to reiterate:
- 1.9+ (tested with 1.15.2) clients: OCM sets them a shield when sword blocking, so the server is absorbing all the damage and draining the durability of the shield (that's the MC behavior and I think this is a thing where OCM fails: Previous to 1.9 it seems that sword blocking didn't block all damage and also the durability of the shield is useless here).
- 1.8 clients: The sword block is somehow translated by ViaVersion(?) so they have some "random" armor and magic modifiers.
Ideally I'd like to have the 1.8 client behavior also on 1.9+ clients, which means changing the SHIELD modifier somehow. The first priority however is how to get to those magic values/make all clients behave the same, I guess.
OCM recalculates most damages applied to the players, because Bukkit does not provide sufficient APIs to do this kind of thing. So, when blocking with a shield, the damage is reduced as would have happened when sword-blocking in 1.8, and not entirely stopped, as in 1.9. If you find that not to be the case, then it may well be ViaVersion that is interfering.
Also, what exactly do ViaBackwards and ViaRewind do? Could they be the issue?