Disable rideable when healing the entity

Started by damiansb on

Topic category: Help with MCreator software

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Disable rideable when healing the entity

Hello, guys. I'm implementing a procedure to heal a rideable custom entity when I right click on it holding an Iron Ingot (similar to the way you heal an Iron Golem).

I can't figure out a way to prevent the player to mount on the entity when I right click, tho. The healing occurs, but I have to dismount every time to right click again. Anyone have any idea of how I can implement this?

Screenshot of the procedure below:

Procedure

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I believe the mounting bit…
Tue, 06/09/2020 - 22:57

I believe the mounting bit in MCreator is "checked" first before the entity right-clicks procedure, rendering entity right-click procedure useless on rideable entities.

If you know how (or want) to code. Here is a snippet from the horse source code; Keep in mind itemstack is the item "used on the horse".

            if (this.handleEating(player, itemstack)) {
               if (!player.abilities.isCreativeMode) {
                  itemstack.shrink(1);
               }

               return true;
            }

This snippet is checked before the mounting bit.

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for your reply. I…
Fri, 06/12/2020 - 15:15

Thanks for your reply. I have a lot of experience in PHP coding for web developing, but never really coded in Java.

I tried to figure out how to do it with your solution, but couldn't make it work.

So I decided to implement a Welding Torch and made the procedure to "fix" the damaged speeder on the PlayerCollision procedure. As long as I have a Welding Torch on the main hand and Some Iron Plating on the Off Hand, this Speeder will repair 4 damages every 1.5 second and use 1 Iron Plating, when I touch it.

The result is pretty neat! :D

Thanks a lot for your help.