mojira.dev
MC-227069

Candles cannot be placed on non-solid blocks

The bug

The player cannot put a candle on a block of foliage just like that, but if you put a candle on any block and break this block (everything will hang in the air), and then put the foliage under the candle, then it works. It is clearly seen in the video.

Code analysis

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

Linked issues

Attachments

Comments 9

Can confirm. You cannot place candles on certain non-solid or non-full blocks. But candles can float, so...

Invalid: the heads have the same behavior.

I can confirm that this is an issue. Also affects 1.17.1. I think what the report is trying to say is that despite candles being able to float, they cannot be placed on top of leaves, unlike several blocks such as turtle eggs, etc..

Can confirm in 1.18.1.

Can confirm in 1.19.1.

Can confirm in 1.19.2.

The issue here is that despite candles being able to float, they cannot be placed on top of non-solid blocks.

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 leaves and honey blocks are not considered solid, candles cannot be placed on top of these blocks, therefore resulting in this problem occurring.

Fix:

Simply removing the canSurvive() method from the CandleBlock.java class will allow candles to be placed anywhere including on top of non-solid blocks such as leaves and honey blocks, thus fixing this issue and maintaining consistency with the behavior of similar blocks such as turtle eggs and sea pickles.

Would that fix also fix MC-210810? If so, the reports should either be merged, or marked as related.

@unknown, yes. The fix above fixes this report (MC-227069), MC-210810, and MC-226686.

Magaximemum

(Unassigned)

Confirmed

Block states, Items

placement-and-support

1.17 Pre-release 3, 1.17.1, 1.18.1, 1.19.2, 1.19.3 Pre-release 2, 1.19.3 Release Candidate 1, 1.20.1

Retrieved