Posted April 24, 20196 yr So, i normally code bukkit. getting into forge is a big change, 1 issue i am running into is how to register events (i've been looking for 2 hours) classes -> Main: @Mod(modid = Styles.MOD_ID, name = Styles.MOD_NAME, version = Styles.VERSION) public class Client { @SidedProxy(clientSide = Styles.clientProxyClass, serverSide = Styles.serverProxyClass) public static ServerProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent e) { } @EventHandler public void init(FMLPreInitializationEvent e) { } @EventHandler public void postInit(FMLPostInitializationEvent e) { } } Event Class: public class Knockback { @SubscribeEvent public void knockback(LivingAttackEvent e) { if(e.entity instanceof EntityPlayer && e.source.getEntity() instanceof EntityPlayer) { EntityPlayer target = (EntityPlayer) e.entity; Vec3 look = e.source.getEntity().getLookVec().normalize(); double knockback = 0.5; target.addVelocity(look.xCoord-knockback, look.yCoord-knockback, look.zCoord-knockback); } } } Server side: (Still a little confused here) public class ServerProxy { } Client side: (once again, a little confused) public class ClientProxy { } Help is much appreciated (Yes i know, its a 1.8 build, however pointing me in the right direction would help)
April 24, 20196 yr Try making the event subscriber function static. Also make sure you have registered your event handling class with FML's EVENT_BUS, which you can do with MinecraftForge.EVENT_BUS.register(new YourEventClass()); in your mod's pre-initialization or initialization phase.
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.