Skip to content

Projectile

seelderr edited this page Jan 13, 2025 · 5 revisions

Description

A projectile defines all of the characteristics of a custom projectile. In Dragon Survival, you can either define a arrow projectile (behaves similarly to an arrow) or a ball projectile (behaves similarly to a fireball, e.g. the ghast fireball).

Location

Projectiles are part of the data pack directory structure, highlighted below:

 datapack name.zip
├──  pack.mcmeta
├──  data
    ├──  namespace
       ├──  dragonsurvival
          ├──  projectile_data
              ├──  <name>.json
  

Parents

This object is used by the following objects:

  1. AbilityEntityEffect

Dependencies

This object references the following objects:

  1. ProjectileTargeting
  2. ProjectileEntityEffect
  3. ProjectileBlockEffect

GeneralData

General data that is used for both projectile types.

Schema

{
    "name": [ResourceLocation]                       // [Mandatory] || The name of the projectile.
    "entity_hit_condition": [Predicate]              // [Optional]  || The conditions under which a projectile is allowed to hit an entity.
    "ticking_effects": [ProjectileTargeting]         // [Mandatory] || The list of ticking effects that this projectile applies.
    "common_hit_effects": [ProjectileTargeting]      // [Mandatory] || The effects that apply when hitting an entity or block.
    "entity_hit_effects": [ProjectileEntityEffect]   // [Mandatory] || The effects that apply when hitting an entity.
    "block_hit_effects":  [ProjectileBlockEffect]    // [Mandatory] || The effects that apply when hitting a block.
}

GenericArrowData

Data used for the arrow type projectile.

Schema

{
    "texture": [LevelBasedResource]           // [Mandatory] || The texture to use for the projectile, per level of the ability. Textures are in assets/<namespace>textures/entity/projectiles.
    "piercing_level": [LevelBasedValue]       // [Optional]  || How many entities it can pierce through. 0 if empty.
}

GenericBallData

Data used for the ball type projectile.

BehaviourData

Specific data for how the ball projectile behaves.

Schema

{
     "width": [LevelBasedValue]                   // [Mandatory] || The width of the projectile.
     "height": [LevelBasedValue]                  // [Mandatory] || The height of the projectile.
     "max_bounces": [LevelBasedValue]             // [Optional]  || The max number of bounces for the projectile. Defaults to 0.
     "max_lingering_ticks": [LevelBasedValue]     // [Optional]  || The number of ticks the projectile lingers (when it hits something, it will "linger" at the hit location for this time period.
     "max_movement_distance": [LevelBasedValue]   // [Mandatory] || The max distance the projectile can move before it automatically destroys itself.
     "max_lifespan": [LevelBasedValue]            // [Mandatory] || The max lifespan the projectile has (in ticks) before it automatically destroys itself.
}

Schema

{
     "resources": [LevelBasedResource]           // [Mandatory] || The name of the resource to use for the projectile, per level of the entity. The same name is reused for both the animation and texture. Textures are in assets/<namespace>textures/entity/projectiles. Animations are in assets/<namespace>/animations/projectiles.
     "trail_particle": [ParticleType]            // [Optional]  || The type of particle to use for the particle trail the projectile emits.
     "on_destroy_effects": [ProjectileTargeting] // [Optional]  || What happens when the projectile is destroyed.
     "behaviour_data": [BehaviorData]            // [Mandatory] || Various pieces of special projectile behavior (lingering, bounces, size, etc..)
}

Schema

{
    "general_data": [GeneralData]                               // [Mandatory] || General projectile data.
    "type_data" [Either GenericBallData or GenericArrowData]    // [Mandatory] || Specific projectile data.
}
Datapack Documentation
Clone this wiki locally