The bug
Experience orbs don't collide with flowing lava correctly. They act as if the lava is a full block.
To reproduce
Place down lava using a lava bucket.
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
is duplicated by 1
Attachments
Comments 4
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.17.1.