Guides Nomad Physics

For plugin authors

How another server plugin builds against PhysicsApi.

The Java API is for server plugins; server owners do not need it. Compile against the jar with compileOnly, add co.nomadlabs:NomadPhysics to Dependencies in your manifest, and install Nomad Physics alongside your plugin. Bundling a second copy of the physics classes can give your plugin a separate API holder.

  • PhysicsApi.get() returns null before setup and after shutdown.
  • spawnBody returns null when the model is unknown, the destination section is unloaded, or the world has reached its body cap. Query the cap with bodyCap() rather than hard-coding it.
  • Simulation calls must run on the owning world's thread, for example inside world.execute(...). Contact, impact and adoption callbacks already run there.
  • Beyond bodies and impulses there are contact and impact listeners, hinge, slider and ball joints, adopt and release for existing entities, spawnBlockBody, and registerMachine for content-pack items.
  • To make your own entities work with the guns, implement AdoptableOwner and register it from your plugin's start().
  • AdoptOptions can set friction and restitution; the original five-argument constructor still works.