Skip to content

Addon API

alepik387 edited this page Aug 14, 2026 · 4 revisions

Addon API

Endless Gravity exposes EndlessGravityAPI (dinner.dev.endless_gravity.EndlessGravityAPI) — a static utility class for reading atmosphere state, checking dimensions, and interacting with the gravity immunity tag.

Note: The old cancellable events (GravityImmunityEvent, GravityApplicationEvent, GravityAppliedEvent, FallDamageCalculationEvent) were removed in 1.1.0. Use the API methods and the gravity_immune tag instead.


Tags

endless_gravity:gravity_immune (entity type tag)

Entities whose type is in this tag ignore low gravity in The End. Add entries via datapack:

{
  "replace": false,
  "values": [
    "mymod:my_floating_creature"
  ]
}
boolean immune = EndlessGravityAPI.isGravityImmune(entity);

Atmosphere Queries

// Pressure at a Y level: 1.0 at full atmosphere, 0.0 at vacuum
double pressure = EndlessGravityAPI.getPressure(y);

// Atmosphere progress: 0.0 at full atmosphere, 1.0 at vacuum (progress = 1 - pressure)
double progress = EndlessGravityAPI.getAtmosphereProgress(y);

// Upward gravity offset at a Y level (0 at full pressure, Max Gravity Offset at vacuum)
// Returns 0 when the atmosphere is disabled
double offset = EndlessGravityAPI.getAtmosphereOffset(y);

// Muffle gains at a Y level (1.0 at full pressure, config value at vacuum)
double muffleGain  = EndlessGravityAPI.getAtmosphereMuffleGain(y);
double muffleGainHF = EndlessGravityAPI.getAtmosphereMuffleGainHF(y);

Constants

double BASE = EndlessGravityAPI.BASE; // 64.0 — sea-level reference; atmosphere effects start above this

Real Y Projection (Sable Sub-levels)

// Project an entity out of a Sable sub-level into global Overworld Y.
// Returns entity.getY() unchanged when not in a sub-level.
double realY = EndlessGravityAPI.getRealY(entity);

// Same, for an arbitrary position
double realY = EndlessGravityAPI.getRealY(level, pos);

Dimension & Sable Helpers

// Is Sable installed?
boolean sable = EndlessGravityAPI.isSableLoaded();

// Does Sable control physics for this level? (sable:* dimensions and The End)
boolean managed = EndlessGravityAPI.isSableManaged(level);

// Is this the Overworld or a Sable sub-level? (atmosphere applies here)
boolean overworld = EndlessGravityAPI.isOverworldOrSable(level);

Config Sync

All gameplay-affecting config values are synced from server to client on login via ConfigSyncPayload.

  • Server side: uses the server's config file
  • Client side: overrides local config with server values on login
  • Client-only settings (audio filter gains) remain local

Addons can read Config.COMMON directly (fields are ConfigValue<?>) — gameplay values always reflect the server-synced ones after login.

Clone this wiki locally