NPCDeathSystems class
Пакет: com.hypixel.hytale.server.npc.systems
Файл: com/hypixel/hytale/server/npc/systems/NPCDeathSystems.java
Поля (15)
| Модификаторы | Тип | Имя |
|---|---|---|
|
private final ResourceType<EntityStore, Blackboard> |
blackboardResourceType |
|
private final ComponentType<EntityStore, Player> |
playerComponentType |
|
private final Query<EntityStore> |
query |
|
private final ComponentType<EntityStore, TransformComponent> |
transformComponentType |
|
Blackboard |
var10 |
|
TransformComponent |
var10 |
|
EntityEventView |
var11 |
|
Ref |
var11 |
|
Ref |
var12 |
|
Damage |
var5 |
|
ComponentType |
var5 |
|
Damage |
var6 |
|
TransformComponent |
var8 |
|
Vector3d |
var9 |
|
NPCEntity |
var9 |
Методы (8)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public |
EntityViewSystempublic EntityViewSystem() |
|
public |
NPCKillsEntitySystempublic NPCKillsEntitySystem() |
|
public Query<EntityStore> |
getQuerypublic Query<EntityStore> getQuery() |
|
public Query<EntityStore> |
getQuerypublic Query<EntityStore> getQuery() |
|
|
if if(var5 != null) |
|
|
if if(var9 != null) |
|
public void |
onComponentAddedpublic void onComponentAdded(@Nonnull Ref<EntityStore> var1, @Nonnull DeathComponent var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4) |
|
public void |
onComponentAddedpublic void onComponentAdded(@Nonnull Ref<EntityStore> var1, @Nonnull DeathComponent var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.systems;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.ResourceType;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.math.util.ChunkUtil;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.modules.entity.AllLegacyLivingEntityTypesQuery;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
class="kw">import com.hypixel.hytale.server.core.modules.entity.damage.DeathComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.damage.DeathSystems;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.blackboard.Blackboard;
class="kw">import com.hypixel.hytale.server.npc.blackboard.view.event.entity.EntityEventType;
class="kw">import com.hypixel.hytale.server.npc.blackboard.view.event.entity.EntityEventView;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.util.EntityDetectionUtil;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">public class NPCDeathSystems {
class="kw">public NPCDeathSystems() {
}
class="kw">public class="kw">static class EntityViewSystem class="kw">extends DeathSystems.OnDeathSystem {
@Nonnull
class="kw">private class="kw">final ComponentType<EntityStore, Player> playerComponentType = Player.getComponentType();
@Nonnull
class="kw">private class="kw">final ComponentType<EntityStore, TransformComponent> transformComponentType = TransformComponent.getComponentType();
@Nonnull
class="kw">private class="kw">final ResourceType<EntityStore, Blackboard> blackboardResourceType = Blackboard.getResourceType();
@Nonnull
class="kw">private class="kw">final Query<EntityStore> query = Query.and(Query.or(NPCEntity.getComponentType(), this.playerComponentType), this.transformComponentType);
class="kw">public EntityViewSystem() {
}
@Nonnull
@Override
class="kw">public Query<EntityStore> getQuery() {
class="kw">return this.query;
}
class="kw">public void onComponentAdded(
@Nonnull Ref<EntityStore> var1, @Nonnull DeathComponent var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4
) {
Damage var5 = var2.getDeathInfo();
if (var5 != null && var5.getSource() class="kw">instanceof Damage.EntitySource var6) {
Ref var12 = var6.getRef();
if (var12.isValid()) {
if (EntityDetectionUtil.isDetectableByNPCs(var12, var4)) {
TransformComponent var8 = var3.getComponent(var1, this.transformComponentType);
assert var8 != null;
Vector3d var9 = var8.getPosition();
Blackboard var10 = var3.getResource(this.blackboardResourceType);
EntityEventView var11 = var10.getView(EntityEventView.class, ChunkUtil.chunkCoordinate(var9.x), ChunkUtil.chunkCoordinate(var9.z));
var11.processAttackedEvent(var1, var12, var4, EntityEventType.DEATH);
}
}
}
}
}
class="kw">public class="kw">static class NPCKillsEntitySystem class="kw">extends DeathSystems.OnDeathSystem {
class="kw">public NPCKillsEntitySystem() {
}
@Nonnull
@Override
class="kw">public Query<EntityStore> getQuery() {
class="kw">return Query.and(AllLegacyLivingEntityTypesQuery.INSTANCE, TransformComponent.getComponentType());
}
class="kw">public void onComponentAdded(
@Nonnull Ref<EntityStore> var1, @Nonnull DeathComponent var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4
) {
ComponentType var5 = NPCEntity.getComponentType();
if (var5 != null) {
Damage var6 = var2.getDeathInfo();
if (var6 != null && var6.getSource() class="kw">instanceof Damage.EntitySource var7) {
Ref var11 = var7.getRef();
NPCEntity var9 = var3.getComponent(var11, var5);
if (var9 != null) {
TransformComponent var10 = var3.getComponent(var1, TransformComponent.getComponentType());
assert var10 != null;
var9.getDamageData().onKill(var1, new Vector3d(var10.getPosition()));
}
}
}
}
}
}