Jump to content

We can modify existing mob behavior right? Forge docs don't talk about entities at all


Recommended Posts

Posted

I am brand new to modding Minecraft.  I plan on doing only entity stuff like modding the AI for example.  Unfortunately the forge docs are VERY lacking right now on how to really do much.  It doesn't even have an entity section.  Before I dive into hours of code review, debugging and running tests, can someone tell me real quick if we can mod existing behavior?  I even have an exact example:

 

Take EntityLiving.java, method:

protected void despawnEntity()

 

This is the code that despawns entities if they are too far from the player.  How can I change this behavior to make the despawn rules different?  It is easy right?  Any quick pointers?

 

 

Posted

OK thanks.  Yes, I started looking at the mineforge codebase and see its got a ton of event handlers.  I will start with these.  I am reading/assuming that these events intercept game actions and can even cancel them if you set the cancel flag.  I'll dive in from here.

 

Posted

Yes. For modifying vanilla behavior you can first look for public fields and methods. For example entity AI is contained in a public list that you can modify directly. After that look at Forge events. Also some vanilla behaviour such as loot tables, achievements, recipes, models, etc., is now defined by JSON asset files.. If those aren't sufficient then look at java reflection to access otherwise private fields and methods.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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



×
×
  • Create New...

Important Information

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