mojira.dev
MC-122116

"minecraft.custom:minecraft.walk_under_water_one_cm" doesn't increase when walking through lava

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:

  1. 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
  2. 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
  3. Switch to creative mode and begin walking around in the lava.

  4. 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

Can confirm for 1.13.1-pre2.

Can confirm for 1.13.1.

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 in 20w51a.

Can confirm in 21w03a.

Can confirm in 21w05a.

Can confirm in 21w06a.

Can confirm in 21w07a.

wobst.michael

(Unassigned)

Confirmed

Statistics

statistics

Minecraft 1.12.2, Minecraft 17w45b, Minecraft 17w46a, Minecraft 17w47a, Minecraft 17w47b, ..., 21w03a, 21w05b, 21w06a, 21w07a, 1.20.2

Retrieved