Jump to content

Side-Only classes


sorash67

Recommended Posts

start by looking at the tutorials, play around with things and THEN ill help, someone spent time making a tutorial about it so dont make his effort be wasted

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

i managed to successfully SEND a packet, but the receiving didnt seem to work. i put a system print where the packet sends and it was fine, but where it's supposed to receive, nothing. unless im mistaken as to where the packet gets received.

 

-sorash67 || Skorpio

Link to comment
Share on other sites

i wonder if youd say this is incorrect:

@NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = { "MoreOresMod" }, packetHandler = PacketHandlerMoreOres.class)

 

packet handler:

package moreores;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;

import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;

public class PacketHandlerMoreOres implements IPacketHandler{

@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
	if(packet.channel.equals("MoreOresMod")){
		handlePacket(packet);
	}

}

public void handlePacket(Packet250CustomPayload packet){
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

	int randomInt1;
	int randomInt2;

	try{
		randomInt1 = inputStream.readInt();
		randomInt2 = inputStream.readInt();
	}catch(IOException e){
		e.printStackTrace();
		return;
	}

	System.out.println(randomInt1 + "" + randomInt2);
}

}

 

-sorash67 || Skorpio

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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