mojira.dev
MC-225157

Rails drop when mined by hand

This bug relates to MC-173833 and MC-218873.

Every type of rail drops if mined by hand, though this is inconsistent being that they are all predominantly made of metal.

Rails, activator rails, and detector rails should require a stone pickaxe to mine as they are made mostly of iron. Powered rails should require an iron pickaxe to mine as they are made mostly of gold which requires an iron pickaxe to mine.

This may also extend to other metal-related blocks, but these are the only examples I have found so far.

This may be intended.

Linked issues

Attachments

Comments 9

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

Can confirm in 1.17.1.

I can confirm this behavior in 1.18 Release Candidate 3.

Here's a code analysis along with a potential fix regarding this issue. The following is based on a decompiled version of Minecraft 1.17.1 using MCP-Reborn.

Code Analysis:

net.minecraft.world.level.block.Blocks.java

public class Blocks {
   ...
   public static final Block RAIL = register("rail", new RailBlock(BlockBehaviour.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL)));
   ...

If we look at the above class, we can see that rails do not contain the method requiresCorrectToolForDrops() which is used for determining whether a block should drop as an item or not upon being destroyed without the use of the appropriate required tool.

Potential Fix:

Simply adding the requiresCorrectToolForDrops() method within this line of code should resolve this problem. The correct line of code within its class should look something like the following:

net.minecraft.world.level.block.Blocks.java

public class Blocks {
   ...
   public static final Block RAIL = register("rail", new RailBlock(BlockBehaviour.Properties.of(Material.DECORATION).noCollission().strength(0.7F).requiresCorrectToolForDrops().sound(SoundType.METAL)));
   ...

Can confirm in 1.18.2.

Can confirm in 1.19.

Can confirm in 1.19.1.

Can confirm in 1.19.2.

Changelog for 24w44a:

We made it so any block that drops when its support is broken will also drop when mined with any tool. It seemed unfair that breaking a block directly could destroy it if it was possible to obtain it with any tool just by breaking the block below!

Thus this is now intended.

Brevort

(Unassigned)

Confirmed

Block states

activator_rail, detector_rail, loot-table, powered_rail, rail

1.16.5, 21w18a, 21w19a, 1.17 Release Candidate 1, 1.17, ..., 1.20 Pre-release 6, 1.20 Release Candidate 1, 1.20, 1.20.1, 1.20.4

Retrieved