No client-side call to performHurtAnimation() when sendUseEntity is invoked. 4. Solution Overview Implementation method: Override or mix into NetHandlerPlayClient and the player attack logic to immediately call performHurtAnimation() on the target entity right after sending CPacketUseEntity .
In NetHandlerPlayClient#handleEntityStatus :
if (packetIn.getOpCode() == 2) Entity entity = packetIn.getEntity(this.clientController.netClientHandler); if (entity != null && !entity.isEntityInvulnerable()) if (entity.hurtResistantTime <= 0) // Already triggered locally? entity.performHurtAnimation(); hit delay fix 1.8.9
To avoid playing the hurt animation twice (once local, once when SPacketEntityStatus arrives), add a check:
@Mixin(EntityPlayerSP.class) public abstract class MixinEntityPlayerSP @Inject(method = "sendUseEntity", at = @At("HEAD")) private void onSendAttackPacket(Entity entity, int action, float x, float y, float z, CallbackInfo ci) if (action == 0) // 0 = ATTACK if (entity != null) // Trigger hit visual client-side entity.performHurtAnimation(); // Play hurt sound locally entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, entity.getHurtSound(), entity.getSoundCategory(), 1.0f, 1.0f, false); In NetHandlerPlayClient#handleEntityStatus : if (packetIn
net.minecraft.client.network.NetHandlerPlayClient#handleEntityStatus Case 2 → Entity#performHurtAnimation() .
Analysis and Implementation of the Hit Delay Fix for Minecraft 1.8.9 once when SPacketEntityStatus arrives)
Deploy as an optional client-side tweak, enabled by default for all PvP-oriented 1.8.9 modpacks or utilities. Appendix A: Sample code repository (GitHub): [link placeholder] Appendix B: Before/After video demonstration: [link placeholder]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.