Jump to content

Recommended Posts

Posted

Hello all!

 

I'm still trying to get the hang of the 1.7 packet structure, and I think I know what the issue is here and where it occurs but I'm a bit confused as to how to actually fix it. I have other packets working but this one is being a bit of a pain.

 

I'm trying to send a packet when I press a key. When I press the button the keybinding tries to send the packet, but I get the following error: readerIndex(0) + length(4) exceeds writerIndex(1). This happens on the line which should be sending a packet. The packet should literally just contain the number 1. I read this as I'm not sending as much as the recieving code expects to see. In all the other packets I've sent I just create a new packet using the constructor and input the paramater I need. So given that my packet constructor takes in an int and saves it to a variable, shouldn't I send it like:

 

BaseClass.innerpowerChannel.sendToServer(new useAbilityPacket(keyPressed));

 

Where keyPressed is an int? Thanks in advance! I'll include the full code below:

 

Packet class:

 

package com.InnerPower.networking;

import io.netty.buffer.ByteBuf;

import cpw.mods.fml.common.network.ByteBufUtils;

import cpw.mods.fml.common.network.simpleimpl.IMessage;

 

public class useAbilityPacket implements IMessage

{

 

public int keyPressed;

 

 

    public useAbilityPacket(int k) {

        this.keyPressed=k;

    }

 

@Override

public void fromBytes(ByteBuf buf) {

buf.writeInt(this.keyPressed);

}

 

@Override

public void toBytes(ByteBuf buf) {

this.keyPressed=buf.readInt();

 

 

}

 

}

 

 

Packet Handler:

 

package com.InnerPower.networking;

 

 

import io.netty.buffer.ByteBuf;

 

import java.io.ByteArrayInputStream;

import java.io.DataInputStream;

import java.io.IOException;

 

import net.minecraft.entity.player.EntityPlayer;

 

import com.InnerPower.BaseClass;

import com.InnerPower.magicPlayer;

 

import cpw.mods.fml.common.network.simpleimpl.IMessage;

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;

import cpw.mods.fml.common.network.simpleimpl.MessageContext;

 

public class useAbilityPacketHandler implements IMessageHandler <useAbilityPacket, IMessage>

{

@Override

public IMessage onMessage(useAbilityPacket message, MessageContext ctx) {

useSpell(message, ctx);

return null;

}

 

private void useSpell( useAbilityPacket message,MessageContext ctx)

{

 

EntityPlayer player=BaseClass.proxy.getPlayerEntity(ctx);

magicPlayer props = magicPlayer.get(player);

 

int keyPressed=0;

keyPressed=message.keyPressed;

 

if(keyPressed == 0)

{

System.out.println("[inner Power] [Error] error in useAbilityPacketHandler! keypressed == 0 ");

 

return;

}

if(keyPressed==1)

{

 

if(props.isMage)

props.mageList.useSpell(props.activeSpellID, (EntityPlayer) player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID, (EntityPlayer)player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID, (EntityPlayer)player);

       

       

}

 

        if(keyPressed==2)

        {

        if(props.isMage)

        props.mageList.useSpell(props.activeSpellID2, (EntityPlayer)player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID2,(EntityPlayer) player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID2,(EntityPlayer) player);

 

        }

        if(keyPressed==3)

        {

        if(props.isMage)

        props.mageList.useSpell(props.activeSpellID3,(EntityPlayer) player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID3,(EntityPlayer) player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID3,(EntityPlayer) player);

 

        }

        if(keyPressed==4)

        {

      if(props.isMage)

      props.mageList.useSpell(props.activeSpellID4, (EntityPlayer)player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID4,(EntityPlayer) player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID4,(EntityPlayer) player);

 

        }

 

 

}

}

 

 

Key Input Handler:

 

package com.InnerPower;

 

import java.io.ByteArrayOutputStream;

import java.io.DataOutputStream;

 

import javax.swing.text.JTextComponent.KeyBinding;

 

import net.minecraft.client.Minecraft;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import cpw.mods.fml.common.gameevent.InputEvent;

 

import com.InnerPower.BaseClass;

import com.InnerPower.networking.clientProjPacket;

import com.InnerPower.networking.useAbilityPacket;

 

public class KeyInputHandler

{

//member fields

int keyPressed = 0;

 

@SubscribeEvent

public void onKeyInput(InputEvent.KeyInputEvent event)

{

//net.minecraft.client.settings.KeyBinding[] keyBindings= BaseClass.keyBindings;

if(BaseClass.keyBindings[0].isPressed())

{

keyPressed = 1;

}

else if(BaseClass.keyBindings[1].isPressed())

{

keyPressed= 2;

}

else if(BaseClass.keyBindings[2].isPressed())

{

keyPressed= 3;

}

else if(BaseClass.keyBindings[3].isPressed())

{

keyPressed= 4;

}

 

if (Minecraft.getMinecraft().inGameHasFocus)

{

 

//I think the issue is here

  BaseClass.innerpowerChannel.sendToServer(new useAbilityPacket(keyPressed));

 

}

 

}

 

}

 

Posted

Right. I forgot the default constructor. I'll fix that :P

 

Here is the full error log:

 

 

[22:12:05] [Client thread/ERROR] [FML]: FMLIndexedMessageCodec exception caught

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:207) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_5_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1962) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

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:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:23) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[22:12:05] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:207) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_5_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1962) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

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:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:23) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[22:12:05] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:207) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_5_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:539) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1962) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

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:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:23) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

 

 

Thanks again!

Posted

Quick qestion relating to this (it's been awhile since I've updated Forge and all the tutorials just show the setup from scratch). I've downloaded a new version of forge and run gradlew setupDecompWorkspace and gradlew eclipse, but in eclipse the forge changelog under src still shows version 1180. How do I get my current eclipse project running with the new version Forge? (I thought thats what gradlew eclipse did).

 

Thanks again in advance. Most of the resources I'm finding show the setup from scratch but not how to update a current project.

Posted

I'm not sure I did this right. In the directory for forge 1180 I changed the build.gradle version number to:

 

version = "1.7.10-10.13.4.1448-1.7.10"

 

and ran gradlew setupDecompWorkspace in that directory. A lot of items seem to be skipping here. When I open Eclipse I still see the changelog titled "  forge-1.7.10-10.13.0.1180-changelog.txt  ". Am I changeing the version in the right place? And is there a better way to check which forge version I'm using in my eclipse project?

 

Thanks again for your help guys. I'm not too familiar with forge other than the actual coding part, so anything you can tell me is a huge help.

Posted

When you are in Eclipse, you can check which version of Forge you have referenced under 'Referenced Libraries'.

 

There should also be a 'build.gradle' file in the root directory of your project - that is the one you want to edit, though you don't have to do it from within Eclipse.

 

If, after editing that file and re-running gradlew's setup, you still do not have the updated version in your referenced libraries, try refreshing the workspace (F5) or running the setup command with the '--refresh-dependencies' argument. Sometimes even just opening up a package or file from within the Forge src (Minecraft or Forge) will cause it to update with its current version number, provided it was simply that the GUI was failing to update and not that Forge itself failed to update.

 

If both of those fail, you may have to manually set the Forge path - right click on the forgeSrc under Referenced Libraries, go to 'Build Path -> Configure Build Path', then click Edit and navigate to the build you want to use.

Posted

Thanks so much. So I am using the new version of forge now but that doesn't appear to be solving my issue here. I'll include the error log below again because it looks a little different this time (which could be due to the new forge version).

 

 

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[20:58:54] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[20:58:54] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[20:58:55] [Client thread/ERROR] [FML]: FMLIndexedMessageCodec exception caught

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[20:58:55] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

[20:58:55] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236) [simpleNetworkWrapper.class:?]

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48) [KeyInputHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic) [?:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?]

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160) ~[AbstractByteBuf.class:?]

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611) ~[AbstractByteBuf.class:?]

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27) ~[useAbilityPacket.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7) ~[simpleIndexedCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:?]

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:?]

... 25 more

Oct 07, 2015 8:58:55 PM io.netty.channel.embedded.EmbeddedChannel recordException

WARNING: More than one exception was raised. Will report only the first one and log others.

io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107)

at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)

at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644)

at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698)

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688)

at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717)

at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893)

at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239)

at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToServer(SimpleNetworkWrapper.java:236)

at com.InnerPower.KeyInputHandler.onKeyInput(KeyInputHandler.java:48)

at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_KeyInputHandler_onKeyInput_KeyInputEvent.invoke(.dynamic)

at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)

at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138)

at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1965)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040)

at net.minecraft.client.Minecraft.run(Minecraft.java:962)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 0, widx: 1, cap: 256)

at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1160)

at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:611)

at com.InnerPower.networking.useAbilityPacket.toBytes(useAbilityPacket.java:27)

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:11)

at cpw.mods.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:7)

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:51)

at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67)

at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89)

... 25 more

 

Posted

I did add the default constructor, but here is all the relevant code:

 

Registration:

 

@EventHandler

      public void preInit(FMLPreInitializationEvent event)

  {

     

  //Adding to registry

 

  //Event handlers

  FMLCommonHandler.instance().bus().register(new KeyInputHandler());

  //Packets

  innerpowerChannel = NetworkRegistry.INSTANCE.newSimpleChannel("innerpowerChannel");

  innerpowerChannel.registerMessage(spellPacketHandler.class, spellPacket.class, 0, Side.SERVER);

 

  innerpowerChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, Side.CLIENT);

 

  innerpowerChannel.registerMessage(mobVelPacketHandler.class, mobVelPacket.class, 2, Side.SERVER);

 

  innerpowerChannel.registerMessage(clientOnlyPacketHandler.class, clientOnlyPacket.class, 3, Side.SERVER);

 

  innerpowerChannel.registerMessage(clientProjPacketHandler.class, clientProjPacket.class, 4, Side.CLIENT);

 

  innerpowerChannel.registerMessage(useAbilityPacketHandler.class, useAbilityPacket.class, 5, Side.SERVER);

 

 

 

Key Input Handler:

 

public class KeyInputHandler

{

//member fields

int keyPressed = 0;

 

@SubscribeEvent

public void onKeyInput(InputEvent.KeyInputEvent event)

{

//net.minecraft.client.settings.KeyBinding[] keyBindings= BaseClass.keyBindings;

if(BaseClass.keyBindings[0].isPressed())

{

keyPressed = 1;

}

else if(BaseClass.keyBindings[1].isPressed())

{

keyPressed= 2;

}

else if(BaseClass.keyBindings[2].isPressed())

{

keyPressed= 3;

}

else if(BaseClass.keyBindings[3].isPressed())

{

keyPressed= 4;

}

 

if (Minecraft.getMinecraft().inGameHasFocus)

{

 

 

 

 

if (Minecraft.getMinecraft().thePlayer.worldObj.isRemote) {

                            //issue here

      BaseClass.innerpowerChannel.sendToServer(new useAbilityPacket(keyPressed));

}

 

 

}

 

}

 

}

 

 

 

Packet Class:

 

public class useAbilityPacket implements IMessage

{

 

public int keyPressed;

 

 

    public useAbilityPacket(int k) {

        this.keyPressed=k;

    }

 

    public useAbilityPacket() {

        this.keyPressed=-1;

    }

   

@Override

public void fromBytes(ByteBuf buf) {

buf.writeInt(this.keyPressed);

}

 

@Override

public void toBytes(ByteBuf buf) {

this.keyPressed=buf.readInt();

 

 

}

 

}

 

 

Packet Handler:

 

 

public class useAbilityPacketHandler implements IMessageHandler <useAbilityPacket, IMessage>

{

@Override

public IMessage onMessage(useAbilityPacket message, MessageContext ctx) {

useSpell(message, ctx);

return null;

}

 

private void useSpell( useAbilityPacket message,MessageContext ctx)

{

 

EntityPlayer player=BaseClass.proxy.getPlayerEntity(ctx);

magicPlayer props = magicPlayer.get(player);

 

int keyPressed=0;

keyPressed=message.keyPressed;

 

if(keyPressed == 0)

{

System.out.println("[inner Power] [Error] error in useAbilityPacketHandler! keypressed == 0 ");

 

return;

}

if(keyPressed==1)

{

 

if(props.isMage)

props.mageList.useSpell(props.activeSpellID, (EntityPlayer) player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID, (EntityPlayer)player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID, (EntityPlayer)player);

       

       

}

 

        if(keyPressed==2)

        {

        if(props.isMage)

        props.mageList.useSpell(props.activeSpellID2, (EntityPlayer)player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID2,(EntityPlayer) player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID2,(EntityPlayer) player);

 

        }

        if(keyPressed==3)

        {

        if(props.isMage)

        props.mageList.useSpell(props.activeSpellID3,(EntityPlayer) player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID3,(EntityPlayer) player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID3,(EntityPlayer) player);

 

        }

        if(keyPressed==4)

        {

      if(props.isMage)

      props.mageList.useSpell(props.activeSpellID4, (EntityPlayer)player);

        if(props.isUnholy)

        props.necroList.useSpell(props.activeSpellID4,(EntityPlayer) player);

        if(props.isHoly)

        props.holyList.useSpell(props.activeSpellID4,(EntityPlayer) player);

 

        }

 

 

}

}

 

 

Please let me know if there is anything relevant that I've left out. Thanks again!

Posted

I figured it out! It was a super stupid mistake like I thought, but my fromBytes method was writing and my toBytes method was reading, when it should have been the other way around! I'm having other issues now but they aren't related to this so I'll try and solve it on my own and mark this as solved! Thanks again for your help guys!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.