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:
Claude committed 2025-12-31 00:45:26 +00:00
1 parent ce8e38b6bd
commit 185a8bc917
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;