Jump to content

recklessGreed_

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

recklessGreed_'s Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Okay Thanks for your time and your opinions i hope i'll get an answer to my Event Problem soon
  2. Sure here my Classes: First The Main: package de.recklessGreed.chatMod; import ibxm.Player; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ServerChatEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = Reference.Mod_ID, name = Reference.Mod_Name, version = Reference.Version) public class ChatControlMain { @Instance(value = Reference.Mod_ID) public static ChatControlMain instance; EntityPlayerSP user = Minecraft.getMinecraft().thePlayer; @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new Events(this)); } } and the Events: package de.recklessGreed.chatMod; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraftforge.event.ServerChatEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class Events { ChatControlMain classMain; public Events(ChatControlMain main) { classMain = main; } @SubscribeEvent public void chatEvent(ServerChatEvent event) { /*String message = event.message; String username = event.username; String[] words = message.split(" "); EntityPlayerMP sender = event.player; if(checkForWord(words, "hallo")) { classMain.user.sendChatMessage("Hallo. This is an automatic Message."); }*/ System.out.println("Chat registered"); } @SubscribeEvent public void blockBreak(BreakEvent event) { System.out.println("Block has been broken."); } public boolean checkForWord(String[] words, String cmd) { for(String word : words) { if(word.equalsIgnoreCase(cmd)) return true; } return false; } } Refercences just holds the MOD ID, The Version and the Name
  3. Hello Modders, I am quite new to Client Modding and now have a problem with handeling Events with Forge. Here is my code: @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new Events(this)); } and in the Events Class: @SubscribeEvent public void chatEvent(ServerChatEvent event) { System.out.println("Chat registered"); } @SubscribeEvent public void blockBreak(BreakEvent event) { System.out.println("Block has been broken."); } I do not get any Errors which can help me. If i start the client (via Eclipse) Forge tells me the mod is loaded but nothing happens when i write (with my second account) in chat or if i break a block. I used the breakBlock event to check wether the ChatEvent is just lost or wheter i have a problem with the Events. I am Stuck with this for 36 hours now and i searched all over Google and Forums for a solution. If I am just too stupid to find anything please let me know. When my english is corrupted somewhere please forgive me i am german and my writing skills are not the best... Thanks for your help.
×
×
  • Create New...

Important Information

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