mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-11 21:57:40 +00:00
Move hurt resistant time handling from LivingHurtEvent to LivingAttackEvent
- Remove legacy attack speed handling from ServerEventsHandler.LivingHurtEvent (was setting hurtResistantTime AFTER immunity check, too late) - Add proper handling in ScriptPlayerEventHandler.LivingAttackEvent (sets hurtResistantTime=0 BEFORE immunity check for fast weapons) - For weapons with attackSpeed < 20, bypass invincibility frames to allow rapid attacks to land
This commit is contained in:
2 files changed
+4
-10
No files matched your search
@@ -173,15 +173,6 @@ public class ServerEventsHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void invoke(LivingHurtEvent event) {
|
||||
if(event.source.getEntity() instanceof EntityPlayerMP && event.entity instanceof EntityLivingBase ){
|
||||
EntityPlayerMP ep = (EntityPlayerMP) event.source.getEntity();
|
||||
if(ep.getHeldItem() != null && ep.getHeldItem().getItem() instanceof ItemLinked){
|
||||
int time = ep.getHeldItem().stackTagCompound.getCompoundTag("ItemData").getCompoundTag("LinkedData").getInteger("AttackSpeed");
|
||||
event.entity.hurtResistantTime = time;
|
||||
((EntityLivingBase) event.entity).hurtTime = time;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user