auioc / ExtraChampions

A Champions Addon adds some new affixes and misc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] 天境的鸡蛇获取到某个词缀后导致崩溃

Dr-WeiAL opened this issue · comments

commented

在只加了强敌mod的情况下不会崩溃,再加上这个mod后才出现崩溃
原版生物测试了不会崩溃,放几个精英鸡蛇就出问题了(
crash-2022-05-18_11.58.49-server.txt

天境构建链接:https://output.circle-artifacts.com/output/job/6ce8a1c8-53fe-4a39-91f1-f776ee60f7e5/artifacts/0/~/project/build/libs/aether-1.18.2-v1.0.0.jar

Fury词缀是通过为实体的 generic.attack_damage 属性添加运算模式为最终倍乘的修饰符来实现的,从堆栈跟踪可发现,崩溃是由无法获取实体的此属性导致的。

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.attributes.AttributeInstance.m_22130_(net.minecraft.world.entity.ai.attributes.AttributeModifier)" because "attr" is null
	at org.auioc.mcmod.extrachampions.common.affix.impl.FuryAffix.onServerUpdate(FuryAffix.java:33) ~[extrachampions-1.18.2-1.1.2.jar%2352!/:1.1.2] {re:classloading}

查阅 The Aether 模组的源码可知其 Cockatrice 实体虽被归类为 monster,但其属性扩展于原版 Mob 的属性,故并无 generic.attack_damage 属性。

// https://github.com/Gilded-Games/The-Aether/blob/8f3fbafdee69fbd83a448a7144104983eb10204f/src/main/java/com/gildedgames/aether/common/entity/monster/Cockatrice.java#L74-L75
@Nonnull
public static AttributeSupplier.Builder createMobAttributes() {
    return Mob.createMobAttributes()
            .add(Attributes.MAX_HEALTH, 20.0)
            .add(Attributes.MOVEMENT_SPEED, 0.25);
}
// Minecraft 1.18.2, Forge 40.1.0, Mapped official
// net.minecraft.world.entity.Mob L136-L138
public static AttributeSupplier.Builder createMobAttributes() {
    return LivingEntity.createLivingAttributes().add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.ATTACK_KNOCKBACK);
}

综上所述,此实体并不适合应用Fury词缀,我们建议您将其添加到黑名单中。
在下一个版本中,我们将调整代码,使该词缀被应用到不适合的实体上时输出警告信息,而不会导致崩溃。

commented

好的,我将鸡蛇加入Fury词缀黑名单后不再出现崩溃