Jump to content

Event Not getting Hit


Doobie

Recommended Posts

For some reason I am not getting a message when I break a block.

 

Main.java

package com.jamesrdubois.mods;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

@Mod(modid = Main.MODID, version = Main.VERSION)
public class Main {

public static final String MODID = "myMods";
public static final String VERSION = "1.0";

public void init(FMLInitializationEvent event) {
	MinecraftForge.EVENT_BUS.register(new BlockBreakMessage());
}


}

 

package com.jamesrdubois.mods;

import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class BlockBreakMessage {

@SubscribeEvent
public void sendMessage(BreakEvent event) {
	event
		.getPlayer()
		.addChatMessage(new TextComponentString(TextFormatting.GOLD + "You broke a block!"));

}
}

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



×
×
  • Create New...

Important Information

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