Search in sources :

Example 1 with CustomModelFolder

use of gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder in project Nexus by ProjectEdenGG.

the class CustomModelMenu method addFolder.

private static void addFolder(String walk, String folder, String parent) {
    CustomModelFolder existing = ResourcePack.getRootFolder().getFolder(walk);
    if (existing == null)
        if (parent.isEmpty())
            ResourcePack.getRootFolder().addFolder(folder);
        else
            ResourcePack.getRootFolder().getFolder(parent).addFolder(folder);
}
Also used : CustomModelFolder(gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder)

Example 2 with CustomModelFolder

use of gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder in project Nexus by ProjectEdenGG.

the class CustomModelMenu method init.

@Override
public void init() {
    if (previousMenu == null)
        addCloseItem();
    else
        addBackItem(e -> previousMenu.open(player));
    List<ClickableItem> items = new ArrayList<>();
    for (CustomModelFolder folder : folder.getFolders()) {
        CustomModel firstModel = folder.getIcon();
        ItemStack item = new ItemStack(Material.BARRIER);
        if (firstModel != null)
            item = firstModel.getDisplayItem();
        ItemBuilder builder = new ItemBuilder(item).name(folder.getDisplayPath()).glow();
        items.add(ClickableItem.of(builder.build(), e -> new CustomModelMenu(folder, this).open(player)));
    }
    if (!items.isEmpty()) {
        while (items.size() % 9 != 0) items.add(ClickableItem.NONE);
        for (int i = 0; i < 9; i++) items.add(ClickableItem.NONE);
    }
    for (CustomModel model : folder.getModels()) {
        if (model.getFileName().equals("icon"))
            continue;
        ItemBuilder item = new ItemBuilder(model.getDisplayItem()).lore("").lore("&7Click to obtain item").lore("&7Shift+Click to obtain item with name");
        items.add(ClickableItem.of(item.build(), e -> PlayerUtils.giveItem(player, e.isShiftClick() ? model.getDisplayItem() : model.getItem())));
    }
    paginator().items(items).build();
}
Also used : CustomModel(gg.projecteden.nexus.features.resourcepack.models.CustomModel) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) NonNull(lombok.NonNull) RequiredArgsConstructor(lombok.RequiredArgsConstructor) CustomModelGroup(gg.projecteden.nexus.features.resourcepack.models.files.CustomModelGroup) Set(java.util.Set) ClickableItem(gg.projecteden.nexus.features.menus.api.ClickableItem) TreeSet(java.util.TreeSet) ItemStack(org.bukkit.inventory.ItemStack) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) PlayerUtils(gg.projecteden.nexus.utils.PlayerUtils) List(java.util.List) CustomModelFolder(gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder) InventoryProvider(gg.projecteden.nexus.features.menus.api.content.InventoryProvider) Material(org.bukkit.Material) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) ClickableItem(gg.projecteden.nexus.features.menus.api.ClickableItem) ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) CustomModel(gg.projecteden.nexus.features.resourcepack.models.CustomModel) CustomModelFolder(gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder)

Example 3 with CustomModelFolder

use of gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder in project Nexus by ProjectEdenGG.

the class ResourcePack method setup.

private static void setup() {
    modelGroups = new ArrayList<>();
    folders = new ArrayList<>();
    models = new HashMap<>();
    rootFolder = new CustomModelFolder("/");
}
Also used : CustomModelFolder(gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder)

Aggregations

CustomModelFolder (gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder)3 ClickableItem (gg.projecteden.nexus.features.menus.api.ClickableItem)1 InventoryProvider (gg.projecteden.nexus.features.menus.api.content.InventoryProvider)1 CustomModel (gg.projecteden.nexus.features.resourcepack.models.CustomModel)1 CustomModelGroup (gg.projecteden.nexus.features.resourcepack.models.files.CustomModelGroup)1 ItemBuilder (gg.projecteden.nexus.utils.ItemBuilder)1 PlayerUtils (gg.projecteden.nexus.utils.PlayerUtils)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 NonNull (lombok.NonNull)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Material (org.bukkit.Material)1 ItemStack (org.bukkit.inventory.ItemStack)1