mojira.dev
MC-226961

Experience Orbs treat flowing lava as a full block

The bug

Experience orbs don't collide with flowing lava correctly. They act as if the lava is a full block.

To reproduce

  1. Place down lava using a lava bucket.

  2. Set a repeating command block to summon experience orbs above flowing lava.

Observed results

The experience orbs float around in the air as if the flowing lava was a full block.

Image

[media]

Code analysis

Code analysis can be found in this comment.

Linked issues

Attachments

Comments 4

Can confirm in 1.17.1.

I am also able to confirm that this is an issue.

This does not relate to MC-167712
This bug is due to an issue in the experience orb code.

Experience orbs doing something called a `pop` when they touch lava. Basically, the experience orb pops out of the lava right before it dies. The problem is that the pop only checks if it's in a lava block (the full block), and the pop gives upwards velocity. So if the experience orb touches a flowing lava block, it does the pop effect before it actually touches lava. Making it so that the experience orb never burns in flowing lava.
We fix this by simply checking if the experience orb is actually within the lava. We can do this the same way that we check if the experience orb is in water:

Code Analysis - Yarn Mappings 1.18 - ExperienceOrbEntity.java

public void tick() {
    //...
    if (this.world.getFluidState(this.getBlockPos()).isIn(FluidTags.LAVA)) {
        this.setVelocity((double)((this.random.nextFloat() - this.random.nextFloat()) * 0.2F), 0.20000000298023224D, (double)((this.random.nextFloat() - this.random.nextFloat()) * 0.2F));
    }
    //...
}

The Fix:

public void tick() {
    //...
    if (this.isSubmergedIn(FluidTags.LAVA)) {
        this.setVelocity((double)((this.random.nextFloat() - this.random.nextFloat()) * 0.2F), 0.20000000298023224D, (double)((this.random.nextFloat() - this.random.nextFloat()) * 0.2F));
    }
    //...
}

 

 

Can confirm in 1.18.1.

PR0CESS

(Unassigned)

Confirmed

Entities

experience_orb, flowing_lava

1.16.5, 1.17 Pre-release 2, 1.17, 1.17.1, 1.18, ..., 22w11a, 22w14a, 22w17a, 1.19.1 Pre-release 5, 24w39a

Retrieved