If I only write a sidemod with some custom abilities and write
{ "className" : "my.package.MyAbilityClassName" } in datapack without register them, then every time I enter the game, it logs some error messages about ability registration. However, the abilities work well, only log some extra things.
Here's an example of error logs about my custom ability: Mental Barrier, which extends the AbstractAbility class and does work well in game:
Code: Select all[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: java.lang.NoSuchFieldException: MENTAL_BARRIER
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at java.lang.Class.getField(Class.java:1703)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry.register(AbilityRegistry.java:337)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry.readFromBuffer(AbilityRegistry.java:480)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.comm.packetHandlers.sync.SyncAbilityPacket.decode(SyncAbilityPacket.java:26)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.comm.PacketRegistry.decodeUsingSupplier(PacketRegistry.java:462)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.comm.PacketRegistry.lambda$register$0(PacketRegistry.java:439)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.network.IndexedMessageCodec.lambda$tryDecode$0(IndexedMessageCodec.java:120)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at java.util.Optional.map(Optional.java:215)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.network.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:120)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.network.IndexedMessageCodec.consume(IndexedMessageCodec.java:162)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at com.pixelmonmod.pixelmon.network.SimpleChannel.networkEventListener(SimpleChannel.java:78)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:72)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:77)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at java.util.Optional.map(Optional.java:215)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:77)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.client.network.play.ClientPlayNetHandler.func_147240_a(ClientPlayNetHandler.java:1904)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.network.play.server.SCustomPayloadPlayPacket.func_148833_a(SCustomPayloadPlayPacket.java:59)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.network.play.server.SCustomPayloadPlayPacket.func_148833_a(SCustomPayloadPlayPacket.java:11)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213160_bf(SourceFile:103)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:948)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraft.client.main.Main.main(Main.java:184)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at java.lang.reflect.Method.invoke(Method.java:498)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:82)
[11:23:40] [Render thread/INFO]: [com.pixelmonmod.pixelmon.api.pokemon.ability.AbilityRegistry:register:343]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)
Have figured out that it's 'cause our abilities registration is holded via fields reflection in class: AbilityRegistry, but the new abilities that are added by me will not automatically be a part of the fields in AbilityRegistry class. My solution is to create a class to record my new abilities as its fields and add the new class to OBJECT_HOLDERS in AbilityRegistry to let it be an object holder, but the game still logs since it'll iterate all classes in OBJECT_HOLDERS and the default one would be used for custom abilities registration first.
Have no idea for the solution of this situation. Hope that u could make some changes about the abilities registration logic. Thanks~