Jump to content

Allow an item to break only certain blocks


Yvelat

Recommended Posts

The short answer:

Yes

 

The long answer:

What block and what item? If you want a modded block to only be harvestable by a vanilla item, you will use different methods than if you want a vanilla block to only be harvestable by a modded item. If you want a modded block to be harvested by a modded item, things should be pretty easy.

 

In the case that you have a modded block to be harvested by a modded or non-modded item, I'm not totally sure, but I believe the preferred method is using a loot table. Maybe somebody else knows how to check for the item used to harvest a block in a block's loot table.

There's also methods like canHarvestBlock and onBlockDestroyed in items like ShearsItem.

Or harvestTool in Block.Properties, but I think that would require making a new ToolType if the item in question is not an axe or pickaxe.

 

Edited by skyjay1
  • Like 1
Link to comment
Share on other sites

10 hours ago, skyjay1 said:

The short answer:

Yes

 

The long answer:

What block and what item? If you want a modded block to only be harvestable by a vanilla item, you will use different methods than if you want a vanilla block to only be harvestable by a modded item. If you want a modded block to be harvested by a modded item, things should be pretty easy.

 

In the case that you have a modded block to be harvested by a modded or non-modded item, I'm not totally sure, but I believe the preferred method is using a loot table. Maybe somebody else knows how to check for the item used to harvest a block in a block's loot table.

There's also methods like canHarvestBlock and onBlockDestroyed in items like ShearsItem.

Or harvestTool in Block.Properties, but I think that would require making a new ToolType if the item in question is not an axe or pickaxe.

 

ok, so if I use a modded pickaxe to break a modded block how should I do?

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.