epicsquare Posted January 5, 2013 Posted January 5, 2013 Hi, How would I get these events in Forge. Coming from bukkit, I would like to port over some of my mods, and I need those events(Block Break, Block Place, Entity Explode). Surprisingly, I have not been able to find any kind of information online about server only mods for forge. Does anyone have any information on this too? Thanks a lot! Quote
xxxgamer Posted January 5, 2013 Posted January 5, 2013 keepcalm has a small api for this: https://github.com/keepcalm/BlockBreak Now I have been trying it myself but I can not get it working due to the methods not existing that are shown in the readme, Give that a try and let me know how you get on because I need to use it myself aswell. Now as for adding blocks etc..I dont know Anyone else that can help would be great. Quote
epicsquare Posted January 5, 2013 Author Posted January 5, 2013 Yeah, I found his little api too, but that covers only but a third of what I need. I'll take a look at it later, but hopefully there is a more universal solution to this. Thanks anyway! EDIT: I got his API to build and all, but it doesn't seem to actually work. I'm not fully sure if I'm using it properly though, as in I'm not sure how to integrate it into the source. I just kind of tossed his folder into <mcproot>/src/minecraft and then registered a container class on the event bus which was: public class EventHookContainerClass { @ForgeSubscribe public void BlockBreak(PlayerBreakBlockEvent e) { System.out.println("Break!"); } } However this was not called when block were broken. Quote
xxxgamer Posted January 5, 2013 Posted January 5, 2013 Did you initialize it? MinecraftForge.EVENT_BUS.register(new ForgeEventHandler()) Again this is what he says to do on github, but for me again there is no ForgeEventHandler?? Edit: Sorry I think I just realised im supposed to create that ForgeEventHandler class?? As you said you registered your own class on the even bus Quote
epicsquare Posted January 5, 2013 Author Posted January 5, 2013 Yes that's right I assumed I create my own event container class (as in my reply) and registered that. Please let me know if it works for you. Quote
keepcalm Posted January 6, 2013 Posted January 6, 2013 That's right, but you need to ensure FML is loading the coremod. Ninjar (for the coremods folder) coming soon Quote Protip: try and find answers yourself before asking on the forum. It's pretty likely that there is an answer. Was I helpful? Give me a thank you! Reveal hidden contents http://bit.ly/HZ03zy[/img] Tired of waiting for mods to port to bukkit? use BukkitForge! (now with a working version of WorldEdit!)
xxxgamer Posted January 6, 2013 Posted January 6, 2013 So now that ive changed the code to look like this: @ForgeSubscribe public void onBlockBreak(PlayerBreakBlockEvent ev) { System.out.println("Break!:" ); } @Init public void init(FMLInitializationEvent ev) { MinecraftForge.EVENT_BUS.register(this); } Then I can see that the server does indeed go there but when I break a block I get no output from it, am I still missing something? Quote
epicsquare Posted January 6, 2013 Author Posted January 6, 2013 On 1/6/2013 at 10:34 AM, keepcalm said: That's right, but you need to ensure FML is loading the coremod. Ninjar (for the coremods folder) coming soon Oh you mean this? "Version 1.4.5-0: https://github.com/downloads/keepcalm/BlockBreak/blockbreak-1.4.5-0.jar for Minecraft 1.4.4 or 1.4.5, and MinecraftForge." (From your thread). I see. Are you planning on making a block place too? And what about if a block is broken by explosion? Thanks Quote
xxxgamer Posted January 6, 2013 Posted January 6, 2013 Have you managed to register blocks getting destroyed? Quote
epicsquare Posted January 6, 2013 Author Posted January 6, 2013 Nope. I put that jar into coremods and now I get: [embed=425,349]---- Minecraft Crash Report ---- // Ouch. That hurt Time: 1/6/13 12:01 PM Description: Exception in server tick loop cpw.mods.fml.common.DuplicateModsFoundException at cpw.mods.fml.common.Loader.identifyDuplicates(Loader.java:374) at cpw.mods.fml.common.Loader.identifyMods(Loader.java:335) at cpw.mods.fml.common.Loader.loadMods(Loader.java:457) at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:86) at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:345) at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:64) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:458) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.4.6 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.7.0_09, Oracle Corporation Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation Memory: 964726120 bytes (920 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v7.25 FML v4.6.12.511 Minecraft Forge 6.5.0.467 6 mods loaded, 0 mods active mcp [Minecraft Coder Pack] (minecraft.jar) FML [Forge Mod Loader] (coremods) Forge [Minecraft Forge] (coremods) BlockBreak [block Break Event] (bin) epicsquare_Tutorial [Tutorial] (bin) BlockBreak [block Break Event] (blockbreak-1.4.5-0.jar) Profiler Position: N/A (disabled) Is Modded: Definitely; Server brand changed to 'fml' Type: Dedicated Server (map_server.txt) [/embed] Again, not sure how to actually properly integrate that block break api. Kinda noob at this Quote
xxxgamer Posted January 6, 2013 Posted January 6, 2013 That looks like you have 2 classes that have the same @mod name in then, They need to be unique. Quote
epicsquare Posted January 6, 2013 Author Posted January 6, 2013 Not my classes, its because of that jar in the coremods. Game gives this error: ... You have mod sources that are duplicate within your system Mod Id : File name BlockBreak : bin BlockBreak : blockbreak-1.4.5-0.jar Edit: I removed the block break sources and added the jar as a reference. Now I get: [sEVERE] [ForgeModLoader] Found a duplicate mod BlockBreak at [C:\...\Coding\mcp725\jars\coremods\blockbreak-1.4.5-0.jar, C:\....\Coding\mcp725\jars\coremods\blockbreak-1.4.5-0.jar] What am I doing wrong? Quote
xxxgamer Posted January 7, 2013 Posted January 7, 2013 Have you had any more luck getting an event registered? Quote
epicsquare Posted January 9, 2013 Author Posted January 9, 2013 Nope. I'm still stuck with that duplicate error. I have absolutely not the slightest of clues how to add API's to forge. And I can't find anything online either. I was hoping someone on these forums might help... Quote
keepcalm Posted January 10, 2013 Posted January 10, 2013 Ok, I updated and released my API (link in signature). To create events, have a class that extends Event and use MinecraftForge.EVENT_BUS.post(event) when you want to call it. Quote Protip: try and find answers yourself before asking on the forum. It's pretty likely that there is an answer. Was I helpful? Give me a thank you! Reveal hidden contents http://bit.ly/HZ03zy[/img] Tired of waiting for mods to port to bukkit? use BukkitForge! (now with a working version of WorldEdit!)
Recommended Posts
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.