AcademyCraft

AcademyCraft

1M Downloads

Player skill level not correctly synchronized

WeAthFoLD opened this issue ยท 1 comments

commented

This happens when I created a LAN world and let another client to come into my server. When I use a ArcGen skill, another client crashes. Within the skill I used skillLevel to do calculation.

[21:01:54] [Client thread/INFO]: [CHAT] Teleported WeAthFolD to WeAthFolD2
[21:01:58] [Client thread/INFO]: [CHAT] Your game mode has been updated
Pahfalse
[21:02:05] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception
java.lang.ArrayIndexOutOfBoundsException: -1
    at cn.academy.api.data.AbilityData.getSkillLevel(AbilityData.java:191) ~[AbilityData.class:?]
    at cn.academy.ability.electro.entity.EntityAttackingArc.<init>(EntityAttackingArc.java:44) ~[EntityAttackingArc.class:?]
    at cn.academy.ability.electro.entity.EntityAttackingArc$OffSync.<init>(EntityAttackingArc.java:31) ~[EntityAttackingArc$OffSync.class:?]
    at cn.academy.ability.electro.skill.SkillArcGen$StateArc.onStart(SkillArcGen.java:78) ~[SkillArcGen$StateArc.class:?]
    at cn.academy.api.ctrl.SkillState.startSkill(SkillState.java:57) ~[SkillState.class:?]
    at cn.academy.api.ctrl.SkillStateMessage$Handler.onMessage(SkillStateMessage.java:122) ~[SkillStateMessage$Handler.class:?]
    at cn.academy.api.ctrl.SkillStateMessage$Handler.onMessage(SkillStateMessage.java:1) ~[SkillStateMessage$Handler.class:?]
    at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:34) ~[SimpleChannelHandlerWrapper.class:?]
    at cpw.mods.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:14) ~[SimpleChannelHandlerWrapper.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) [SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) [SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:101) [SimpleChannelInboundHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) [NetworkManager.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:321) [PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1650) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:997) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:912) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
commented

On client side, you can only access AbilityData of thePlayer. Save the skillLevel in packet if you want to use it in SkillState (by overriding toNBT and fromNBT).