Jump to content

Block events in forge? (BlockBreak, BlockPlace, Explosions etc)


epicsquare

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

That's right, but you need to ensure FML is loading the coremod. Ninjar (for the coremods folder) coming soon ;)

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!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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  :-\

Link to comment
Share on other sites

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?  :(

Link to comment
Share on other sites

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.

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!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
×
×
  • Create New...

Important Information

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