Silk Touch Drop

Issue description

It's hard to explain for me so I'll write an example.

When you make a block and you want it drop always air, you set the custom drop as air.

However, if a player breaks the block with the Silk Touch enchantment, the block drops itself.

And sometimes you really want that block to never drop itself.

So, it would be cool to add a "Is affected by Silk Touch?" option to blocks drop.

This is also useful for preventing cheat: for making a block that drops more than an item, you set a custom drop and a 'when block broken by player/explosion" event/procedure. However, if the player has a silk touch tool, he will get the extra drops+the block itself and he will be able to get unlimited resources.

If you add this feature a lot of bugs will be fixed


Issue comments

Submitted by Klemen on Thu, 05/31/2018 - 19:12

Is there any existing Minecraft block that behaves like this. Otherwise, the implementation would be quite difficult. If we find a code example, I might implement this.

I searched on the wiki and it seems that cake, crops, cocoa, inverted daylight sensor, double slab, farmaland, fire, frosted ice, grasspath, monster spawner and snow layer don't drop themselves when destroyed with a silk touch tool. Also the monster egg (the stone/stonebricks that spawns silverfish) has a special behavior with silk touch.

(Sorry for bad English)

Submitted by Klemen on Fri, 06/01/2018 - 18:54

Thank you for this information. I have found a way to implement this using this code:

public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
    return false;

For now, you will have to use code editor to achieve this, but I will also add a checkbox for this option in the future updates.

Submitted by Klemen on Tue, 07/31/2018 - 09:27

This feature will be implemented in MCreator 1.8.0.

Submitted by smmmadden on Tue, 01/22/2019 - 04:04

Hi - sorry to add on to such an old post, but using 1.8.1, I'm trying to do something similar but I think the logic is reverse to what the Affected by Silk Touch box has.

If a player (single or multiplayer) breaks block XYZ with a pickaxe that HAS silk touch, then they get that same block PLUS a random drop.  However, if the pickaxe does not have silk touch, I only want to drop block XYZ without the random drop.

I checked the box for the block in the UI that it is affected by Silk Touch thinking that my Iron or Diamond Pickaxe requirement has to be silk touch to get the block but I get regardless if has silk touch or without and I get the random drops.

Do I need to configure this differently?  I didn't see any event triggers that purposely checks for enchantments that I could add or an event trigger to use.  Any ideas?

This is the procedure called On block break by player which works - just not how I want it to be since a silk touch generally means you get something extra (hence the random drops).  Thanks!
Block Break procedure

Submitted by Klemen on Tue, 01/22/2019 - 16:27

I don't entirely understand you, but you can't check for the enhancements in procedures yet. This procedure would give you extra items but only in 30% cases and only when the player has the item in the condition in inventory.

Submitted by smmmadden on Tue, 01/22/2019 - 18:07

You answered the question in the first sentence.  The procedure is doing what I want it to do, I just needed to check for the silk touch but not currently able to. Is there a way to add a code snippet that does this or are there just no hooks to that api yet?

Thanks for the quick response! :-) -Steve

Submitted by Klemen on Tue, 01/22/2019 - 20:32

You would need the reference to the item that was used to destroy this block by the player, but such reference is not passed by Minecraft Forge per my knowledge. It might change in the future though.