Arclight icon indicating copy to clipboard operation
Arclight copied to clipboard

[1.18.X]神化(Apotheosis)模组依然无法加载

Open skniro opened this issue 2 years ago • 4 comments

请确认您已完成以下几件事

  • [X] 正在使用最新的 Arclight
  • [x] 已为所有插件及模组安装依赖
  • [x] 已为所有插件及模组更新至最新版
  • [X] 不可在 Spigot 复现
  • [X] 不可在 Forge 复现

Arclight 版本

arclight-forge-1.18.2-1.0.6-SNAPSHOT-f980461

Java 版本 | 操作系统

Windows 10 openjdk version "17.0.1" 2021-10-19

相关 Mod/插件 的名称及版本

forge mod:
Apotheosis-1.18.2-5.3.6
Placebo-1.18.2-6.4.1
plugin:
无

错误描述

启动服务器就崩溃,移除神化(Apotheosis)后启动正常,在forge服务器启动正常

复现步骤

No response

报错信息

latest.log

复现用压缩包下载链接(可选)

No response

skniro avatar Jun 25 '22 06:06 skniro

目前找到一个方法可以在arclight上加载Apotheosis 打开jar文件里的apotheosis.mixins.json文件 删除mixin参数里的”LivingEntityMixin, “保存修改到jar文件中即可 目前测试不会对mod的功能造成影响。

skniro avatar Jul 08 '22 13:07 skniro

看来代码,可能影响破甲效果

heipiao233 avatar Jul 08 '22 14:07 heipiao233

原因是神化使用了兼容性不好的Overwrite注解修改代码(用这个注解改过就不允许别的mod再改了),他们说将来会转为兼容性好的Inject注解

heipiao233 avatar Jul 08 '22 14:07 heipiao233

我会试试去给模组提一个pr把他的Overwrite改成两个Redirect,具体来说实现是这样: LivingEntityMixin.java

	/**
	 * Enable RESISTANCE logic when either RESISTANCE and SUNDERING is present.
	 * Called from {@link LivingEntity#getDamageAfterMagicAbsorb(DamageSource, float)}
	 */
	@Redirect(method = "getDamageAfterMagicAbsorb", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;hasEffect(Lnet/minecraft/world/effect/MobEffect;)Z", ordinal = 0))
	public boolean getDamageAfterMagicAbsorb_hasEffect(LivingEntity instance, MobEffect effect) {
		assert MobEffects.DAMAGE_RESISTANCE == effect; // this indicates that code related to RESISTANCE remains unchanged
		return this.hasEffect(effect) || this.hasEffect(Apoth.Effects.SUNDERING);
	}


	/**
	 * Calculate the equivalent RESISTANCE amplifier with SUNDERING considered.
	 * Called from {@link LivingEntity#getDamageAfterMagicAbsorb(DamageSource, float)}
	 */
	@Redirect(method = "getDamageAfterMagicAbsorb", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/effect/MobEffectInstance;getAmplifier()I"))
	public int getDamageAfterMagicAbsorb_getAmplifier(MobEffectInstance instance) {
		int amplifier = 0;
		if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE)) {
			amplifier += this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1;
		}
		if (Apoth.Effects.SUNDERING != null && this.hasEffect(Apoth.Effects.SUNDERING)) {
;			amplifier -= this.getEffect(Apoth.Effects.SUNDERING).getAmplifier() + 1;
		}


		return amplifier - 1; // the return value of this method added by 1, so we need to subtract 1 to get the correct value
	}

因为神化模组的破甲和抗性效果是加法叠加而不是乘法叠加,就会导致很多麻烦。这个实现相当于把这两个效果放在一起来算出一个等效抗性来计算。

但是这样和Arclight还是会有一点冲突,具体是这里 https://github.com/IzzelAliz/Arclight/blob/6a6a573a7d38b4bce2332b008dbe39def7d42f47/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/LivingEntityMixin.java#L706-L720 arclight$mutePotion被覆盖了会导致抗性被计算两次。 有一个很dirty的workaround是在damageEntity0里面计算magicModifier前把抗性的amplifier改成-1,计算完之后再改回来,我不确定这样是否合适,不过这样改可以去掉arclight$mutePotion,好像就不会和神化冲突了。也有可能神化那边也要改写法,如果能讨论出一个方案我再在两边提pr叭。

yanang007 avatar Aug 15 '22 11:08 yanang007