Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

registerConnectionHandler Problem?


KururuLABO
 Share

Recommended Posts

I will make mod Open Gui then playerLoggedIn. But gui can't show then logged

 

Source

iMain :

 

package iEndless;

 

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import iEndless.Client.iClientPacketHandler;

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

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

 

@Mod(modid= "iEndless",name = "iEndless",version = "0.1")

@NetworkMod(clientSideRequired= true,

serverSideRequired=true)

public class iMain {

 

@Mod.Instance("iEndless")

public static iMain instance;

@SidedProxy(clientSide="iEndless.Client.iClientProxy", serverSide="iEndless.iCommonProxy")

public static iCommonProxy iProxy;

public void load(FMLInitializationEvent e)

{

NetworkRegistry.instance().registerGuiHandler(instance, iProxy);

NetworkRegistry.instance().registerConnectionHandler(new iConnectionHandler());

iProxy.registerRenderers();

}

}

 

 

 

iConnectionHandler :

 

package iEndless;

 

import net.minecraft.entity.player.EntityPlayerMP;

import net.minecraft.network.INetworkManager;

import net.minecraft.network.NetLoginHandler;

import net.minecraft.network.packet.NetHandler;

import net.minecraft.network.packet.Packet1Login;

import net.minecraft.server.MinecraftServer;

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

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

 

public class iConnectionHandler implements IConnectionHandler {

 

@Override

public void playerLoggedIn(Player player, NetHandler netHandler,

INetworkManager manager) {

// TODO Auto-generated method stub

((EntityPlayerMP)player).openGui(iMain.instance, EnumGui.Login.getIndex().intValue(), ((EntityPlayerMP)player).getServerForPlayer(), 0, 0, 0);

}

 

@Override

public String connectionReceived(NetLoginHandler netHandler,

INetworkManager manager) {

// TODO Auto-generated method stub

return null;

}

 

@Override

public void connectionOpened(NetHandler netClientHandler, String server,

int port, INetworkManager manager) {

// TODO Auto-generated method stub

 

}

 

@Override

public void connectionOpened(NetHandler netClientHandler,

MinecraftServer server, INetworkManager manager) {

// TODO Auto-generated method stub

 

}

 

@Override

public void connectionClosed(INetworkManager manager) {

// TODO Auto-generated method stub

 

}

 

@Override

public void clientLoggedIn(NetHandler clientHandler,

INetworkManager manager, Packet1Login login) {

// TODO Auto-generated method stub

 

}

 

}

 

 

 

EnumGui :

 

package iEndless;

 

public enum EnumGui {

 

Login(0);

 

  private int index;

 

  private EnumGui(int i)

  {

    this.index = i;

  }

 

  public Integer getIndex()

  {

    return Integer.valueOf(this.index);

  }

}

 

 

 

iCommonProxy :

 

package iEndless;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.world.World;

import cpw.mods.fml.client.registry.KeyBindingRegistry;

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

 

public class iCommonProxy

implements IGuiHandler

{

public iGuiHandler iGuiHandler = new iGuiHandler();

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world,

int x, int y, int z) {

return this.iGuiHandler.getServerGuiElement(ID, player, world, x, y, z);

}

 

public void registerRenderers()

{

}

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world,

int x, int y, int z) {

return null;

}

}

 

 

 

iClientProxy :

 

package iEndless.Client;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.world.World;

import iEndless.EnumGui;

import iEndless.iCommonProxy;

 

public class iClientProxy extends iCommonProxy {

 

public void registerTickHandlers()

  {

  }

 

public Object getClientGuiElement(int ID, EntityPlayer player, World world,

int x, int y, int z) {

if(ID == EnumGui.Login.getIndex().intValue()){

return new GuiLogin();}

return null;

}

}

 

 

Link to comment
Share on other sites

im sure this isnt your fault but your sentence structure does not make sense.

do you mean " I have made a mod than creates a gui that shows when players log in, however the gui is not showing when players log in."?

Use examples, i have aspergers.

Examples make sense to me.

Link to comment
Share on other sites

im sure this isnt your fault but your sentence structure does not make sense.

do you mean " I have made a mod than creates a gui that shows when players log in, however the gui is not showing when players log in."?

 

yes. sorry for question.

 

ps.i m not good at English but i'll try to learn this

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
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.

 Share



×
×
  • Create New...

Important Information

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