Posted January 30, 201411 yr Currently, I have this code: @SubscribeEvent public void LivingAttackEvent(LivingAttackEvent event) { if(event.source.getSourceOfDamage() instanceof EntityPlayer) { event.entity.attackEntityFrom(DamageSource.magic, DataHelper.getAttack(player.getDisplayName()) / 4); } } My goal is to apply additional damage whenever the player damages something. The problem with the code above, is that it removes any knock back that the player did. You might ask yourself, why do I not use the source of damage from before? The simple answer is that it would make it a recursive loop. So is there any other way to apply additional damage? Kain
January 30, 201411 yr event.ammount += 2.0F; // adds one heart of damage Or you could give the player an AttributeModifier for attackDamage if you want to permanently (or even temporarily, but that's more of a hassle) allow the player to inflict more damage. http://i.imgur.com/NdrFdld.png[/img]
January 30, 201411 yr Author Thanks a bunch I'll go to the AttributeModifier. The 'ammount' field is final. :I Kain
January 30, 201411 yr It's not final in Forge 965 for 1.6.4, but you're updating to 1.7.2 aren't you? I wonder why they made it final... being able to change the amount of damage seemed to me to be the main point of using LivingHurtEvent. http://i.imgur.com/NdrFdld.png[/img]
January 30, 201411 yr Lol, oh man, that totally slipped by me! Sorry I just assumed you were using LivingHurtEvent... mybad http://i.imgur.com/NdrFdld.png[/img]
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.