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.