Posted April 6, 201510 yr [spoiler=FirstEventHandler.java] package com.phoenix.firstmod; import net.minecraft.client.Minecraft; import net.minecraftforge.event.world.BlockEvent.PlaceEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class FirstEventHandler { @SubscribeEvent public void onBlockPlace(PlaceEvent event){ Minecraft.getMinecraft().thePlayer.sendChatMessage("Block Placed"); } } Above is the code from my handler class, I use "FirstEventHandler handler = new FirstEventHandler();" and " MinecraftForge.EVENT_BUS.register(handler); FMLCommonHandler.instance().bus();" in my main class. My issue is that in game when I place a block, the event fires twice and sends two chat messages. Chat messages are not my final intended function, but just to make sure I'm not messing this up, which I evidently am.
April 6, 201510 yr Author So I'm struggling to understand events, would I use @SideOnly somehow? How would I make this only happen once?
April 7, 201510 yr Author I've been messing with this for a while and can't figure it out, I want to store placedBlock from PlaceEvent in a variable (thats what I need help with) and then output to chat.
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.