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)

Active 7 months ago
Joined Dec 2024
Points:
42

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 9
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?

Active 1 month ago
Joined Apr 2020
Points:
788

User statistics:

  • Modifications: 4
  • Forum topics: 14
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 101
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.

Active 7 months ago
Joined Dec 2024
Points:
42

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 9
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}