Jump to content

[1.7.2] Packets Help Byte-Int[UNSOLVED]


Heltrato

Recommended Posts

Hello everyone im trying to update my AI Packets for my mod however since Packets now use bytes often im having issues with my sendingPackets it often crashes here

 

public class Packet02 extends AbstractPacket{

private byte animID;
private int entityID;

public Packet02(int id, EntityMob mob) {
	animID = (byte) id;
	entityID = tigrex.getEntityId();
}

@Override
public void encodeInto(ChannelHandlerContext paramChannelHandlerContext, ByteBuf x) {
	x.writeByte(animID);
	x.writeInt(entityID);
}

@Override
public void decodeFrom(ChannelHandlerContext paramChannelHandlerContext, ByteBuf x) {
	animID = x.readByte();
	entityID = x.readInt();
}

@Override
public void handleClientSide(EntityPlayer paramEntityPlayer) {
	EntityMob mob= (EntityMob)paramEntityPlayer.worldObj.getEntityByID(entityID);
	if(mob != null && animID != -1) {
		mob.setAnimID(animID);
		if(animID == 0) mob.setAnimTick(0);
	}
}

@Override
public void handleServerSide(EntityPlayer paramEntityPlayer) {

}

}


 

specifically this line which causes the crash

 

x.writeByte(animID);

 

also this is the entity code that sends the packet to its AI

 

public void sendAttackPacket(int id){
        if(ModMain.isEffectiveClient())
        {
            return;
        }
        currentAttackID = id;
        MHFCMain.pipe.sendToAll(new Packet02(id, this));
      
    }

Link to comment
Share on other sites

Why you ignore the argument that is the mob and use a hardcoded entity instance?

public Packet02(int id, EntityMob mob) {
	animID = (byte) id;
	entityID = tigrex.getEntityId();
}

In other words, "tigrex" is not an argument to the Packet02 constructor, so where's it from? What's wrong with the argument "mob"?

Link to comment
Share on other sites

Hi

 

If the error is on this line, I imagine it is a "Null Pointer Exception", yes?

		x.writeByte(animID);

 

That probably means you are calling

	@Override
public void encodeInto(ChannelHandlerContext paramChannelHandlerContext, ByteBuf x) {
	x.writeByte(animID);
	x.writeInt(entityID);
}

with an argument x that is null.

 

If you can figure out why that is happening, you'll be a step closer...

 

-TGG

 

 

 

Link to comment
Share on other sites

I fix some issues somehow but still having some crash issues

 

heres the crash found in the eclipse console

 

[09:27:13] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel mhfc
io.netty.handler.codec.DecoderException: java.lang.InstantiationException: mhfc.net.common.packet.Packet02Tigrex
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[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:80) [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:1647) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:994) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:910) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
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:?]
Caused by: java.lang.InstantiationException: mhfc.net.common.packet.Packet02Tigrex
at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_51]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:93) ~[PacketPipeline.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:1) ~[PacketPipeline.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 18 more

 

 

My Packet

 

package mhfc.net.common.packet;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mhfc.net.client.entity.mob.EntityTigrex;
import mhfc.net.common.implement.iMHFC;
import net.minecraft.entity.player.EntityPlayer;

public class Packet02Tigrex extends AbstractPacket{

private int attackID;
private int entityID;

public Packet02Tigrex(int id, EntityTigrex tigrex){
	attackID = id;
	entityID = tigrex.getEntityId();
}

@Override
public void encodeInto(ChannelHandlerContext paramChannelHandlerContext, ByteBuf buff) {
	buff.writeInt(attackID);
	buff.writeInt(entityID);
}

@Override
public void decodeFrom(ChannelHandlerContext paramChannelHandlerContext, ByteBuf buff) {
	attackID = buff.readInt();
	entityID = buff.readInt();
}

@Override
public void handleClientSide(EntityPlayer player) {
	EntityTigrex entity = (EntityTigrex)player.worldObj.getEntityByID(entityID);
	if ((entity != null) && (attackID != -1)) {
		entity.currentAttackID = attackID;
	if (attackID == 0) entity.animTick = 0;
	}
}

@Override
public void handleServerSide(EntityPlayer player) {

}

}

Link to comment
Share on other sites

You need to have a standard constructor without parameters, like

public Packet02Tigrex() {...}

It happened to me, too. ;)

The constructor can be completely empty.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Just did it a while ago and now gives me this crash

 

io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[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:80) [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:1647) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:994) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:910) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
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:?]
Caused by: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:241) ~[AbstractByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.writeInt(AbstractByteBuf.java:776) ~[AbstractByteBuf.class:?]
at mhfc.net.common.packet.Packet02Tigrex.encodeInto(Packet02Tigrex.java:24) ~[Packet02Tigrex.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:94) ~[PacketPipeline.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:1) ~[PacketPipeline.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 18 more

I just cant understand why this packet does it

Link to comment
Share on other sites

Just did it a while ago and now gives me this crash

 

io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[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:80) [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:1647) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:994) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:910) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
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:?]
Caused by: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:241) ~[AbstractByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.writeInt(AbstractByteBuf.java:776) ~[AbstractByteBuf.class:?]
at mhfc.net.common.packet.Packet02Tigrex.encodeInto(Packet02Tigrex.java:24) ~[Packet02Tigrex.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:94) ~[PacketPipeline.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:1) ~[PacketPipeline.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 18 more

I just cant understand why this packet does it

 

can you give us the new packet code and possibly your pipeline class (the type class of MHFCMain.pipe)?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

here mate

 

Main Class

package mhfc.net;

import mhfc.net.client.lib.MHFCReference;
import mhfc.net.client.tab.MHFCTab;
import mhfc.net.common.MHFCCommon;
import mhfc.net.common.configuration.MHFCConfig;
import mhfc.net.common.handler.MHFCGuiHandler;
import mhfc.net.common.handler.MHFCTickHandler;
import mhfc.net.common.packet.Packet01Anim;
import mhfc.net.common.packet.Packet02Tigrex;
import mhfc.net.common.packet.PacketPipeline;
import mhfc.net.common.registry.MHFCReg;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;


/**
* 
* This Main File is owned by the MHF Modding Team
* 
* @author <Heltrato>
* @license MHFModding Team Copyright (http://www.minecraftforum.net/topic/1977334-164spmp-monster-hunter-frontier-craft-extreme-mob-hunting-adventure-15000-downloads/) 
* Visit www.mhfrontiercraft.blogspot.com for more info.
* 
*/

@Mod(modid = MHFCMain.modid, name = MHFCReference.name, version = MHFCReference.version)

public class MHFCMain {
@SidedProxy(clientSide = "mhfc.net.client.MHFCClient", serverSide = "mhfc.net.common.MHFCCommon")
public static MHFCCommon proxy;
public static MHFCConfig launch;
public static MHFCReg	 reg;
public static MHFCTickHandler handler;
public static final PacketPipeline packetpipeline = new PacketPipeline();
@Mod.Instance("mhfc")
public static MHFCMain instance;
// Mod References	
public static final String modid = "mhfc";
public static final String authors = "Heltrato , Karseus , Shaduun, Aleksandair, NightCrow";
// Mod Statics
public static final String[] fTimer;
public static boolean explosionsDestroyBlocks = true;
public static int startEntityId = 300;
public static CreativeTabs mhfctabs = new MHFCTab(CreativeTabs.getNextID(),"MHFC Tab");

//	
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent pre){
	launch.init(pre);
	pre.getModMetadata().logoFile = "MHFCLogo.png";
	handler = new MHFCTickHandler();
	MinecraftForge.EVENT_BUS.register(handler);
	 FMLCommonHandler.instance().bus().register(handler);
	NetworkRegistry.INSTANCE.registerGuiHandler(this, new MHFCGuiHandler());

}
@Mod.EventHandler
public void load(FMLInitializationEvent event){
	packetpipeline.initialize();
	packetpipeline.registerPacket(Packet02Tigrex.class);
	packetpipeline.registerPacket(Packet01Anim.class);
	proxy.regSounds();
	proxy.regStuff();
	proxy.regTimer();
	proxy.regTick();
	proxy.regCapes();
}

@Mod.EventHandler
public void postInit(FMLPostInitializationEvent e) {
	packetpipeline.postInitialize();
}

public static boolean isClient(){
	return FMLCommonHandler.instance().getSide().isClient();
}
public static boolean isEffectiveClient(){
	return FMLCommonHandler.instance().getEffectiveSide().isClient();
}
static {
	fTimer = new String[] {"field_71428_T", "S", "timer"};
}
public static void onRenderTick() {}
public static void onClientTick() {}
public static void onServerTick() {}
}

 

new packet

 

package mhfc.net.common.packet;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import mhfc.net.client.entity.mob.EntityTigrex;
import mhfc.net.common.implement.iMHFC;
import net.minecraft.entity.player.EntityPlayer;

public class Packet02Tigrex extends AbstractPacket{

private int attackID;
private int entityID;

public Packet02Tigrex(){

}
public Packet02Tigrex(int id, EntityTigrex tigrex){
	attackID = id;
	entityID = tigrex.getEntityId();
}

public void encodeInto(ChannelHandlerContext paramChannelHandlerContext, ByteBuf buff) {
	buff.writeInt(attackID);
	buff.writeInt(entityID);
}

public void decodeFrom(ChannelHandlerContext paramChannelHandlerContext, ByteBuf buff) {
	attackID = buff.readInt();
	entityID = buff.readInt();
}

public void handleClientSide(EntityPlayer player) {
	EntityTigrex entity = (EntityTigrex)player.worldObj.getEntityByID(entityID);
	if ((entity != null) && (attackID != -1)) {
		entity.currentAttackID = attackID;
	if (attackID == 0) entity.animTick = 0;
	}
}

public void handleServerSide(EntityPlayer player) {

}

}

Link to comment
Share on other sites

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Still crashes damn i cant understand what this CRITICAL ERROR MEANS .

 

[08:50:58] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel mhfc
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[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:80) [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:1647) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:994) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:910) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
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:?]
Caused by: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:241) ~[AbstractByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.writeInt(AbstractByteBuf.java:776) ~[AbstractByteBuf.class:?]
at mhfc.net.common.packet.Packet02Tigrex.encodeInto(Packet02Tigrex.java:23) ~[Packet02Tigrex.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:95) ~[PacketPipeline.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:1) ~[PacketPipeline.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 18 more

 

 

If i can find out what makes this

Link to comment
Share on other sites

Yeah man i tried my best to register it and debug but still these error crash come out

 

There was a critical exception handling a packet on channel mhfc
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[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:80) [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:1647) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:994) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:910) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
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:?]
Caused by: java.lang.IndexOutOfBoundsException: writerIndex( + minWritableBytes(4) exceeds maxCapacity(: SlicedByteBuf(ridx: 0, widx: 8, cap: 8/8, unwrapped: UnpooledHeapByteBuf(ridx: 1, widx: 9, cap: 9/9))
at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:241) ~[AbstractByteBuf.class:?]
at io.netty.buffer.AbstractByteBuf.writeInt(AbstractByteBuf.java:776) ~[AbstractByteBuf.class:?]
at mhfc.net.common.packet.Packet02Tigrex.encodeInto(Packet02Tigrex.java:23) ~[Packet02Tigrex.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:95) ~[PacketPipeline.class:?]
at mhfc.net.common.packet.PacketPipeline.decode(PacketPipeline.java:1) ~[PacketPipeline.class:?]
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
... 18 more

Link to comment
Share on other sites

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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