Log stripping procedure that works with any axe?

Started by Aksumite on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Log stripping procedure that works with any axe?

I understand this has been asked before, but never (from what I know) the same problems as me.

I have a procedure that replaces the log with a stripped log, but the “on right clicked” event doesn’t allow for itemstack meaning it can’t damage the axe, which is very important.
The second (MUCH bigger) issue is that it doesn’t work with any axe. Is there custom code that can be used to include any axe, modded or vanilla? Thanks!

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
there is a get item in main…
Fri, 06/05/2020 - 04:34

there is a get item in main hand procedure block.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes I know, but that doesn't…
Fri, 06/05/2020 - 05:39

Yes I know, but that doesn't work with every axe in every mod. I am wondering how (with custom code) to check if the player is holding ANY axe. I also have the issue that I can't damage the axe

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'll look in to it, and if…
Fri, 06/05/2020 - 05:49

I'll look in to it, and if it is possible to check if an itemstack is an axe I could add it to my plugin as a procedure block.

There is a damage item procedure block.

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
after a bit of tinkering, I…
Fri, 06/05/2020 - 06:35

after a bit of tinkering, I found out that it is indeed possible:

ItemStack stack = player.getHeldItemMainhand();
if(stack.getItem() instanceof AxeItem){
   System.out.println("tool is an axe.");
}

this piece of code gets the item of the player's main hand and checks if it is an axe, if so, print in the console tool is and axe.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks so much! Just to be…
Fri, 06/05/2020 - 06:37

Thanks so much! Just to be sure, where should I put this code? I have just recently started learning how to do custom code, so I am not exactly sure :D

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am assuming just …
Fri, 06/05/2020 - 06:38

I am assuming just "replacing" the if statement, am I correct?

 

(and then with the stuff I want to happen inside)

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What I mean by replace is do…
Fri, 06/05/2020 - 06:40

What I mean by replace is do I use this code instead of the original if statement, and then put what I want to happen in that? Sorry if that makes no sense

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
do not code if you don't…
Fri, 06/05/2020 - 07:32

do not code if you don't understand java. I'll send you the plugin with the check for is tool axe in a few hours :D

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok thanks, I really…
Fri, 06/05/2020 - 23:09

Ok thanks, I really appreciate it :D

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Took a whole day doing this…
Sat, 06/06/2020 - 12:50

Took a whole day doing this but I believe that I got it working!
download

yeet

It works for checking swords, hoes, pickaxes, axes, and shovels. You need to replace this provided itemstack block with get item in entity main hand.

Install instructions: https://github.com/Max094Reikeb/ExtraProceduresPlugin/blob/master/README.md

only works for 2020.3

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wow, I REALLy appreciate it!…
Sat, 06/06/2020 - 20:09

Wow, I REALLy appreciate it! You saved my mod!