OBSIDREL / DOCS

Documentation

Guides, tutorials and technical references for the Obsidrel ecosystem.

DocumentationEntity API — methods and examples

Entity API — methods and examples

spawn() returns an Optional, so always handle failure. despawn() targets a live entity; respawn() reports an explicit lifecycle outcome. instanceId(), ownerId(), rigPart() and attachment() help read a live custom entity without using private Core classes.

What methods are available?

  • List<EntityView> all();
  • Optional<EntityView> find(String id);
  • Optional<LivingEntity> spawn(String id, Location location, Player source);
  • Optional<LivingEntity> spawn(String id, Location location, Player source, UUID ownerId);
  • boolean despawn(LivingEntity entity);
  • EntityRespawnResult respawn(UUID instanceId, Location override, Player source);
  • Optional<EntityLifecycleView> lifecycle(UUID instanceId);
  • Optional<UUID> instanceId(Entity entity);
  • Optional<UUID> ownerId(Entity entity);
  • Optional<Location> rigPart(Entity entity, String partId);
  • Optional<Location> attachment(Entity entity, String attachmentId);

These signatures are read directly from the public ObsidrelAPI 1.0 service interface. An Optional result can be empty, boolean results can indicate failure and views are public read-only projections rather than mutable Core objects.

Practical steps

  1. Add ObsidrelAPI as a provided (Maven) or compileOnly (Gradle) dependency. 2. Check Obsidrel is running and fetch ObsidrelProvider.require(1). 3. Call the matching service with an ID that is already loaded. 4. Handle missing values and failures before showing messages to players. 5. Test on a staging server with the exact Core version.

Troubleshooting

If lookup fails, check the resource ID and whether it loaded in Core. If provider lookup fails, confirm the plugin dependency, Core startup and API level. Do not link to private implementation classes; the supported contract is the public me.antzbr.obsidrel.api.* package.

See: API setup · Service catalog.

Was this article helpful?Loading ratings…

Help us improve Obsidrel documentation. One vote per account and article. Discord AI feedback can also contribute when the answer cites this article.