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 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