Jump to content

Any guide on how to use the api?


Recommended Posts

I'm trying to create a mod that simply consists of having a block that if you jump on top of it throws you up with great force, but I can't understand the api documentation, I don't even know what methods to look for, for example To cancel the fall damage, does anyone know of an api guide or if someone would be so kind as to make one, it would be great, at least with the basics to know how to use it.

 



Excuse my English, I have used the google translator

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...

The API documentation is shit, what I do is take the source code and read that.
For your example you want to read the damage event and cancel (or modify the damage of it) if conditions are met.
When you don't have something to hook on to you can either hook onto the tick itself or make your own tick handler and hook onto that. It's clumsy and I wouldn't suggest doing so unless you have to. Eventually I have to get around to rewriting all of my mods because they use an obscenely inefficient method which lags the game to shit.

Treat all coding in this game as an event handler. Something happens, and then your code will react to that. Ultimately that's how things get done.

Edited by Omega Haxors
Link to comment
Share on other sites

On 9/22/2023 at 10:42 PM, Omega Haxors said:

Eventually I have to get around to rewriting all of my mods because they use an obscenely inefficient method which lags the game to shit.

Hey, how exactly do you determine the performance hit your mods incur, and more importantly, why they impact performance? 

Link to comment
Share on other sites

On 9/24/2023 at 8:44 AM, l33tmaan said:

Hey, how exactly do you determine the performance hit your mods incur, and more importantly, why they impact performance? 

I'm usually a low-level programmer so I tend to think of each part eventually breaking down into machine code.
One method to test for lag is kind of horrifying, but it's to load the server with a reliable source of lag then measure dropped ticks.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.