how do i stop a vanilla block (logs) from dropping an item when mined by hand

Started by toaster_dragon1 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do i stop a vanilla block (logs) from dropping an item when mined by hand

I am making a mod that makes the survival early game of Minecraft much harder, more realistic and technical.

I want to make it so that a log can only drop a log if mined with an axe. How do i delete the drop when mined by hand?

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
https://imgur.com/a/O8XfXoo…
Wed, 01/01/2025 - 00:19

https://imgur.com/a/O8XfXoo

This is a bare bones implementation, you'll have to figure out what you want to do to allow the player to eventually break the blocks.

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I didn't know that there was…
Wed, 01/01/2025 - 06:24

I didn't know that there was a block that could cancel global triggers. I copied the code you showed and added a second condition checking if the item in the main or off hand was an axe and it worked. thanks for the help.

i have tried to show what the code blocks look like with punctuation. each type of bracket is a type of block the things i have written just below this say what each type of bracket is.

{action block} [data block] (multiple selection box) /top part of if or repeat block [data] \ 

                                                                                 \bottom part/ {action}

 

the code is:

 

{when event triggered by external call or when global trigger (block is broken)}

/if [is [item in main hand of [ event target entity] ] of item type (axe) ] \

\do/ {cancel event that triggered global trigger}