RoleUtils class
Пакет: com.hypixel.hytale.server.npc.role
Файл: com/hypixel/hytale/server/npc/role/RoleUtils.java
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
|
InventoryComponent.Armor |
var4 |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
static |
void |
setArmorvoid setArmor(@Nonnull Ref<EntityStore> var0, @Nonnull NPCEntity var1, @Nullable String var2, @Nonnull ComponentAccessor<EntityStore> var3) |
static |
void |
setItemInHandvoid setItemInHand(@Nonnull Ref<EntityStore> var0, @Nonnull NPCEntity var1, @Nullable String var2, @Nonnull ComponentAccessor<EntityStore> var3) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.role;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.NPCPlugin;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.util.InventoryHelper;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class RoleUtils {
class="kw">public RoleUtils() {
}
class="kw">public class="kw">static void setItemInHand(
@Nonnull Ref<EntityStore> var0, @Nonnull NPCEntity var1, @Nullable String var2, @Nonnull ComponentAccessor<EntityStore> var3
) {
if (!InventoryHelper.useItem(var0, var2, var3)) {
NPCPlugin.get().getLogger().at(Level.WARNING).log("NPC of type '%s': Failed to use item '%s'", var1.getRoleName(), var2);
}
}
class="kw">public class="kw">static void setArmor(@Nonnull Ref<EntityStore> var0, @Nonnull NPCEntity var1, @Nullable String var2, @Nonnull ComponentAccessor<EntityStore> var3) {
InventoryComponent.Armor var4 = var3.getComponent(var0, InventoryComponent.Armor.getComponentType());
if (var4 == null || !InventoryHelper.useArmor(var4.getInventory(), var2)) {
NPCPlugin.get().getLogger().at(Level.WARNING).log("NPC of type '%s': Failed to use armor '%s'", var1.getRoleName(), var2);
}
}
}