NPCDamageSystems
Package: com.hypixel.hytale.server.npc.systems
public class NPCDamageSystemsContainer class for five ECS systems that handle NPC damage events: receiving damage, dealing damage, posting to the blackboard event view, filtering invalid damage, and dropping items on death.
Inner Systems
Section titled “Inner Systems”NPCDamageSystems.DamageDealtSystem
Section titled “NPCDamageSystems.DamageDealtSystem”public static class DamageDealtSystem extends DamageEventSystemWhen an entity takes damage from an NPC source, notifies the source NPC’s DamageData that it inflicted damage. Operates in the InspectDamageGroup.
NPCDamageSystems.DamageReceivedSystem
Section titled “NPCDamageSystems.DamageReceivedSystem”public static class DamageReceivedSystem extends DamageEventSystemRecords damage received by NPCs into their DamageData via onSufferedDamage(). Operates in the InspectDamageGroup.
NPCDamageSystems.DamageReceivedEventViewSystem
Section titled “NPCDamageSystems.DamageReceivedEventViewSystem”public static class DamageReceivedEventViewSystem extends DamageEventSystemPosts damage events to the blackboard’s EntityEventView so that nearby NPCs with entity event sensors can detect attacks. Skips creative-mode players unless they have allowNPCDetection enabled in their player settings. Operates in the InspectDamageGroup.
NPCDamageSystems.FilterDamageSystem
Section titled “NPCDamageSystems.FilterDamageSystem”public static class FilterDamageSystem extends DamageEventSystemFilters incoming damage by checking NPCEntity.getCanCauseDamage(). If the source entity is not permitted to damage the NPC, the damage is cancelled. Operates in the FilterDamageGroup.
NPCDamageSystems.DropDeathItems
Section titled “NPCDamageSystems.DropDeathItems”public static class DropDeathItems extends DeathSystems.OnDeathSystemOn NPC death (when ItemsLossMode is ALL), drops inventory items and/or items from the role’s drop list. Only processes non-player NPC entities. Items are spawned at the entity’s position offset by 1 block upward.
Query: NPCEntity AND TransformComponent AND HeadRotation AND NOT Player
Drop logic:
- If
role.isPickupDropOnDeath(), drops all items from the NPC’s inventory. - If the role has a
dropListId, generates random item drops viaItemModule. - Spawns
ItemComponententities for all collected items.
Related Types
Section titled “Related Types”- NPCDeathSystems — death event handling systems
- BlackboardSystems — blackboard views updated by damage events