UPDATE - Cleared up
In case anyone else new to modding was confused about this topic, this thread taught me that Forge events provide "after-the-fact" information. You can do whatever you want with this information, and in some cases you can cancel the event itself, but you cannot modify what actually happened in the event. So, as in my situation here, you cannot use an event to increase (or modify in any way) mob damage.
I thought I could hook into the event, change its fields, and then have the event resolve. But no, the event resolves first, and then passes that information to your handler class, where you can make use of it. Events are still useful; they're just not useful for the application I had in mind.
Original thread below:
Alright, so I want to make it so any time a mob attacks, that mob makes a damage roll instead of doing flat damage.
To my understanding (and I've searched and read and looked up tutorials and videos for 2-3 days, honestly), the best way to do this is to use the LivingAttackEvent event.
I know how to set this up. I have my event handler (below) and I have the event registered properly in my mod.
What I want to know is: what do I even do with the limited number of fields the event gives me? For example, I have this:
public class LivingAttackHandler {
@ForgeSubscribe
public void onEntityAttack(LivingAttackEvent event)
{
Entity entity = event.entity;
DamageSource source = event.source;
int amount = event.ammount;
}
}
So, that's cool and all. But I get errors when I actually try to change the event's fields. Case in point, if I try this code:
event.ammount = 4;
Eclipse gives me an error saying "The final field LivingAttackEvent.ammount cannot be assigned." So I can't actually change the event fields. I'm having this problem with pretty much all events. It seems to me I can only get information from events, which I can then subsequently do nothing with.
I know I'm approaching this the wrong way. Events sound like they're useful, but I'm not "getting" it. I honestly have been at this for at least 2 days now, and there are frustratingly few resources online about Forge events and how to actually use them.