Jump to content

How to bind command to button?


iBars

Recommended Posts

I was edit Minecraft.class in net.minecraft.client package but it working wrong.

 

Code from line 1899

 

if (Keyboard.getEventKey() == 48 && Keyboard.isKeyDown(61))
{
RenderManager.debugBoundingBox = !RenderManager.debugBoundingBox;
}

 

I was replaced to

 

if (Keyboard.getEventKey() == 48)
{
if (Keyboard.isKeyDown(61)) {
RenderManager.debugBoundingBox = !RenderManager.debugBoundingBox;
} else {
this.thePlayer.sendChatMessage("/spawn");
}
}

 

But when I play on selected singleplayer map or join any server, it binded command executes automatically (once), even if I don't pressed B (id 48) button...

 

Also I was trying to add this command to controls menu settings (GameSettings.class), Minecraft is crashes when I start playing (on selected singleplayer map or on any server) if Smart Moving mod is installed (but I not sure about this mod).

Link to comment
Share on other sites

In Forge, there are events.

If you subscribe a void to an event, it is called whenever the event is. So there is an event for the player being alive. Every tick the player is alive, all subscribers are ran.

You want every tick, and you want to make sure your on the client.

But yes, do NOT edit base classes or you will get your topics locked, your mods looked down upon, and possibly your account removed.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

I don't think your account will get removed if you edit base classes, but less people are going to help you.

Editing base classes is not good,

 

If you only edit the base class in your editor,

it may work fine in eclipse but will not work outside your editor because the base codes aren't edited there.

And what if two modders would have edited a base class? Than you can only use 1 of the mods and using mods will me more difficult for players.

Link to comment
Share on other sites

Don't edit base classes. Forge has everything you need to make this work.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.