ObjectiveInventoryChangeSystem class
Пакет: com.hypixel.hytale.builtin.adventure.objectives.systems
Файл: com/hypixel/hytale/builtin/adventure/objectives/systems/ObjectiveInventoryChangeSystem.java
extends: EntityEventSystem<EntityStore, InventoryChangeEvent>
Поля (14)
| Модификаторы | Тип | Имя |
|---|---|---|
|
ObjectiveAsset |
var10 |
|
UUIDComponent |
var11 |
|
Objective |
var12 |
|
ObjectiveTask[] |
var13 |
|
Set |
var4 |
|
|
var4 |
|
CombinedItemContainer |
var5 |
|
ObjectiveDataStore |
var6 |
|
Player |
var7 |
|
ItemStack |
var7 |
|
Set |
var8 |
|
UUID |
var8 |
|
Ref |
var9 |
|
Objective |
var9 |
Методы (15)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(UUID var11 : var8) |
|
|
for for(ObjectiveTask var17 : var13) |
|
|
for for(UUID var13 : var1) |
abstract |
|
for for(short var6 = 0; var6 < var5.getCapacity() |
public |
void |
handlevoid handle(int var1,
@Nonnull ArchetypeChunk<EntityStore> var2,
@Nonnull Store<EntityStore> var3,
@Nonnull CommandBuffer<EntityStore> var4,
@Nonnull InventoryChangeEvent var5) |
static |
void |
handleRemoveOnItemDropvoid handleRemoveOnItemDrop(@Nonnull Ref<EntityStore> var0, @Nonnull Set<UUID> var1, @Nonnull ObjectiveDataStore var2, @Nonnull Store<EntityStore> var3) |
abstract |
|
handleRemoveOnItemDrop handleRemoveOnItemDrop(var9, var8, var6, var3) |
|
|
if if(var6 != null) |
|
|
if if(var12 != null) |
|
|
if if(var13 != null) |
|
|
if if(var17 instanceof InventoryChangeAware var18) |
|
|
if if(var8 != null) |
|
|
if if(var4 == null) |
|
|
if if(var9 != null) |
abstract |
|
super super(InventoryChangeEvent.class) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.objectives.systems;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.Objective;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.ObjectiveDataStore;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.ObjectivePlugin;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.ObjectiveAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.interactions.StartObjectiveInteraction;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.InventoryChangeAware;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.ObjectiveTask;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.component.system.EntityEventSystem;
class="kw">import com.hypixel.hytale.server.core.entity.UUIDComponent;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.event.events.ecs.InventoryChangeEvent;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
class="kw">import com.hypixel.hytale.server.core.inventory.ItemStack;
class="kw">import com.hypixel.hytale.server.core.inventory.container.CombinedItemContainer;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.HashSet;
class="kw">import java.util.Set;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ObjectiveInventoryChangeSystem class="kw">extends EntityEventSystem<EntityStore, InventoryChangeEvent> {
class="kw">public ObjectiveInventoryChangeSystem() {
super(InventoryChangeEvent.class);
}
class="kw">public void handle(
int var1,
@Nonnull ArchetypeChunk<EntityStore> var2,
@Nonnull Store<EntityStore> var3,
@Nonnull CommandBuffer<EntityStore> var4,
@Nonnull InventoryChangeEvent var5
) {
ObjectiveDataStore var6 = ObjectivePlugin.get().getObjectiveDataStore();
if (var6 != null) {
Player var7 = var2.getComponent(var1, Player.getComponentType());
assert var7 != null;
Set var8 = var7.getPlayerConfigData().getActiveObjectiveUUIDs();
if (!var8.isEmpty()) {
Ref var9 = var2.getReferenceTo(var1);
handleRemoveOnItemDrop(var9, var8, var6, var3);
for (UUID var11 : var8) {
Objective var12 = var6.getObjective(var11);
if (var12 != null) {
ObjectiveTask[] var13 = var12.getCurrentTasks();
if (var13 != null) {
for (ObjectiveTask var17 : var13) {
if (var17 class="kw">instanceof InventoryChangeAware var18) {
var18.onInventoryChange(var12, var9, var3, var5);
}
}
}
}
}
}
}
}
class="kw">private class="kw">static void handleRemoveOnItemDrop(
@Nonnull Ref<EntityStore> var0, @Nonnull Set<UUID> var1, @Nonnull ObjectiveDataStore var2, @Nonnull Store<EntityStore> var3
) {
Set var4 = null;
CombinedItemContainer var5 = InventoryComponent.getCombined(var3, var0, InventoryComponent.HOTBAR_FIRST);
for (short var6 = 0; var6 < var5.getCapacity(); var6++) {
ItemStack var7 = var5.getItemStack(var6);
if (!ItemStack.isEmpty(var7)) {
UUID var8 = var7.getFromMetadataOrNull(StartObjectiveInteraction.OBJECTIVE_UUID);
if (var8 != null) {
if (var4 == null) {
var4 = new HashSet<>();
}
var4.add(var8);
}
}
}
UUIDComponent var11 = var3.getComponent(var0, UUIDComponent.getComponentType());
assert var11 != null;
for (UUID var13 : var1) {
if (var4 == null || !var4.contains(var13)) {
Objective var9 = var2.getObjective(var13);
if (var9 != null) {
ObjectiveAsset var10 = var9.getObjectiveAsset();
if (var10 != null && var10.isRemoveOnItemDrop()) {
ObjectivePlugin.get().removePlayerFromExistingObjective(var3, var11.getUuid(), var13);
}
}
}
}
}
@Nullable
@Override
class="kw">public Query<EntityStore> getQuery() {
class="kw">return Player.getComponentType();
}
}