Jump to content

Recommended Posts

Posted

I setup my packet handling using a setup suggested to me by jabelar in this thread http://www.minecraftforge.net/forum/index.php/topic,18804.0.html I really like this setup because its simple and easy to use but I have a problem that I just cant figure out. It works perfectly when sending packets from the server to the client but I cant get it to work the other way (sending packets from the client to the server) This is my setup.

 

Server Packet handler:

 

import java.io.IOException;

import net.minecraft.client.Minecraft;
import net.minecraft.world.World;
import tolkienaddon.Tolkienaddon;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;

public class ServerPacketHandler {
protected String channelName;

@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent event) throws IOException
{
	//Debug
	World world = Minecraft.getMinecraft().theWorld;
	if (world.isRemote)
		System.out.println("Client: ServerCustomPacketEvent");
	else
		System.out.println("Server: ServerCustomPacketEvent");

	channelName = event.packet.channel();

	if (channelName == Tolkienaddon.networkChannelName) {
		PacketTolkienaddon.processPacketOnServerSide(event.packet.payload(), event.packet.getTarget());
	}
}
}

 

Client Packet handler:

 

import java.io.IOException;

import net.minecraft.client.Minecraft;
import net.minecraft.world.World;
import tolkienaddon.Tolkienaddon;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;

public class ClientPacketHandler extends ServerPacketHandler {
@SubscribeEvent
public void onClientPacket(ClientCustomPacketEvent event) throws IOException
{		
	//Debug
	World world = Minecraft.getMinecraft().theWorld;
	if (world.isRemote)
		System.out.println("Client: ClientCustomPacketEvent");
	else
		System.out.println("Server: ClientCustomPacketEvent");

	channelName = event.packet.channel();

	if (channelName == Tolkienaddon.networkChannelName) {
		PacketTolkienaddon.processPacketOnClientSide(event.packet.payload(), event.packet.getTarget());
	}
}
}

 

Packet:

 

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;

import java.io.IOException;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.client.interfaces.ContainerWeatherController;
import tolkienaddon.tileentities.TileWeatherController;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;

// this class is intended to be sent from server to client to keep custom entities synced
public class PacketTolkienaddon {
// define IDs for custom packet types
public final static byte packetTypeIDButton = 1;
public final static byte packetTypeIDTest = 2;

public PacketTolkienaddon() {
	// don't need anything here
}

public static FMLProxyPacket createButtonPacket(byte id, EntityPlayer player) throws IOException
{
	ByteBufOutputStream dataStream = new ByteBufOutputStream(Unpooled.buffer());
	int playerId = player.getEntityId();

	dataStream.writeByte(packetTypeIDButton);
	dataStream.writeByte(id);
	dataStream.writeInt(playerId);


	FMLProxyPacket thePacket = new FMLProxyPacket(dataStream.buffer(), Tolkienaddon.networkChannelName);

	dataStream.close();

	return thePacket;
}

public static FMLProxyPacket createTestPacket(byte id) throws IOException
{
	ByteBufOutputStream dataStream = new ByteBufOutputStream(Unpooled.buffer());
	//int playerId = player.getEntityId();

	dataStream.writeByte(packetTypeIDTest);
	dataStream.writeByte(id);
	//dataStream.writeInt(playerId);


	FMLProxyPacket thePacket = new FMLProxyPacket(dataStream.buffer(), Tolkienaddon.networkChannelName);

	dataStream.close();

	return thePacket;
}

public static void processPacketOnClientSide(ByteBuf parBB, Side parSide) throws IOException
{
	if (parSide == Side.CLIENT) {
		// DEBUG
		System.out.println("Received Packet Client Side");

		@SuppressWarnings("unused")
		World theWorld = Minecraft.getMinecraft().theWorld;
		ByteBufInputStream bbis = new ByteBufInputStream(parBB);

		// process data stream
		// first read packet type
		int packetTypeID = bbis.readByte();

		switch (packetTypeID) {
			case packetTypeIDTest: {
				byte data = bbis.readByte();

				if (!theWorld.isRemote)
					System.out.println("Server recived:" + data);
				else
					System.out.println("Client recived:" + data);

				break;
			}

		}

		// don't forget to close stream to avoid memory leak
		bbis.close();
	}
}

public static void processPacketOnServerSide(ByteBuf payload, Side parSide) throws IOException
{
	if (parSide == Side.SERVER) {
		// DEBUG
		System.out.println("Received Packet Server Side");

		World theWorld = Minecraft.getMinecraft().theWorld;
		ByteBufInputStream bbis = new ByteBufInputStream(payload);

		// process data stream
		// first read packet type
		int packetTypeID = bbis.readByte();

		switch (packetTypeID) {
			case packetTypeIDButton: {
				byte buttonId = bbis.readByte();
				int playerId = bbis.readInt();
				EntityPlayer player = (EntityPlayer) theWorld.getEntityByID(playerId); 
				Container container = player.openContainer;
				if (container != null && container instanceof ContainerWeatherController){
					TileWeatherController tileWC = ((ContainerWeatherController) container).getTileWC();
					if(!theWorld.isRemote){
						tileWC.reciveButtonEvent(buttonId);
						System.out.println("Server");
					}else
						System.out.println("Client");
				}
				break;
			}
			case packetTypeIDTest:{
				byte data = bbis.readByte();

				if (!theWorld.isRemote)
					System.out.println("Server recived:" + data);
			}
		}

		// don't forget to close stream to avoid memory leak
		bbis.close();

	}
}
}

 

Common Proxy: (this is where the Server packet handler is registered (removed unrelated code))

 

import net.minecraftforge.common.MinecraftForge;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.core.handler.packethandling.ServerPacketHandler;
import cpw.mods.fml.common.FMLCommonHandler;
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;
import cpw.mods.fml.common.registry.GameRegistry;

public class CommonProxy {

public void preInit(FMLPreInitializationEvent event)
{
}

public void init(FMLInitializationEvent event)
{
	registerNetworkingChannel();
	registerServerPacketHandler();
}

public void postInit(FMLPostInitializationEvent event)
{
}

public void registerNetworkingChannel()
{
	Tolkienaddon.channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(Tolkienaddon.networkChannelName);
}

public void registerServerPacketHandler()
{
	Tolkienaddon.channel.register(new ServerPacketHandler());
}
}

 

Client Proxy: (this is where the Client packet handler is registered (removed unrelated code))

 

import net.minecraftforge.client.MinecraftForgeClient;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.core.handler.packethandling.ClientPacketHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {

@Override
public void preInit(FMLPreInitializationEvent event)
{
	super.preInit(event);

	//Client Only
}

@Override
public void init(FMLInitializationEvent event)
{
	super.init(event);

	//Client Only
	registerClientPacketHandler();
}

@Override
public void postInit(FMLPostInitializationEvent event)
{
	super.postInit(event);

	//Client Only
}

private void registerClientPacketHandler()
{
	Tolkienaddon.channel.register(new ClientPacketHandler());
}
}

 

Test code: (I made a basic block and used its "onBlockActivated" method to test the packet handler)

 

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float sideX, float sideY, float sideZ)
{
if (!world.isRemote && !player.isSneaking())
        	{
	try 
    	         {
		System.out.println("Sending packet from Server");
		Tolkienaddon.channel.sendToAll(PacketTolkienaddon.createTestPacket((byte)42));
	 } 
        	catch (IOException e) 
        	{
		e.printStackTrace();
	}
}

   	if (world.isRemote && player.isSneaking()) 
        {
	try 
    	        {
		System.out.println("Sending packet from Client");
		Tolkienaddon.channel.sendToServer(PacketTolkienaddon.createTestPacket((byte)42));
	} 
    	        catch (IOException e) 
    	        {
		e.printStackTrace();
	}
}

return true;
}

 

 

After a lot of debugging I think i have tracked down where things go wrong.

From what i understand the "onServerPacker" method is suposed to be called on the server side when the server receives a a packet. But unless "World world = Minecraft.getMinecraft().theWorld;" dosnt work properly in this method "onServerPacket" is being called Client side instead of server side So the packet is being sent from, received and processed all on the client side and never actually reaches the server.

 

@jabelar From what I could tell from your posts in the other thread you havent started using this system to send data to the server yet. So have you tested it it works both ways? 

I am the author of Draconic Evolution

Posted

I use a different packet system, which seems complicated at first glance, but it's actually pretty easy to setup and use:

https://github.com/SanAndreasP/SAPManagerPack/tree/master/java/de/sanandrew/core/manpack/mod/packet

https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/mod/ModCntManPack.java

 

You basically use the IPacket interface and implement it in your custom packet class.

The ChannelHandler is registered in the mod class and everytime you send a packet, you reference it.

 

Here's an example for this:

https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/registry/ESPModRegistry.java

# line 82: instantiate the ChannelHandler (you can also do this in the preInit, it doesn't matter where, but not on init / postInit)

# line 121 - 125: register your custom packet classes (always after you've instantated the handler of course)

# line 153: initialise the channelHandler

# line 161: postInitialise the channelHandler

 

https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/packet/PacketBCGUIAction.java

# example for a packet class

 

https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/de/sanandrew/mods/enderstuffplus/client/gui/BiomeChanger/GuiBiomeChangerBase.java#L46-L47

# example for sending the packet (lines are marked yellow)

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.

Posted

Thanks but i am already very familiar with the system i have set up now so i will wait for jabelar to reply. Buy if i cant get my current system working i will definitely look into yours.

 

Edit: I am now more confused then ever... I noticed it seemed like two packets were being received by the server packet handler (on the client side) so i disabled the server packet handler (by not registering it) but the onServerPacket method in the server packet handler is still being called its as if i have registered a second server packet handler somewhere. 

I am the author of Draconic Evolution

Posted

ok but i still know the packet isnt getting to the server because i was originally trying to use it to send a button packet from a gui to a tile but the tile was only reviving the packet on the client side.

 

Edit: Oh i am also using Minecraft.getMinecraft().theWorld my processPacketOnServerSide method to get the player which i use to get the container which i use to get the tile...

I am the author of Draconic Evolution

Posted

Hi brandon, sorry for the delay -- I had a crazy day yesterday.

 

As you mentioned, I've been concentrating on sending from server to client as I'm mostly using it to control entity animations based on AI states.

 

But at a glance, like what some others say above, I think you're using some methods that are not appropriate to the server side.

 

I'm pretty sure the Minecraft.getMinecraft(). type methods aren't right for the server side.  I think what you need to do is your server packet needs to have information on the player, use that on server side to to look up the player and get the world they're on, then you're off and running.

 

I'll look at it when I get home -- in a few hours.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Ok so maby it is actually working properly but im just not using it properly. The following is my code for receiving a gui button packet.

World theWorld = Minecraft.getMinecraft().theWorld;

switch (packetTypeID) {
case packetTypeIDButton: {
	byte buttonId = bbis.readByte();
	int playerId = bbis.readInt();
	EntityPlayer player = (EntityPlayer) theWorld.getEntityByID(playerId); 
	Container container = player.openContainer;
	if (container != null && container instanceof ContainerWeatherController){
		TileWeatherController tileWC = ((ContainerWeatherController) container).getTileWC();

		tileWC.reciveButtonEvent(buttonId);
	}
	break;
}	
}

(the complete code is in my original post)

so if "theWorld" only exists on the client side then the tile i eventially get from it must also only be on the client side. So how can i get the tile on the server side?

 

Edit: you just beat me! I am currently sending the entityId of the player and using theWorld.getEntityById() which obviously isnt working so how else can i do it?

 

 

 

I am the author of Draconic Evolution

Posted

If you look closer i have the test block set up to send both ways if the player right clicks it it sends a packet from the server to the client but if the player shift-right clicks it it sends a packet from the client to the server.

I am the author of Draconic Evolution

Posted

The ServerCustomPacketEvent has "handler" field, which you can cast to NetHandlerPlayServer, and from it, get the player entity.

 

Yeah, perfect.

 

Brandon, events usually pass world and player to you.  Always good to check the fields and methods of the event to use them well.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

If you look closer i have the test block set up to send both ways if the player right clicks it it sends a packet from the server to the client but if the player shift-right clicks it it sends a packet from the client to the server.

 

Oh right, I didn't scroll down and only saw the one method. 

 

I would suggest that you put in a bunch more System.out.println() statements to help you follow the flow of the code.  For example, inside each if block, so you can see if it is testing true and such.

 

I also tend to keep the conditions simple at first -- do you really need to be sneaking for the packet to be sent (for test purposes)?

 

Anyway, with a bunch of println() statements you can follow every hop of the code and see where it is failing.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

The ServerCustomPacketEvent has "handler" field, which you can cast to NetHandlerPlayServer, and from it, get the player entity.

 

Yeah, perfect.

 

Brandon, events usually pass world and player to you.  Always good to check the fields and methods of the event to use them well.

 

I have been trying to figure it out GotoLink told me how to get the player from the event but how can i get the world? it may come in handy.

 

Edit: I think i figured it out you have to get the player from the event then get the world from the player

 

World world = ((NetHandlerPlayServer) event.handler).playerEntity.worldObj;

 

I am the author of Draconic Evolution

Posted

I just run into one more problem... I just tested it in multiplayer and... It dosnt work I havent done any debugging yet but any idea why it isnt working in multiplayer?

 

Edit: More specifically packets sent from the client to the server don't seem to get through and sending packets from the server to the client crashes the server.

 

"ava.lang.NoClassDefFoundError:" @ Tolkienaddon.channel.sendToAll(PacketTolkienaddon.createTestPacket((byte)42));

 

Full crash log

 

 

---- Minecraft Crash Report ----

// Don't be sad, have a hug! <3

 

Time: 7/05/14 8:40 AM

Description: Exception in server tick loop

 

java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient

at tolkienaddon.blocks.TestBlock.onBlockActivated(TestBlock.java:41)

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:405)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:588)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716)

at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:341)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742)

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 12 more

Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/WorldClient for invalid side SERVER

at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50)

at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276)

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174)

... 14 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_51, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 1954278872 bytes (1863 MB) / 2058878976 bytes (1963 MB) up to 2058878976 bytes (1963 MB)

JVM Flags: 3 total; -Xms2048m -Xmx2048m -XX:PermSize=256m

AABB Pool Size: 5312 (297472 bytes; 0 MB) allocated, 5141 (287896 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP v9.01-pre FML v7.2.156.1061 Minecraft Forge 10.12.1.1061 4 mods loaded, 4 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.2.156.1061} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1061.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.12.1.1061} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1061.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

tolkienaddon{0.8alpha} [Tolkiencraft Addon] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 1562 (87472 bytes; 0 MB) allocated, 1533 (85848 bytes; 0 MB) used

Player Count: 1 / 20; [EntityPlayerMP['brandon3055'/387, l='world', x=216.74, y=63.00, z=227.08]]

Is Modded: Definitely; Server brand changed to 'fml,forge'

Type: Dedicated Server (map_server.txt)

 

 

I am the author of Draconic Evolution

Posted

After learning how to run two separate consoles in eclipse and a lot more debugging i think i am getting closer to figuring out the problem.

 

First off there was a problem with the server packet handler that was preventing the packets from being read

I had to change

if (channelName == Tolkienaddon.networkChannelName)

to

if (channelName.equals(Tolkienaddon.networkChannelName))

The client packet handler was the same but for some reason it wasnt causing any problems (packets where getting through)

 

And that's where the problem is. When the server tries to ether read or send a packet it crashes.

Logs:

Sending from client to server:

#####Client#####

[DEBUG]TestBlock: Send packet from Client

[DEBUG]PacketTolkienaddon: createTestPacket

 

#####Server#####

[DEBUG]ServerPacketHandler: onServerPacket channel = tolkienaddon Looking for: tolkienaddon

[DEBUG]ServerPacketHandler: Channel Name is correct

[03:37:38] [server thread/ERROR] [FML]: NetworkEventFiringHandler exception

 

rest of crash log:

 

 

java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient

at tolkienaddon.core.handler.packethandling.ServerPacketHandler.onServerPacket(ServerPacketHandler.java:23) ~[serverPacketHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ServerPacketHandler_onServerPacket_ServerCustomPacketEvent.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.network.FMLEventChannel.fireRead(FMLEventChannel.java:103) ~[FMLEventChannel.class:?]

at cpw.mods.fml.common.network.NetworkEventFiringHandler.channelRead0(NetworkEventFiringHandler.java:30) ~[NetworkEventFiringHandler.class:?]

at cpw.mods.fml.common.network.NetworkEventFiringHandler.channelRead0(NetworkEventFiringHandler.java:18) ~[NetworkEventFiringHandler.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.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.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716) [MinecraftServer.class:?]

at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:341) [DedicatedServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742) [MinecraftServer$2.class:?]

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

... 20 more

Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/WorldClient for invalid side SERVER

at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.2-10.12.1.1061.jar:?]

at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

... 20 more

[03:37:38] [server thread/ERROR] [FML]: There was a critical exception handling a packet on channel tolkienaddon

java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient

at tolkienaddon.core.handler.packethandling.ServerPacketHandler.onServerPacket(ServerPacketHandler.java:23) ~[serverPacketHandler.class:?]

at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ServerPacketHandler_onServerPacket_ServerCustomPacketEvent.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.network.FMLEventChannel.fireRead(FMLEventChannel.java:103) ~[FMLEventChannel.class:?]

at cpw.mods.fml.common.network.NetworkEventFiringHandler.channelRead0(NetworkEventFiringHandler.java:30) ~[NetworkEventFiringHandler.class:?]

at cpw.mods.fml.common.network.NetworkEventFiringHandler.channelRead0(NetworkEventFiringHandler.java:18) ~[NetworkEventFiringHandler.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.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.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716) [MinecraftServer.class:?]

at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:341) [DedicatedServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742) [MinecraftServer$2.class:?]

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

... 20 more

Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/WorldClient for invalid side SERVER

at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.2-10.12.1.1061.jar:?]

at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

... 20 more

 

 

It crashed at PacketTolkienaddon.processPacketOnServerSide(event, event.packet.payload(), event.packet.getTarget());

 

Sending from server to client:

#####Server#####

[DEBUG]TestBlock: Send packet from Server

[03:48:14] [server thread/ERROR]: Encountered an unexpected exception

 

rest of the crash log:

 

 

java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient

at tolkienaddon.blocks.TestBlock.onBlockActivated(TestBlock.java:39) ~[TestBlock.class:?]

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:405) ~[itemInWorldManager.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:588) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) ~[C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) ~[C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) ~[NetworkManager.class:?]

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716) ~[MinecraftServer.class:?]

at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:341) ~[DedicatedServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742) [MinecraftServer$2.class:?]

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

... 12 more

Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/WorldClient for invalid side SERVER

at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.2-10.12.1.1061.jar:?]

at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_51]

... 12 more

 

 

it crashes at Tolkienaddon.channel.sendToAll(PacketTolkienaddon.createTestPacket((byte)42));

 

I cant figure out whats going on any ideas?

 

 

 

I am the author of Draconic Evolution

Posted

Sorry you're having continued trouble.  Things like the .equals() versus == are often tricky to find -- I'll have to look at that closer (as you said it worked in other direction).

 

Like before, these type of issues are often very specific to the actual code.  Do you mind reposting your current code, especially for the handlers and for the packet class?

 

Actually the second crash seems to be related to the world object used in your test block's onBlockActivated() mehtod.  Can you post code for that block or at least that method?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Common proxy:

 

import net.minecraftforge.common.MinecraftForge;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.blocks.ModBlocks;
import tolkienaddon.client.interfaces.GuiHandler;
import tolkienaddon.core.handler.CraftingHandler;
import tolkienaddon.core.handler.FMLEventHandler;
import tolkienaddon.core.handler.ModEventHandler;
import tolkienaddon.core.handler.packethandling.ServerPacketHandler;
import tolkienaddon.items.ModItems;
import tolkienaddon.tileentities.TileSunDial;
import tolkienaddon.tileentities.TileWeatherController;
import tolkienaddon.world.TolkienWorldGenerator;
import cpw.mods.fml.common.FMLCommonHandler;
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;
import cpw.mods.fml.common.registry.GameRegistry;

public class CommonProxy {
private final static boolean debug = Tolkienaddon.debug;

public void preInit(FMLPreInitializationEvent event)
{
	ModBlocks.init();
	ModItems.init();
	GameRegistry.registerWorldGenerator(new TolkienWorldGenerator(), 1);
	registerTileEntities();
}

public void init(FMLInitializationEvent event)
{
	CraftingHandler.init();
	registerEventListeners();
	registerNetworkingChannel();
	registerGuiHandeler();
	registerWorldGen();

	registerServerPacketHandler();
}

public void postInit(FMLPostInitializationEvent event)
{

}

public void registerTileEntities()
{
	GameRegistry.registerTileEntity(TileWeatherController.class, "TileWeatherController");
	GameRegistry.registerTileEntity(TileSunDial.class, "TileSunDial");
}

public void registerEventListeners()
{
	MinecraftForge.EVENT_BUS.register(new ModEventHandler());
	FMLCommonHandler.instance().bus().register(new FMLEventHandler());
}

public void registerNetworkingChannel()
{
	Tolkienaddon.channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(Tolkienaddon.networkChannelName);
}

public void registerServerPacketHandler()
{
	if(debug)
		System.out.println("[DEBUG]CommonProxy: registerServerPacketHandler");
	Tolkienaddon.channel.register(new ServerPacketHandler());
}

public void registerGuiHandeler()
{
	new GuiHandler();
}

public void registerWorldGen()
{
	GameRegistry.registerWorldGenerator(new TolkienWorldGenerator(), 1);
}
}

 

Client proxy:

 

import net.minecraftforge.client.MinecraftForgeClient;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.client.render.BowRenderer;
import tolkienaddon.core.handler.packethandling.ClientPacketHandler;
import tolkienaddon.items.ModItems;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class ClientProxy extends CommonProxy {
private final static boolean debug = Tolkienaddon.debug;

@Override
public void preInit(FMLPreInitializationEvent event)
{
	System.out.println("on Client side");
	super.preInit(event);

	//Client Only
	registerRendering();
}

@Override
public void init(FMLInitializationEvent event)
{
	System.out.println("on Client side");
	super.init(event);

	//Client Only
	registerClientPacketHandler();
}

@Override
public void postInit(FMLPostInitializationEvent event)
{
	System.out.println("on Client side");
	super.postInit(event);

	//Client Only
}

public void registerRendering()
{
	MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new BowRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new BowRenderer());
}

private void registerClientPacketHandler()
{
	if(debug)
		System.out.println("[DEBUG]ClientProxy: registerClientPacketHandler");
	Tolkienaddon.channel.register(new ClientPacketHandler());
}

}

 

Server packet handler:

 

import java.io.IOException;

import tolkienaddon.Tolkienaddon;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;

public class ServerPacketHandler {
protected String channelName;
private final static boolean debug = Tolkienaddon.debug;

@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent event) throws IOException
{   
	channelName = event.packet.channel();
	if(debug)
		System.out.println("[DEBUG]ServerPacketHandler: onServerPacket channel = " + channelName + " Looking for: " + Tolkienaddon.networkChannelName);

	if (channelName.equals(Tolkienaddon.networkChannelName)) {
		if(debug)
			System.out.println("[DEBUG]ServerPacketHandler: Channel Name is correct");
		PacketTolkienaddon.processPacketOnServerSide(event, event.packet.payload(), event.packet.getTarget());
	}else
		if(debug)
			System.out.println("[DEBUG]ClientPacketHandler: Channel Name is incorrect");
}

}

 

Client packet handler:

 

import java.io.IOException;

import tolkienaddon.Tolkienaddon;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;

public class ClientPacketHandler extends ServerPacketHandler {
private final static boolean debug = Tolkienaddon.debug;

@SubscribeEvent
public void onClientPacket(ClientCustomPacketEvent event) throws IOException
{ 
	channelName = event.packet.channel();
	if(debug)
		System.out.println("[DEBUG]ClientPacketHandler: onClientPacket Channel = " + channelName + " Looking for: " + Tolkienaddon.networkChannelName);

	if (channelName.equals(Tolkienaddon.networkChannelName)) {
		if(debug)
			System.out.println("[DEBUG]ClientPacketHandler: Channel Name is correct");
		PacketTolkienaddon.processPacketOnClientSide(event.packet.payload(), event.packet.getTarget());
	}else
		if(debug)
			System.out.println("[DEBUG]ClientPacketHandler: Channel Name is incorrect");

}
}

 

Packet:

 

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;

import java.io.IOException;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.world.World;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.client.interfaces.ContainerWeatherController;
import tolkienaddon.tileentities.TileWeatherController;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;

// this class is intended to be sent from server to client to keep custom entities synced
public class PacketTolkienaddon {
private final static boolean debug = Tolkienaddon.debug;
// define IDs for custom packet types
public final static byte packetTypeIDButton = 1;
public final static byte packetTypeIDTest = 2;

public PacketTolkienaddon() {
	// don't need anything here
}

public static FMLProxyPacket createButtonPacket(byte id, EntityPlayer player) throws IOException
{
	if(debug)
		System.out.println("[DEBUG]PacketTolkienaddon: createButtonPacket");

	ByteBufOutputStream dataStream = new ByteBufOutputStream(Unpooled.buffer());
	int playerId = player.getEntityId();

	dataStream.writeByte(packetTypeIDButton);
	dataStream.writeByte(id);
	dataStream.writeInt(playerId);

	FMLProxyPacket thePacket = new FMLProxyPacket(dataStream.buffer(), Tolkienaddon.networkChannelName);

	dataStream.close();

	return thePacket;
}

public static FMLProxyPacket createTestPacket(byte id) throws IOException
{
	if(debug)
		System.out.println("[DEBUG]PacketTolkienaddon: createTestPacket");

	ByteBufOutputStream dataStream = new ByteBufOutputStream(Unpooled.buffer());
	//int playerId = player.getEntityId();

	dataStream.writeByte(packetTypeIDTest);
	dataStream.writeByte(id);
	//dataStream.writeInt(playerId);


	FMLProxyPacket thePacket = new FMLProxyPacket(dataStream.buffer(), Tolkienaddon.networkChannelName);

	dataStream.close();

	return thePacket;
}

public static void processPacketOnClientSide(ByteBuf parBB, Side parSide) throws IOException
{
	if (parSide == Side.CLIENT) {
		if(debug)
			System.out.println("[DEBUG]PacketTolkienaddon: processPacketOnClientSide");

		World theWorld = Minecraft.getMinecraft().theWorld;
		ByteBufInputStream bbis = new ByteBufInputStream(parBB);

		// process data stream
		// first read packet type
		int packetTypeID = bbis.readByte();

		switch (packetTypeID) {
			case packetTypeIDTest: {
				if(debug)
					System.out.println("[DEBUG]PacketTolkienaddon: processPacketOnClientSide+packetTypeIDButton");

				byte data = bbis.readByte();

				if (!theWorld.isRemote)
					System.out.println("[DEBUG]PacketTolkienaddon: Server recived:" + data);
				else
					System.out.println("[DEBUG]PacketTolkienaddon: Client recived:" + data);

				break;
			}
		}
		bbis.close();
	}
}

public static void processPacketOnServerSide(ServerCustomPacketEvent event, ByteBuf payload, Side parSide) throws IOException
{
	if (parSide == Side.SERVER) {
		if(debug)
			System.out.println("[DEBUG]PacketTolkienaddon: processPacketOnServerSide");

		World world = ((NetHandlerPlayServer) event.handler).playerEntity.worldObj;
		ByteBufInputStream bbis = new ByteBufInputStream(payload);

		int packetTypeID = bbis.readByte();

		switch (packetTypeID) {
			case packetTypeIDButton: {
				if(debug)
					System.out.println("[DEBUG]PacketTolkienaddon: processPacketOnServerSide+packetTypeIDButton");

				byte buttonId = bbis.readByte();

				EntityPlayer player = ((NetHandlerPlayServer) event.handler).playerEntity;
				Container container = player.openContainer;
				if (container != null && container instanceof ContainerWeatherController){
					TileWeatherController tileWC = ((ContainerWeatherController) container).getTileWC();
					tileWC.reciveButtonEvent(buttonId);
				}
				break;
			}
			case packetTypeIDTest:{
				if(debug)
					System.out.println("[DEBUG]PacketTolkienaddon: processPacketOnServerSide+packetTypeIDTest");

				byte data = bbis.readByte();

				if (!world.isRemote)
					System.out.println("[DEBUG]Server recived:" + data);
				else
					System.out.println("[DEBUG]Client: Server recived:" + data);
			}
		}
		bbis.close();

	}
}
}

 

Test block:

 

import java.io.IOException;
import java.util.Random;

import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import tolkienaddon.Tolkienaddon;
import tolkienaddon.core.handler.packethandling.PacketTolkienaddon;

public class TestBlock extends TolkienBlock {

protected TestBlock() {
	super(Material.circuits);
	this.setBlockName("testBlock");
	this.setCreativeTab(Tolkienaddon.getCreativeTab());
	this.setHardness(5f);
	this.setResistance(200.0f);
	ModBlocks.register(this);
}

@Override
public boolean isOpaqueCube()
{
	return false;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float sideX, float sideY, float sideZ)
{
	if (!world.isRemote && !player.isSneaking())
	{
		try 
    	{
			System.out.println("[DEBUG]TestBlock: Send packet from Server");
			Tolkienaddon.channel.sendToAll(PacketTolkienaddon.createTestPacket((byte)42));
		} 
    	catch (IOException e) 
    	{
			e.printStackTrace();
		}
	}

	if (world.isRemote && player.isSneaking()) 
	{
		try 
    	{
			System.out.println("[DEBUG]TestBlock: Send packet from Client");
			Tolkienaddon.channel.sendToServer(PacketTolkienaddon.createTestPacket((byte)42));
		} 
    	catch (IOException e) 
    	{
			e.printStackTrace();
		}
	}

	return true;
}

@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
	// TODO Auto-generated method stub
	return Item.getItemFromBlock(Blocks.cobblestone);
}

}

 

 

Dose it work for you in multiplayer?

I am the author of Draconic Evolution

Posted

I'm at work so can only look at this a little bit and don't have my Forge set up to work with.  I'll look at this more closely when I'm home tonight.

 

I'm looking at the Server to Client case first.  I think it is also interesting that the debug console crashes before it can print out the debug statement from your PacketTolkienaddon.createTestPacket() method.  Basically your onBlockActivated() method calls the method, but it never prints out "[DEBUG]PacketTolkienaddon: createTestPacket".  So the failure seems to be somewhere before the method is actually called. And the crash report indicates that it happens at the time of the call in the testBlock.

 

What happens if you send a packet to a specific player instead?  Anyway, this method is called within the try-catch so it might be interesting to understand if this is a situation where there was a catch -- put a debug println statement into the catch to see if that is the path being taken.

 

Sorry but I haven't tested the multiplayer yet, but will do so when I get home.  Sorry for you having so much trouble -- this is one reason I don't want to write a tutorial until I have it fully formed.  However, I can't see any obvious reason why the general approach shouldn't work, so let's see if it is something simple.

 

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Okay, looking at the first case now, Client to Server

 

That error is a Java language error.  According to an answer at StackOverflow (http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java):

 

java.lang.NoClassDefFoundError

 

This exception indicates that the JVM looked in its internal class definition data structure for the definition of a class and did not find it. This is different than saying that it could not be loaded from the classpath. Usually this indicates that we previously attempted to load a class from the classpath, but it failed for some reason - now we're trying to use the class again (and thus need to load it, since it failed last time), but we're not even going to try to load it, because we failed loading it earlier (and reasonably suspect that we would fail again). The earlier failure could be a ClassNotFoundException or an ExceptionInInitializerError (indicating a failure in the static initialization block) or any number of other problems. The point is, a NoClassDefFoundError is not necessarily a classpath problem.

 

However, a lot of people suggest that it is still most likely a classpath problem.  Were you running this from within Eclipse?

 

Make sure you back up your forge folder before you screw around with fixing up the Eclipse setup. Look up "troubleshoot java NoClassDefFoundError" for some ideas.  It seems that there are ideas like cleaning the project in Eclipse, or someone mentioned the following:

 

This seems to be a common error. The solution is to:

 

right-click project

choose properties

choose 'Java Compiler'

unclick the first box saying 'Enable project specific settings'

apply

save

run

Hope this helps in some cases.

 

Some people cleared the workspace and then re-imported their project.

 

Some people recommended doing Project->Clean… in Eclipse.

 

And so on.  In any case, my point is that the error seems to be a serious Java error probably related to project setup.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

1. It I put a debug println in the catch but it wasnt called

2. I tried sending it to the player that clicked the block but it made no difference.

3. As long as we can eventually figure this out I dont mind the trouble at all I have found that in some cases you learn a lot more about how something works when it dosnt work :)

 

Can you give me an estimate as to when you will be able to help more? (when do you finish work?)

 

Edit: you beat me to the post lol

 

Edit2: I tried both in eclipse and i compiled it and tried outside eclipse

 

Edit3: I will try a couple of things and get back to you.

I am the author of Draconic Evolution

Posted

I'm at work for another 4 hours.  But yeah, I'm willing to work through this with you.  I'll probably try to get my own multiplayer packet working independently to see if there is any difference in result.

 

Doing this kinda debug is worthwhile since it will make us better coders in the long run.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.