Jump to content

[Unsolved] Adding Forge Event Handlers


snipes2083

Recommended Posts

Hello forge community.  I have been apprehensive to post a question in here as I have much to learn and it appears that people that are new often get crucified for asking questions the advanced would see as simple... How ever, I feel that I have looked high and low and would like conformation that my findings are correct.

 

I am looking for an event listener that deals with blocks.  Actually the following link pretty much sums it up.

 

http://www.minecraftforge.net/forum/index.php/topic,2462.msg18956.html#msg18956

 

After days of going through the code I finally stumbled on the above entry.  It is quite old and I didn't want to resurrect  the thread.

 

The particular event I am interested in is one that fires when a player destroys a block, adds a block and when a block is blown up.

 

I know that by doing the following:

 

    @Override
    public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, 
                int par4, int par5){
    System.out.println("The block was destroyed");
}

 

You can get access to this event but only for blocks that you create.

 

My question is, Do I have to go in and add the events to one of the net.minecraftforge.event packages, modify some of the base classes or look harder because there is a way that I am missing.

 

I thank you in advance for your time and assistance.

Link to comment
Share on other sites

Hello forge community.  I have been apprehensive to post a question in here as I have much to learn and it appears that people that are new often get crucified for asking questions the advanced would see as simple...

 

That's wrong, I can only speak for myself of course but I only crucify people for the following reasons:

- Asking for help with crash, bugs etc. but not giving Code/Logs inn readable format. (use pastebin ppl!).

- When people ask for stuff they didn't care to google themselfs.

- people refusing to learn what they are doing and instead just want their mod given to them.

 

So feel free to ask any and all questions you may have related to modding, as long as you actually tried to avoid the above points you will be fine <3

 

And for your real question. Well good question, I'm not sure about event listeners for that but I'll try to check around when I get to my eclipse computer :)

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I have been programming since I was 13 years old and am now 29.  I am no where near an expert programmer, but am able to jump in and out of many languages.  While, I do not have very much experience with Java, it is very similar to many other languages.  At no point would I expect somebody to write my mod as I care less about the end state of the mod than I do the learning experience of getting there.

 

I appreciate you taking the time to look this subject up but I fear that you are going to find the same results as I did.

 

I see that forge has some hooks put in various classes that pertain to events that are fired and are able to build there wrapper around those hooks.  It almost looks to me like that area just has not really been fully completed.  I would really like access to more events that are fired and do not really want to modify forge or minecraft classes.  Making a forge mod that is incompatible with other forge mods completely defeats the purpose of using forge.

Link to comment
Share on other sites

I am quite sure that this is functionality that many mods could take advantage of.  Is there anybody out there that could help point me in the rite direction?  As of the time of writing this, there has been 55 views in a short two days.  It is apparent that there are a few people out there that have taken an interest in this.

 

As of rite now, I do not have anything further to add to this but will be attempting to modify forge and some of the base classes that are involved in order to try and add this functionality.  If there is anybody out there that has any advice or fore sight that would be useful to me before I attempt this, it would be greatly appreciated.

 

Thank forge community.

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

    • before I updated my pack I made for paintings++ mod, i noticed and saw that only modded paintings and vanilla ones move one block each time I re-enter my world! is there something wrong? what the hell is even going on? why is there a ghost living in my house?! the modded paintings even phase through blocks which is super weird!! help! here is my painting mod list: Paintings++ Dark paintings Macaw's paintings Joy of painting Immersive paintings My custom paintings++ resource pack
    • Error: java.lang.NullPointerException: Cannot invoke "me.codexadrian.tempad.TempadClientConfig.renderBlur()" because the return value of "me.codexadrian.tempad.TempadClient.getClientConfig()" is null I keep having this error while trying to launch a modpack through the forge modloader, any suggestions? https://docs.google.com/document/d/1CRKUoSiu2e_mDvDTVYpIA5wqD3w-BsCycxBu1_vQ4OA/edit?usp=sharing Crash Report ^^^^
    • I'm trying to start a server with the latest installer, but running the run.bat file doesn't generate new files. It shows the following in the cmd prompt.
    • One of my players is suddenly unable to join a locally hosted MC Eternal server. We have been playing on this server for about 2-3 weeks now. I have tried erasing his player files and his reputation file, and now it just coughs up this and kicks him out: [User Authenticator #5/INFO] [minecraft/NetHandlerLoginServer]: UUID of player EthosTheGod is 7692d8db-02c3-424f-a4ab-0e4e259b106b [20:25:36] [User Authenticator #4/INFO] [minecraft/NetHandlerLoginServer]: UUID of player EthosTheGod is 7692d8db-02c3-424f-a4ab-0e4e259b106b [20:29:35] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 575849ms behind, skipping 11516 tick(s) [20:29:35] [Server thread/INFO] [minecraft/NetHandlerLoginServer]: com.mojang.authlib.GameProfile@4a6c63f1[id=7692d8db-02c3-424f-a4ab-0e4e259b106b,name=EthosTheGod,properties={textures=[com.mojang.authlib.properties.Property@241ea89e]},legacy=false] (/IP.ADDRESS) lost connection: Disconnected [20:29:35] [Server thread/INFO] [minecraft/NetHandlerLoginServer]: com.mojang.authlib.GameProfile@6ab6c661[id=7692d8db-02c3-424f-a4ab-0e4e259b106b,name=EthosTheGod,properties={textures=[com.mojang.authlib.properties.Property@7f19aae3]},legacy=false] (/IP.ADDRESS) lost connection: Disconnected It just says "connection timed out" on his end. Any ideas?
    • I'm trying to migrate my mod from 1.20 to 1.21. Some packages in the forge api were changed so my mod did have some classes not working. I've changed everything i needed but still is getting me the following error error: cannot access Registry DeferredRegister.create(ForgeRegistries.BLOCKS, FarmMod.MOD_ID); ^ class file for net.minecraft.core.Registry not found The piece of code that is wrong is   public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, FarmMod.MOD_ID); And here are my imports   import com.lucas.farmmod.FarmMod; import com.lucas.farmmod.block.custom.BaseIrrigatorBlock; import com.lucas.farmmod.item.ModItems; import com.lucas.farmmod.item.custom.BaseIrrigatorBlockItem; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; The class DeferredRegister is throwing the error in the print below     I've tried running rebuilding my project in every way possible, tried refreshing my dependencies but nothing works. What can i do?
  • Topics

×
×
  • Create New...

Important Information

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