Skip to content

API reference Obsidian.API.Entities

EntityProperties class

What a plugin's entity type is like: its size, health and speed, and what its entities do.

public sealed class EntityProperties

In Obsidian.API.

Constructors

public EntityProperties();

Properties

Behavior

public IEntityBehavior Behavior { get; init; }

What the entity does each tick, when a player uses it and, for a projectile, when it hits something; or null for nothing.

Category

public MobCategory Category { get; init; }

A mob's category, like a vanilla entity type's: NeoForge's add_spawns biome modifiers add the mob to this category's spawn lists, and naturally spawned mobs count against its cap. Misc mobs don't spawn naturally.

DataFields

public IReadOnlyList<EntityDataField> DataFields { get; init; }

The type's synced data fields, sent to modded Obsidian clients after vanilla's fields at fixed indices (see EntityDataField.Index), in this order. Register the same fields on both sides.

FlyingSpeed

public float FlyingSpeed { get; init; }

A flying mob's minecraft:flying_speed, which a rider flies it with: each tick it gains a tenth of it, in blocks per tick, in the direction the rider steers.

Gravity

public float Gravity { get; init; }

How fast a projectile or object falls, in blocks per tick per tick: 0.03 for a snowball, 0.04 for an item, 0 to float. Mobs fall like vanilla's.

Height

public float Height { get; init; }

The height of the entity's hitbox, in blocks.

Kind

public EntityKind Kind { get; init; }

What the entities are: mobs, projectiles or objects. It can't change until the server restarts, since entities of the type exist as one kind.

MaxHealth

public float MaxHealth { get; init; }

The health a mob spawns with.

Movement

public EntityMovementMode Movement { get; init; }

How a mob moves: walking, falling like vanilla's mobs, or flying, without gravity or fall damage, like vanilla's flying mobs, with a flying move control and pathfinding through the air.

MovementSpeed

public float MovementSpeed { get; init; }

The entity's minecraft:movement_speed, which its goals move it with; 0.25 is a zombie's walk.

PassengerAttachments

public IReadOnlyList<VectorF> PassengerAttachments { get; init; }

Where the entity's passengers sit, like a vanilla entity type's passenger attachments: a point per seat, in blocks from the entity's position at its feet, for the entity facing south (+Z ahead, +X to its left), turned with its yaw. The first passenger sits at the first point, the second at the second, and passengers past the last point at the last. A rider's feet go to the point, or 0.6 blocks below it for a player, as vanilla places players. None, the default, seats every passenger on top of the hitbox, vanilla's default.

Remarks

The server places riders at the points, and the Obsidian client places them there as it draws them and the player's camera, so give the type the same points on both sides.

SpawnEgg

public bool SpawnEgg { get; init; }

Registers an item named <entity path>_spawn_egg with this entity's data component. Supply its item model and texture in the plugin's assets and add EntityDefinition.SpawnEgg to a creative tab. Only mob types may request an egg.

SpawnPlacement

public SpawnPlacementType? SpawnPlacement { get; init; }

Where natural spawning may place the mob, like vanilla's spawn placement types; null, the default, follows the rules of the spawn list it's chosen from. With a placement, natural spawning skips those rules and asks the behaviour's IEntityBehavior.CanSpawn instead.

Width

public float Width { get; init; }

The width of the entity's hitbox, in blocks.

On this page