Jump to content

(SOLVED)[1.14.4] Custom Block Doesn't Drop When Broken


Blu_Nighttime

Recommended Posts

When a custom block is broken in survival, it doesn't drop and is just destroyed. I create a block like this:

public static final Block CUSTOM_BLOCK = new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)).setRegistryName(id, "custom_block");

And register inside of getRegistry#registerAll, so the block appears and functions 'normally' but doesn't drop on break. I think I saw somewhere that block breaks are something to do with getLootTable but not 100 percent sure. Also looking at the docs for 1.13.x, and not sure if it changed in 1.14.4, there's a function called onBlockDestroyedByPlayer but I'm not sure if I need to implement this into each class for the block. If there's something else I'm missing that would be causing my confusion then please let me know - I've never had this issue before.

 

Thanks.

Edited by Blu_Nighttime
title edit
Link to comment
Share on other sites

Ah ha, so the loot tables that I saw mentioned somewhere else is the way that blocks are now dropped. I looked up in the reference library once you said, if I did have a loot table, and found out how to do it.

Once I added the loot table for my mod and custom block to it, the block dropped when broken in survival.

 

Thanks again.

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.