Make Player Eat

Started by Kemuri Senpai on Fri, 05/08/2020 - 14:51

Topic category: Help with modding (Java Edition)

Last seen on 21:15, 8. Jan 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Make Player Eat
Fri, 05/08/2020 - 14:51

I would like to make a player eat food that he is holding in the main hand by pressing the 'X'-button, the same if I would hold my right mouse-button, but it should happen if I press it once and no need to hold it while eating; It also has to be the original game event for eating, because I would like to use this on vanilla server, so it has to send the event to the host;

can someone help, I am still very new to coding and modding in minecraft? 

Last seen on 22:07, 25. Apr 2021
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i dont think thats possible…
Sat, 05/09/2020 - 03:39

i dont think thats possible. it might be but i have no idea. the only solution i have is replace the right click keybind in minecraft with x

 

Last seen on 21:15, 8. Jan 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
FireDemon, thanks for your…
Sat, 05/09/2020 - 17:24

FireDemon, thanks for your reply; in the web you can find some information about the package "net.minecraft.src" which also contains "PlayerController"; this class is able to perform actions as a player, for example place blocks, turn around or attack some entity; the problem is, the package has been split through the time and now I could never find the class "PlayerController" to use it; I just don't know whether it has another name or it has been moved to other package or maybe has been deleted; so I think, it's possible, but to hard to find

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Or you could do something…
Tue, 06/02/2020 - 13:39

Or you could do something like this;

            Minecraft.getInstance().gameSettings.keyBindUseItem.setPressed(true);

I actually don't know if that code will work (never tested or used a method like this). But I'm sure it does.

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Wait no this is the 3000…
Tue, 06/02/2020 - 14:10

Wait no this is the 3000 post!

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Wait no idk anymore
Tue, 06/02/2020 - 14:10

Wait no idk anymore