diff --git a/docs/entities/attributes.md b/docs/entities/attributes.md index 50da3c10c..484873f53 100644 --- a/docs/entities/attributes.md +++ b/docs/entities/attributes.md @@ -1,5 +1,5 @@ --- -sidebar_position: 5 +sidebar_position: 4 --- # Attributes diff --git a/docs/entities/index.md b/docs/entities/index.md index 157dc25cd..1fd38be7c 100644 --- a/docs/entities/index.md +++ b/docs/entities/index.md @@ -236,7 +236,7 @@ Due to the many different types of entities, there is a complex hierarchy of sub Direct subclasses of `Entity` include: -- `Projectile`: The base class for various projectiles, including arrows, fireballs, snowballs, fireworks and similar entities. Read more about them in the [Projectiles article][projectile]. +- `Projectile`: The base class for various projectiles, including arrows, fireballs, snowballs, fireworks and similar entities. Read more about them [below][projectile]. - `LivingEntity`: The base class for anything "living", in the sense of it having things like hit points, equipment, [mob effects][mobeffect] and some other properties. Includes things such as monsters, animals, villagers, and players. Read more about them in the [Living Entities article][livingentity]. - `VehicleEntity`: The base class for boats and minecarts. While these entities loosely share the concept of hit points with `LivingEntity`s, they do not share many other properties with them and are as such kept separated. - `BlockAttachedEntity`: The base class for entities that are immobile and attached to blocks. Includes leash knots, item frames and paintings. @@ -244,6 +244,20 @@ Direct subclasses of `Entity` include: Several entities are also direct subclasses of `Entity`, simply because there was no other fitting superclass. Prominent examples include `ItemEntity` (dropped items), `LightningBolt`, `ExperienceOrb` and `PrimedTnt`. +### Projectiles + +Projectiles are a subgroup of entities. Common to them is that they fly in one direction until they hit something, and that they have an owner assigned to them (e.g. a player or a skeleton would be the owner of an arrow, or a ghast would be the owner of a fireball). + +There are three big subgroups of projectiles: + +- Arrows: Represented by the `AbstractArrow` superclass, this group covers the different kinds of arrows, as well as the trident. An important common property is that they will not fly straight, but are affected by gravity. +- Throwables: Represented by the `ThrowableProjectile` superclass, this group covers things like eggs, snowballs and ender pearls. Like arrows, they are affected by gravity, but unlike arrows, they will not inflict damage upon hitting the target. They are also all spawned by using the corresponding item. +- Hurting Projectiles: Represented by the `AbstractHurtingProjectile` superclass, this group covers wind charges, fireballs and wither skulls. These are damaging projectiles unaffected by gravity. + +Other projectiles that directly extend `Projectile` include fireworks, fishing bobbers and shulker bullets. + +A new projectile can be created by extending `Projectile` or a fitting subclass, and then overriding the methods required for adding your functionality. Common methods to override would be `#shoot`, which calculates and sets the correct velocity on the projectile; `#onHit`, `#onHitEntity` and `#onHitBlock`, which do exactly what you'd expect; and `#getOwner` and `#setOwner`, which get and set the owning entity, respectively. + [block]: ../blocks/index.md [damageevents]: livingentity.md#damage-events [damagesource]: ../resources/server/damagetypes.md#creating-and-using-damage-sources @@ -259,7 +273,7 @@ Several entities are also direct subclasses of `Entity`, simply because there wa [mobeffect]: ../items/mobeffects.md [mobspawn]: livingentity.md#spawning [particle]: ../resources/client/particles.md -[projectile]: projectile.md +[projectile]: #projectiles [registration]: ../concepts/registries.md#methods-for-registering [renderer]: renderer.md [spawning]: #spawning-entities diff --git a/docs/entities/livingentity.md b/docs/entities/livingentity.md index 3f347ce78..10f81c0ef 100644 --- a/docs/entities/livingentity.md +++ b/docs/entities/livingentity.md @@ -1,5 +1,5 @@ --- -sidebar_position: 4 +sidebar_position: 3 --- # Living Entities, Mobs & Players @@ -128,7 +128,7 @@ Depending on which side the player is on, a different player class is used: In addition to the [regular ways of spawning][spawning], `Mob`s can also be spawned through some other means. `ArmorStand`s can be spawned through regular means, and `Player`s should not be instantiated yourself. -## Spawn Eggs +### Spawn Eggs It is common (though not required) to [register] a spawn egg for mobs. Vanilla uses the `SpawnEggItem` class here, which does some additional setup in the constructor. diff --git a/docs/entities/projectile.md b/docs/entities/projectile.md deleted file mode 100644 index 13429f8fd..000000000 --- a/docs/entities/projectile.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -sidebar_position: 3 ---- -# Projectiles - -:::info -This section is a work in progress. -::: diff --git a/docs/entities/renderer.md b/docs/entities/renderer.md index 093e7cf36..6e8f04920 100644 --- a/docs/entities/renderer.md +++ b/docs/entities/renderer.md @@ -1,5 +1,5 @@ --- -sidebar_position: 6 +sidebar_position: 5 --- # Entity Renderers