Jump to content

Recommended Posts

Posted

Hey i was wandering how to achive if i wanted to modify player health class and exp.

 

I was trying how to get for example 20 hp for lvl 1 and more for each lvl..... How to modify mobs to drop specifyied lvl of experience, or make them hostile or neutral... like a rpg "world of worldarft"

Posted

Doing such things is above your skill level as the things you want to modify aren't publicly accessible and you would need to inject new code into some places, so even Reflection won't be enough, you'll need ASM.

 

And ASM is a dark, uncaring abyss.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

An alternative, which may make your mod incompatible with other mods that use these entities, would be to replace all vanilla entities, or at least the ones you want, with your own custom entities that are basically a modifies clone of the original entities in minecraft.

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

Posted

You might want to get back to this info later (when you know Forge/Java better).

 

Since some vanilla update there is system that is based on attributes. There are SharedMonserAttributes assigned to each entity on constructon that define given entity's basi health, damage, speed values. Then there are AttributeModifiers that allow you to modify those attributes.

 

You can use modifiers to edit vanilla health (add more). Note that for this to work WELL you need to think of it a bit and learn a lot about attribute system. For examples have a look at GoldenApple that over-heals you and potions for other modifiers like speed or regeneration.

 

Hooking into exp and making exp-health relation is HARDER. This will require you to use PlayerTickEvent with Phase.START on Side.SERVER. You will need to check for player's exp every begining of tick and add new modifier that will make your health e.g +20, then in Phase.END you will need to remove that modifier. That way you add health before tick, and remove it after tick. During tick you health is operational (usable). You might also want to do it less that once per tick. You can add/remove modifiers every few ticks.

 

To hold additional data about entity you will need to implement IExtendedEntityProperties and use SimpleNetworkWrapper to synchronize client-server.

 

I have no knowledge about mob AI, maybe you couls add/remove new AI effects to existing mobs, if not then you will need to replace then with new or edit with ASM.

 

Acessing private fields can be done with forge's ReflectionHelper.

 

Tutorials:

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with

www.minecraftforge.net/forum/index.php/topic,20135.0.html

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and

 

Hope it helps.

1.7.10 is no longer supported by forge, you are on your own.

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.