#Custom model projectile entity

4 messages · Page 1 of 1 (latest)

raven pivot
#

I want to create a projectile entity thats in the shape of a custom modeled sword i made, with the hope of eventually using it in a spell.

For now, I have this

StartupEvents.registry('entity_type', event => {
    event.create('magicsword', 'entityjs:projectile')
        .clientTrackingRange(8)
        .isAttackable(true)
        .mobCategory('misc')
        .item(item => {
            item.canThrow(true)
        })
        .sized(1, 1)
        .renderOffset(0, 0, 0)
        .renderScale(1, 1, 1)
        .updateInterval(3)
        .canHitEntity(entity => {
            return true; // Allow the projectile to hit any entity
        })
        .shouldRenderAtSqrDistance(context => {
            const { entity, distanceToPlayer } = context;
            return distanceToPlayer < 100;
        })
        .move(context => {
            const { entity, moverType, position } = context;
            entity.setDeltaMovement(0, 0.1, 0);
        })
        .onHitBlock(context => {
            const { entity, result } = context;
            entity.getLevel().addParticle('minecraft:campfire_cosy_smoke', entity.getX(), entity.getY(), entity.getZ(), 0, 0, 0);
        })
        .onHitEntity(context => {
            const { entity, result } = context;
            if (result.entity.living) {
                let potion = result.entity.potionEffects
                potion.add('minecraft:slowness', 20, 1, false, true)
            }
        })
        .onHitEntity(context => {
            const { entity, result } = context;
            if (result.entity.living) {
                result.entity.hurt(DamageSource.thrown(entity, entity.getOwner()), 7); // Deal 10 points of damage
            }
        })
        .tick(entity => {
            if (entity.getLevel().getBlockState(entity.blockPosition()).getBlock().id == "minecraft:lava") {
                entity.setSecondsOnFire(5);
            }
        })
})
fluid glacierBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

raven pivot
#

How does this get connected to the model json, and can that model json be the same json file as an item model?

#

I noticed blockbench has restrictions on modded entity models and was hoping that I could just ignore those entirely