As, the title says, i want to know how to display a chat message on enter in a world.
Thanks for helping.
SOLUTION:
Main.class
package SackCastellon.core;
import cpw.mods.fml.common.FMLCommonHandler;
import SackCastellon.core.event.SkcEvent;
import SackCastellon.core.proxy.CommonProxy;
import SackCastellon.core.reference.Reference;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
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;
@Mod(modid=Reference.ID, name=Reference.NAME, version=Reference.VERSION, dependencies=Reference.DEPENDENCIES)
public class SKCCore {
@Instance(Reference.ID)
public static SKCCore instance;
@SidedProxy(clientSide=Reference.CLPROXY, serverSide=Reference.CMPROXY)
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
FMLCommonHandler.instance().bus().register(new SkcEvent());
System.out.println("Event Handler Initialized");
}
@EventHandler
public void load(FMLInitializationEvent event) {}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {}
}
Event.class
package SackCastellon.core.event;
import net.minecraft.util.ChatComponentText;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
public class SkcEvent {
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
event.player.func_146105_b(new ChatComponentText(event.player.getDisplayName() + " is testing chat messages"));
}
}