Skip to content

Addon Development

alepik387 edited this page Aug 4, 2026 · 3 revisions

Addon Development

Guide for mods that extend Endless Gravity's mechanics. Since 1.1.0 the mod exposes a static API (EndlessGravityAPI) and datapack tags instead of cancellable events.

Use Cases

  • Enchantments that reduce, cancel, or amplify gravity
  • Armor that makes the wearer immune to gravity
  • Items that interact with low-gravity physics
  • Custom entities that float or behave differently in The End
  • Custom dimensions that reuse the atmosphere pressure curve

Examples

Gravity Immune Entity (datapack)

Make a custom entity ignore low gravity in The End via a datapack tag — create data/mymod/tags/entity/gravity_immune.json (with endless_gravity as a dependency):

{
  "replace": false,
  "values": [
    "mymod:my_floating_creature"
  ]
}

Or check the tag at runtime:

boolean immune = EndlessGravityAPI.isGravityImmune(entity);

Read Atmosphere State

React to the pressure curve for your own mechanics (e.g., a magic spell that strengthens with altitude):

double progress = EndlessGravityAPI.getAtmosphereProgress(player.getY());
if (progress > 0.5) {
    // in the upper atmosphere — boost your effect
}

Reuse the Real Y Projection

If your mod works inside Sable sub-levels, project coordinates to global space:

double globalY = EndlessGravityAPI.getRealY(entity);

Custom Dimension Gravity

Apply gravity yourself for a custom dimension — Endless Gravity only affects The End (low gravity) and the Overworld/Sable (atmosphere):

NeoForge.EVENT_BUS.addListener(EntityTickEvent.Pre.class, event -> {
    Entity entity = event.getEntity();
    if (entity.level().dimension() == MY_CUSTOM_DIMENSION) {
        entity.setDeltaMovement(entity.getDeltaMovement().add(0, 0.03, 0));
    }
});

Read Synced Config Values

Read the effective (server-synced) config values from Config.COMMON:

import dinner.dev.endless_gravity.Config;

double maxGravity = Config.COMMON.atmosphereGravityMax.get();
double endOffset  = Config.COMMON.playerGravityOffset.get();

Tips

  • EndlessGravityAPI methods are safe to call on any thread; they never touch the config screen
  • All API reads are cheap — they are pure lookups against the configured curve
  • Add endless_gravity to your neoforge.mods.toml dependencies if you compile against the API
  • The gravity_immune tag is an entity type tag — immunity is per entity type, not per instance

Clone this wiki locally