The Bug:
"minecraft.custom:minecraft.walk_under_water_one_cm" doesn't increase when walking through lava.
The diving statistic only counts diving in water and not lava. This can be an annoyance for adventure maps, and also means that hunger will never decrease while the player is diving in lava. Ideally, a new statistic should be created to track walking through lava.
Steps to Reproduce:
Create a scoreboard objective for tracking when you when walk underwater and set it to display on the sidebar by using the commands provided below.
/scoreboard objectives add WalkUnderwaterOneCm minecraft.custom:minecraft.walk_under_water_one_cm
/scoreboard objectives setdisplay sidebar WalkUnderwaterOneCm
Summon a pool of lava by using the command provided below.
/fill ~1 ~ ~1 ~15 ~4 ~15 minecraft:stone
/fill ~2 ~1 ~2 ~14 ~4 ~14 minecraft:lava
Switch to creative mode and begin walking around in the lava.
Take note as to whether or not "minecraft.custom:minecraft.walk_under_water_one_cm" doesn't increase when walking through lava.
Observed Behavior:
The scoreboard doesn't increase.
Expected Behavior:
The scoreboard would increase.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
Comments 9
Confirmed for 1.13.2-pre2. It the current version, it appears as though the statistic's id is now stat.walk_under_water_one_cm
.
The following is based on yarn 1.15.2 pre2 names and MCP 1.12.2 (as for yarn it's just unnamed method).
In the method net.minecraft.entity.player.PlayerEntity.method_7282()
(net.minecraft.entity.player.EntityPlayer.addMovementStat()
for MCP 1.12.2) the if-statement to add the statistic WALK_UNDER_WATER_ONE_CM
it only checks for if the player is submerged in water. To fix this, a check for if the player is submerged in lava should be added with a OR(=||).
else if (this.isSubmergedIn(FluidTags.WATER, true) || this.isSubmergedIn(FluidTags.LAVA, true)) {
int integer8 = ...
if (integer8 > 0) {
this.increaseStat(Stats.WALK_UNDER_WATER_ONE_CM, integer8);
this.addExhaustion(0.01f * integer8 * 0.01f);
}
}
Can confirm for 1.13.1-pre2.