Posted August 13, 20169 yr 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!")); } }
August 13, 20169 yr You are missing @EventHandler for your init method. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 13, 20169 yr Author You are missing @EventHandler for your init method. Fixed thanks! Just started modding, my fault!
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.