mojira.dev
MC-226686

Waterlogged floating candles break when the water is removed

Steps to reproduce:

  1. Place candles on a block

  2. Remove the block under the candles so that they float in the air

  3. Waterlog the candles by using a water bucket on them

  4. Remove the source water block, for example with an empty bucket or a sponge

Result:
The candles are broken and they drop as items.

Expected result:
Only the water is removed, and the candles stay in the air.

Code analysis:
Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 9

Can confirm. Also affects 1.17 Pre-release 3.

Can confirm in 1.17.

Can confirm in 1.17.1.

Can confirm in 1.18.1.

Can confirm in 1.18.2.

Can confirm in 1.19.

Can confirm in 1.19.1.

I can confirm this behavior in 1.19.2. This problem can also be seen when water is removed from waterlogged candles that have non-solid blocks below them, such as honey blocks and leaves.

Here's a code analysis regarding this issue along with a fix.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.

net.minecraft.world.level.block.CandleBlock.java

public class CandleBlock extends AbstractCandleBlock implements SimpleWaterloggedBlock {
   ...
   public boolean canSurvive(BlockState blockState, LevelReader levelReader, BlockPos blockPos) {
      return Block.canSupportCenter(levelReader, blockPos.below(), Direction.UP);
   }
   ...

Looking above, we can see that the canSurvive() method is present within the CandleBlock.java class. This method basically restricts candles from being able to be placed unless certain requirements are met. In this particular case, only one requirement is needed, and this is that the block below the desired location of placement must be solid and able to support the center of a candle block. Since blocks such as air and leaves are not considered solid, candles cannot be placed on top of these blocks.

So why is this relevant? Well basically, every time the block state of a candle changes, the canSurvive() method is called and checks if the block below the candle is still solid and still able to support its center. If it is, the candle will not be destroyed, but if it isn't, the candle will be destroyed, thus resulting in this problem occurring.

Fix:

Simply removing the canSurvive() method from the CandleBlock.java class will prevent waterlogged candles that are floating or have non-solid blocks below them from being destroyed when the water within them is removed, thus fixing this issue.

i can confirm in 1.19.3 and 23w04a

Seemmetor

(Unassigned)

Confirmed

Gameplay

Low

Block states

1.17 Pre-release 1, 1.17 Pre-release 3, 1.17 Release Candidate 1, 1.17, 1.17.1, ..., 1.19.3, 23w04a, 1.19.4, 23w14a, 1.20.1

Retrieved