Potential StopRidingEntityTask custom code procedure?

Started by SilentStarling on

Topic category: Advanced modding

Last seen on 01:15, 25. Jul 2022
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Potential StopRidingEntityTask custom code procedure?

Please forgive me if I've misunderstood the basic concepts of how to call on a class/make it do what I want, I'm just spitballing and hoping someone else knows more than me and can help guide this in a relevant direction.

My mod has entities that can ride a player (like a vanilla parrot), I have the game set to have the mob ride the player if they are tamed to the player and the player right clicks on them. However, I'm having trouble getting them off. I made a key binding (LShift), trying to make it so that if the player presses shift while being ridden, it would eject the entity riding the player. Currently its not working, and I can't really find a pre-generated procedure block that equates to "dismount" or "eject". I dig around in the decompiled source code sometimes for inspiration, and I found a StopRidingEntityTask class. Is there some way I could use this in a custom code procedure block to get the mob to dismount the player?

Ex: the procedure that is triggered upon the player pressing shift would be:
"if (is Event/Target entity being ridden = true), do (custom code StopRidingEntityTask)"

Last seen on 01:23, 24. Dec 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I just figured this out…
Sat, 11/27/2021 - 03:01

I just figured this out today, sorry for being so late

Use the default start riding procedure blocks, and then edit the code of that procedure

find what looks like 

sourceentity.startRiding(entity);

and replace it with 

sourceentity.stopRiding();

I'm so glad I figured this out because I was having the same problem and I hope they add stop riding procedure blocks in the future

Last seen on 01:23, 24. Dec 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nevermind should've tested…
Sat, 11/27/2021 - 03:12

nevermind should've tested it first :/