
[BUG]FML CoreMod在生产环境中无法正常工作
WakelessSloth56 opened this issue · 2 comments
nel.PlayerUnseiAttribute
(1d78cd1)
因此 CoreMod 未正常工作,未能为玩家添加运势属性,导致在玩家登入时会造成获取运势属性为 null
而登入失败。
[Server thread/ERROR]: Exception caught during firing event: Cannot invoke "net.minecraft.world.entity.ai.attributes.AttributeInstance.m_22100_(double)" because the return value of "net.minecraft.server.level.ServerPlayer.m_21051_(net.minecraft.world.entity.ai.attributes.Attribute)" is null
Index: 2
Listeners:
0: NORMAL
1: net.minecraftforge.eventbus.EventBus$$Lambda$4341/0x00000008016d9b20@27724183
2: ASM: class org.auioc.mods.notenoughluck.server.event.NELServerEventHandler onPlayerLogin(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V
3: ASM: net.minecraftforge.common.ForgeInternalHandler@6fa04819 playerLogin(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.attributes.AttributeInstance.m_22100_(double)" because the return value of "net.minecraft.server.level.ServerPlayer.m_21051_(net.minecraft.world.entity.ai.attributes.Attribute)" is null
at TRANSFORMER/[email protected]/org.auioc.mods.notenoughluck.server.event.handler.PlayerLoginHandler.handle(PlayerLoginHandler.java:15)
at TRANSFORMER/[email protected]/org.auioc.mods.notenoughluck.server.event.NELServerEventHandler.onPlayerLogin(NELServerEventHandler.java:46)
at net.minecraftforge.eventbus.ASMEventHandler_8_NELServerEventHandler_onPlayerLogin_PlayerLoggedInEvent.invoke(.dynamic)
......
[Server thread/ERROR]: Couldn't place player in world
[Server thread/INFO]: TestPlayer lost connection: 无效的玩家数据
-
在开发环境中通过
print(ASMAPI.methodNodeToString(methodNode));
导出转换后的字节码可发现 CoreMod 可按照预期运行:
[main/DEBUG] [ne.mi.fm.lo.FMLServiceProvider/CORE]: Loading coremod transformers
[main/DEBUG] [ne.mi.co.CoreModEngine/COREMOD]: Loading CoreMod from coremods/PlayerUnseiAttribute.js
[main/DEBUG] [ne.mi.co.CoreModEngine/COREMOD]: CoreMod loaded successfully
[main/DEBUG] [cp.mo.mo.TransformStore/MODLAUNCHER]: Adding transformer net.minecraftforge.coremod.transformer.CoreModMethodTransformer@5fa23c to Target : METHOD {Lnet/minecraft/world/entity/player/Player;} {createAttributes} {()Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;}
[main/DEBUG] [ne.mi.co.tr.CoreModBaseTransformer/COREMOD]: Transforming createAttributes with desc ()Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
L0
LINENUMBER 194 L0
INVOKESTATIC net/minecraft/world/entity/LivingEntity.createLivingAttributes ()Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC net/minecraft/world/entity/ai/attributes/Attributes.ATTACK_DAMAGE : Lnet/minecraft/world/entity/ai/attributes/Attribute;
DCONST_1
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;D)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC net/minecraft/world/entity/ai/attributes/Attributes.MOVEMENT_SPEED : Lnet/minecraft/world/entity/ai/attributes/Attribute;
LDC 0.10000000149011612
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;D)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC net/minecraft/world/entity/ai/attributes/Attributes.ATTACK_SPEED : Lnet/minecraft/world/entity/ai/attributes/Attribute;
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC net/minecraft/world/entity/ai/attributes/Attributes.LUCK : Lnet/minecraft/world/entity/ai/attributes/Attribute;
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC net/minecraftforge/common/ForgeMod.REACH_DISTANCE : Lnet/minecraftforge/registries/RegistryObject;
INVOKEVIRTUAL net/minecraftforge/registries/RegistryObject.get ()Lnet/minecraftforge/registries/IForgeRegistryEntry;
CHECKCAST net/minecraft/world/entity/ai/attributes/Attribute
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC net/minecraft/world/entity/ai/attributes/Attributes.ATTACK_KNOCKBACK : Lnet/minecraft/world/entity/ai/attributes/Attribute;
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
GETSTATIC org/auioc/mods/notenoughluck/common/attribute/NELAttributes.UNSEI : Lnet/minecraftforge/registries/RegistryObject;
INVOKEVIRTUAL net/minecraftforge/registries/RegistryObject.get ()Lnet/minecraftforge/registries/IForgeRegistryEntry;
CHECKCAST net/minecraft/world/entity/ai/attributes/Attribute
INVOKEVIRTUAL net/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder.add (Lnet/minecraft/world/entity/ai/attributes/Attribute;)Lnet/minecraft/world/entity/ai/attributes/AttributeSupplier$Builder;
ARETURN
MAXSTACK = 4
MAXLOCALS = 0