Как исправить ошибку с атрибутами

Создал босса для Minecraft на 1.19.2 Forge и при его призыве в игре пишет:

Cannot invoke
"net.minecraft.world.entity.ai.attributes.Attribute instance.m_22100_(double)" because the return value of
"net.minecraft.world.entity.monster.Zombie.m_21051_(net.minecraft.world.entity.ai.attributes.attribute)" is null.  

Я только начал кодировать и не особо разбираюсь в таких ошибках

Класс босса AresEntity.java:

package org.mymod.ares;

public class AresEntity extends Zombie {
    private static final EntityDataAccessor<Boolean> ATTACKING = SynchedEntityData.defineId(AresEntity.class, EntityDataSerializers.BOOLEAN);


    public AresEntity(EntityType<? extends Zombie> entityType, Level world) {
        super(entityType, world);
        this.setHealth(MAX_HEALTH);
    }

    public static AttributeSupplier.@NotNull Builder createAttributes() {
        return AresEntity.createMobAttributes()
                .add(Attributes.MAX_HEALTH, 1000.0)
                .add(MOVEMENT_SPEED, 0.35)
                .add(ATTACK_DAMAGE, 50.0)
                .add(FOLLOW_RANGE, 40.0);
    }

    @Override
    protected void registerGoals() {
        this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2, false));
        this.goalSelector.addGoal(2, new MoveTowardsRestrictionGoal(this, 1.0));
        this.goalSelector.addGoal(3, new MoveThroughVillageGoal(this, 1.0, false, 4, () -> true));
        this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 1.0));
        this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 8.0F));
        this.goalSelector.addGoal(6, new RandomLookAroundGoal(this));

        this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
        this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
    }

    @Override
    protected void defineSynchedData() {
        super.defineSynchedData();
        this.entityData.define(ATTACKING, false);
    }

    @Override
    public void tick() {
        super.tick();
        if (this.level.isClientSide) {
            return;
        }

        Player target = this.level.getNearestPlayer(this, 20);
        if (target != null) {
            if (this.distanceTo(target) <= 20) {
                this.performHellRush(target);
            }
            if (this.tickCount % 100 == 0) { // Каждые 5 секунд
                this.performNapalmAttack(target);
            }
            if (this.distanceTo(target) <= 10) {
                this.performFlamethrower(target);
            }
        }
    }

    private void performHellRush(Player target) {
        Vec3 direction = target.position().subtract(this.position()).normalize();
        Vec3 dashPosition = this.position().add(direction.scale(20));
        this.setPos(dashPosition.x, dashPosition.y, dashPosition.z);
        this.level.playSound(null, this.blockPosition(), SoundEvents.BLAZE_SHOOT, this.getSoundSource(), 1.0F, 1.0F);
        for (int i = 0; i < 5; i++) {
            BlockPos firePos = new BlockPos(this.position().x + i, this.position().y, this.position().z);
            this.level.setBlock(firePos, Blocks.FIRE.defaultBlockState(), 11);
        }
    }

    private void performNapalmAttack(Player target) {
        for (int i = 0; i < 3; i++) {
            Vec3 direction = target.position().subtract(this.position()).normalize();
            SmallFireball fireball = new SmallFireball(this.level, this, direction.x, direction.y, direction.z);
            fireball.setPos(this.getX(), this.getY() + 1.5D, this.getZ());
            this.level.addFreshEntity(fireball);
        }
    }

    private void performFlamethrower(Player target) {
        Vec3 direction = target.position().subtract(this.position()).normalize();
        for (int i = 0; i < 10; i++) {
            Vec3 flamePos = this.position().add(direction.scale(i));
            this.level.setBlock(new BlockPos(flamePos.x, flamePos.y, flamePos.z), Blocks.FIRE.defaultBlockState(), 11);
        }
    }

    @Override
    public boolean hurt(DamageSource source, float amount) {
        return !source.isFire() && super.hurt(source, amount);
    }

    @Override
    protected void dropCustomDeathLoot(DamageSource source, int looting, boolean recentlyHit) {
        super.dropCustomDeathLoot(source, looting, recentlyHit);
        this.spawnAtLocation(Items.NETHERITE_AXE);


    }
}

Главный класс Ares.java:

package org.mymod.ares;

@Mod(Ares.MODID)
public class Ares {
    
    public static final String MODID = "ares";
  
    private static final Logger LOGGER = LogUtils.getLogger();
    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID);

    public static final RegistryObject<EntityType<AresEntity>> ARES = ENTITY_TYPES.register("ares",
            () -> EntityType.Builder.<AresEntity>of(AresEntity::new, MobCategory.MONSTER)
                    .sized(0.6F, 1.95F)
                    .build("ares"));

    public Ares() {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

        ENTITY_TYPES.register(modEventBus);
        modEventBus.addListener(this::commonSetup);


        MinecraftForge.EVENT_BUS.register(this);


    }

    private void commonSetup(final FMLCommonSetupEvent event) {

    }


   

    // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
    @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
    public static class ModEventSubscriber {
        @SubscribeEvent
        public static void registerAttributes(EntityAttributeCreationEvent event) {
            event.put(Ares.ARES.get(), AresEntity.createAttributes().build());


        }
    }
}

Ответы (0 шт):