I want to make a mod that will modify any enemy mob (vanilla or modded) during spawn (with values determined by spawn location). This would be easy if mob attributes like attack damage, movement speed, and health were stored in convenient variables, but based on the time I've spent looking over the vanilla code and trying things out, this doesn't seem to be the case.
Right now I have a function that fires whenever EntityJoinWorld event is triggered. I tried using setBaseValue with the SharedMonsterAttributes, but it doesn't seem to work. Watching it step-by-step through a debugger showed that the baseMaxHP value had been altered, but it changes back after the next line (I have a system message set up to report the mobs MaxHP).
Right now I'm only trying to modify the attack damage, MaxHP, and movement speed attributes. I've found examples of how equipment, drops, and EXP can be modified, so I should have no issues with doing those. But I've spent the past two days pouring over the vanilla code and trying different things to get the attribute values to change and I've had no luck. I thought I might be able to make a class that extends EntityMob, but that forces a constructor.. unless I can maybe use that to destroy the old mob (or just prevent the spawn) and create a new one in its place whenever a regular mob is spawned in? I feel like that would take a lot of unnecessary work, though, and I'm worried that I might end up losing mob data, especially of modded mobs.
I haven't found many examples of modders trying to tinker with these values, so I feel like I'm in somewhat uncharted territories, here... I hope someone out there can help, though; I have years of experience with C++, but I'm fairly new to Java, and very new to mod programming (I made a mod a few years ago that added an item with a crafting recipe and I'm working on a Thaumcraft add-on right now).
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.