Jump to content

[1.16.1] Blocks still dropping items despite mining them with the wrong mining level/tool?


Sconed

Recommended Posts

While I was creating a mod, I noticed that my mod's blocks harvest levels were all being set to zero, despite me defining them in the block's properties. 

 

So I did a clean install of the latest MDK (Forge 1.16.1-32.0.39), and made a quick test just to see if something else was causing it, but I haven't been able to figure out what's making this happen yet.

 

Here's what the code from my testing looks like:

@Mod("examplemod")
public class ExampleMod
{
    // Directly reference a log4j logger.
    private static final Logger LOGGER = LogManager.getLogger();

    private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "examplemod");
    
    public static final RegistryObject<Block> HARD_BLOCK = BLOCKS.register("coolblockname", () -> new Block(
        Block.Properties.create(Material.ROCK)
        .harvestLevel(3)
        .harvestTool(ToolType.PICKAXE)
        .hardnessAndResistance(2.5F, 10F)
    ));

    public ExampleMod() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        BLOCKS.register(bus);

        MinecraftForge.EVENT_BUS.register(this);
    }
}

 

This is what the loot table for the block looks like:

{
    "type": "minecraft:block",
    "pools": [
      {
        "rolls": 1,
        "entries": [
          {
            "type": "minecraft:item",
            "name": "minecraft:carrot"
          }
        ],
        "conditions": [
          {
            "condition": "minecraft:survives_explosion"
          }
        ]
      }
    ]
  }

 

Lastly, here's a quick video of me showing that the block does still drop in game (despite the wrong mining level/tool)

 

If there's anything else that I can include to help diagnose the issue please let me know! Thanks

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.