Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

 

  • Author
1 hour ago, ChampionAsh5357 said:

harvestLevel and harvestTool still need to be re-evaluated. Until they are, implementations of these two methods will not work.

Oh okay, thank you!

This also seems to be failing on forge 1.15 .... following tutorials all the other ‘basic’ things work but this.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.