Jump to content

Recommended Posts

Posted

Hey, I seem to be having a problem with my packet handling system. For some reason, the server keeps freezing up on me. I have my code and error logs below:

 

Error:

 

 

2012-12-20 18:36:09 [iNFO] [ForgeModLoader] Forge Mod Loader version 4.5.2.459 for Minecraft 1.4.5 loading

2012-12-20 18:36:10 [iNFO] [sTDOUT] 27 achievements

2012-12-20 18:36:11 [iNFO] [sTDOUT] 208 recipes

2012-12-20 18:36:11 [iNFO] [sTDOUT] Setting user: Player83, -

2012-12-20 18:36:11 [iNFO] [sTDERR] Client asked for parameter: server

2012-12-20 18:36:11 [iNFO] [sTDOUT] LWJGL Version: 2.4.2

2012-12-20 18:36:12 [iNFO] [ForgeModLoader] Attempting early MinecraftForge initialization

2012-12-20 18:36:12 [iNFO] [sTDOUT] MinecraftForge v6.4.1.407 Initialized

2012-12-20 18:36:12 [iNFO] [ForgeModLoader] MinecraftForge v6.4.1.407 Initialized

2012-12-20 18:36:12 [iNFO] [sTDOUT] Replaced 84 ore recipies

2012-12-20 18:36:12 [iNFO] [ForgeModLoader] Completed early MinecraftForge initialization

2012-12-20 18:36:12 [iNFO] [ForgeModLoader] Searching C:\Modding\1.4.5\BL2 407\jars\mods for mods

2012-12-20 18:36:12 [iNFO] [ForgeModLoader] Attempting to reparse the mod container bin

2012-12-20 18:36:13 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 6 mods to load

2012-12-20 18:36:13 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0

2012-12-20 18:36:14 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 6 mods

2012-12-20 18:36:33 [iNFO] [sTDOUT] Connecting to 127.0.0.1, 25565

2012-12-20 18:37:34 [iNFO] [sTDERR] java.net.SocketTimeoutException: Read timed out

2012-12-20 18:37:34 [iNFO] [sTDERR] at java.net.SocketInputStream.socketRead0(Native Method)

2012-12-20 18:37:34 [iNFO] [sTDERR] at java.net.SocketInputStream.read(Unknown Source)

2012-12-20 18:37:34 [iNFO] [sTDERR] at java.net.SocketInputStream.read(Unknown Source)

2012-12-20 18:37:34 [iNFO] [sTDERR] at java.io.FilterInputStream.read(Unknown Source)

2012-12-20 18:37:34 [iNFO] [sTDERR] at org.bouncycastle.crypto.io.CipherInputStream.func_74852_a(CipherInputStream.java:42)

2012-12-20 18:37:34 [iNFO] [sTDERR] at org.bouncycastle.crypto.io.CipherInputStream.read(CipherInputStream.java:108)

2012-12-20 18:37:34 [iNFO] [sTDERR] at java.io.FilterInputStream.read(Unknown Source)

2012-12-20 18:37:34 [iNFO] [sTDERR] at net.minecraft.src.Packet.readPacket(Packet.java:138)

2012-12-20 18:37:34 [iNFO] [sTDERR] at net.minecraft.src.TcpConnection.readPacket(TcpConnection.java:317)

2012-12-20 18:37:34 [iNFO] [sTDERR] at net.minecraft.src.TcpConnection.readNetworkPacket(TcpConnection.java:537)

2012-12-20 18:37:34 [iNFO] [sTDERR] at net.minecraft.src.TcpReaderThread.run(TcpReaderThread.java:23)

 

 

 

Sent Packet(Server):

 

 

public void sendParticlePacket(World world, double x, double y, double z, EntityPlayer player, int inventoryIndex){

try{

    ByteArrayOutputStream baout = new ByteArrayOutputStream();

            DataOutputStream out = new DataOutputStream(baout);

            out.writeByte(0);

            out.writeInt(world.provider.dimensionId);

            out.writeInt(inventoryIndex);

            out.writeDouble(x);

            out.writeDouble(y);

            out.writeDouble(z);

            out.writeInt(player.entityId);

            out.close();

            Packet250CustomPayload packet = new Packet250CustomPayload();

            packet.channel = "bl2";

            packet.isChunkDataPacket = false;

            packet.data = baout.toByteArray();

            packet.length = baout.size();

            Iterator<EntityPlayer> players = world.playerEntities.iterator();

 

            while (players.hasNext())

            {

                EntityPlayer otherplayer = players.next();

               

                if (otherplayer.getDistanceSqToEntity(player) < 256.0D)

                {

               

                    PacketDispatcher.sendPacketToPlayer(packet, (Player)otherplayer);

                }

            }

        }

        catch (Exception ex)

        {

        ex.printStackTrace();

        }

}

 

 

 

Received Packet(Client):

 

 

public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player p)

    {

//System.out.println("recieved packet");

        ByteArrayInputStream in = new ByteArrayInputStream(packet.data, 1, packet.data.length - 1);

 

        try

        {

 

        if(packet.data.length < 1)

        {

       

        System.out.println("No packets");

       

        }

       

            switch (packet.data[0])

            {

                case NetworkHandler.particlePacketID:

                {

                //System.out.println("spawned");

                DataInputStream din = new DataInputStream(in);

                byte dummy = din.readByte();

                int dimension = din.readInt();

                int index = din.readInt();

                    double x = din.readDouble();

                    double y = din.readDouble();

                    double z = din.readDouble();

                    int playerId = din.readInt();

                   

                    WorldClient world = Minecraft.getMinecraft().theWorld;

 

                    EntityPlayer player = (EntityPlayer) world.getEntityByID(playerId);

                   

                    if (world.provider.dimensionId != dimension)

                    {

                        return;

                    }

                    //EntityPlayer player = world.getPlayerEntityByName(username);

                   

                }

            }

        }

        catch (IOException var22)

        {

            var22.printStackTrace();

        }

}

 

 

 

If you have any idea why this is happening, please reply.

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



×
×
  • Create New...

Important Information

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