Fix 1.14+ walk animation (#1469)

* Do not send NaN health metadata to 1.14+ clients
* Added config option 'fix-1_14-health-nan'
This commit is contained in:
Lukas 2019-10-01 10:04:58 +02:00 committed by Myles
parent aa9a1df1ab
commit 7e008226ec
7 changed files with 30 additions and 0 deletions

View File

@ -274,4 +274,9 @@ public class BukkitViaConfig extends Config implements ViaVersionConfig {
public boolean isNonFullBlockLightFix() {
return getBoolean("fix-non-full-blocklight", true);
}
@Override
public boolean is1_14HealthNaNFix() {
return getBoolean("fix-1_14-health-nan", true);
}
}

View File

@ -327,4 +327,9 @@ public class BungeeViaConfig extends Config implements ViaVersionConfig {
public boolean isNonFullBlockLightFix() {
return getBoolean("fix-non-full-blocklight", true);
}
@Override
public boolean is1_14HealthNaNFix() {
return getBoolean("fix-1_14-health-nan", true);
}
}

View File

@ -344,4 +344,6 @@ public interface ViaVersionConfig {
* @return True if enabled
*/
boolean isNonFullBlockLightFix();
boolean is1_14HealthNaNFix();
}

View File

@ -39,6 +39,12 @@ public class MetadataRewriter {
if (metadata.getId() > 5) {
metadata.setId(metadata.getId() + 1);
}
if (metadata.getId() == 8 && type.isOrHasParent(Entity1_14Types.EntityType.LIVINGENTITY)) {
final float v = ((Number) metadata.getValue()).floatValue();
if (Float.isNaN(v) && Via.getConfig().is1_14HealthNaNFix()) {
metadata.setValue(1F);
}
}
//Metadata 12 added to living_entity
if (metadata.getId() > 11 && type.isOrHasParent(Entity1_14Types.EntityType.LIVINGENTITY)) {

View File

@ -128,6 +128,8 @@ change-1_9-hitbox: false
change-1_14-hitbox: false
# Fixes 1.14+ clients on sub 1.14 servers having a light value of 0 for non full blocks.
fix-non-full-blocklight: true
# Fixes walk animation not shown when health is set to Float.NaN
fix-1_14-health-nan: true
#
# Enable serverside block-connections for 1.13+ clients
serverside-blockconnections: false

View File

@ -280,4 +280,9 @@ public class SpongeViaConfig extends Config implements ViaVersionConfig {
public boolean isNonFullBlockLightFix() {
return getBoolean("fix-non-full-blocklight", true);
}
@Override
public boolean is1_14HealthNaNFix() {
return getBoolean("fix-1_14-health-nan", true);
}
}

View File

@ -333,4 +333,9 @@ public class VelocityViaConfig extends Config implements ViaVersionConfig {
public boolean isNonFullBlockLightFix() {
return getBoolean("fix-non-full-blocklight", true);
}
@Override
public boolean is1_14HealthNaNFix() {
return getBoolean("fix-1_14-health-nan", true);
}
}