mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
Makes ARMOR item explorer four slots tall.
This commit is contained in:
parent
7a69f3b1ff
commit
b134744a5f
@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.api;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.util.identify.UnidentifiedItem;
|
||||
import net.Indyuce.mmoitems.manager.TypeManager;
|
||||
@ -46,7 +47,7 @@ public class Type {
|
||||
public static final Type ORNAMENT = new Type(TypeSet.EXTRA, "ORNAMENT", false, EquipmentSlot.ANY);
|
||||
|
||||
// extra
|
||||
public static final Type ARMOR = new Type(TypeSet.EXTRA, "ARMOR", false, EquipmentSlot.ARMOR);
|
||||
public static final Type ARMOR = new Type(TypeSet.EXTRA, "ARMOR", false, EquipmentSlot.ARMOR, true);
|
||||
public static final Type TOOL = new Type(TypeSet.EXTRA, "TOOL", false, EquipmentSlot.MAIN_HAND);
|
||||
public static final Type CONSUMABLE = new Type(TypeSet.EXTRA, "CONSUMABLE", false, EquipmentSlot.MAIN_HAND);
|
||||
public static final Type MISCELLANEOUS = new Type(TypeSet.EXTRA, "MISCELLANEOUS", false, EquipmentSlot.MAIN_HAND);
|
||||
@ -59,6 +60,12 @@ public class Type {
|
||||
private String name;
|
||||
private final TypeSet set;
|
||||
|
||||
public boolean isFourGUIMode() {
|
||||
return fourGUIMode;
|
||||
}
|
||||
|
||||
private final boolean fourGUIMode;
|
||||
|
||||
/**
|
||||
* Used for item type restrictions for gem stones to easily check if the
|
||||
* item is a weapon.
|
||||
@ -89,10 +96,13 @@ public class Type {
|
||||
private final List<ItemStat> available = new ArrayList<>();
|
||||
|
||||
public Type(TypeSet set, String id, boolean weapon, EquipmentSlot equipType) {
|
||||
this(set, id, weapon, equipType, false);
|
||||
}
|
||||
public Type(TypeSet set, String id, boolean weapon, EquipmentSlot equipType, boolean fourGUI) {
|
||||
this.set = set;
|
||||
this.id = id.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||
this.equipType = equipType;
|
||||
|
||||
this.fourGUIMode = fourGUI;
|
||||
this.weapon = weapon;
|
||||
}
|
||||
|
||||
@ -103,6 +113,7 @@ public class Type {
|
||||
set = parent.set;
|
||||
weapon = parent.weapon;
|
||||
equipType = parent.equipType;
|
||||
this.fourGUIMode = config.getBoolean("AlternateGUIMode", parent.fourGUIMode);
|
||||
}
|
||||
|
||||
public void load(ConfigurationSection config) {
|
||||
|
@ -79,6 +79,7 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "- " + ChatColor.RED
|
||||
+ (MMOItems.plugin.getRecipes().getLoadedLegacyRecipes().size()
|
||||
+ MMOItems.plugin.getRecipes().getLegacyCustomRecipes().size()
|
||||
+ MMOItems.plugin.getRecipes().getBooklessRecipes().size()
|
||||
+ MMOItems.plugin.getRecipes().getCustomRecipes().size())
|
||||
+ ChatColor.GRAY + " Recipes");
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -38,6 +39,8 @@ public class ItemBrowser extends PluginInventory {
|
||||
private boolean deleteMode;
|
||||
|
||||
private static final int[] slots = { 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34 };
|
||||
//private static final int[] slotsAlt = { 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43 };
|
||||
private static final int[] slotsAlt = { 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34 };
|
||||
|
||||
public ItemBrowser(Player player) {
|
||||
this(player, null);
|
||||
@ -48,11 +51,14 @@ public class ItemBrowser extends PluginInventory {
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
int[] getUsedSlots(@Nullable Type forType) { return forType == null ? slots : forType.isFourGUIMode() ? slotsAlt : slots; }
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
int min = (page - 1) * slots.length;
|
||||
int max = page * slots.length;
|
||||
int[] usedSlots = getUsedSlots(type);
|
||||
int min = (page - 1) * usedSlots.length;
|
||||
int max = page * usedSlots.length;
|
||||
int n = 0;
|
||||
|
||||
/*
|
||||
@ -125,7 +131,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
ItemStack item = template.newBuilder(playerData.getRPG()).build().newBuilder().build();
|
||||
if (item == null || item.getType() == Material.AIR) {
|
||||
cached.put(template.getId(), error);
|
||||
inv.setItem(slots[n++], error);
|
||||
inv.setItem(usedSlots[n++], error);
|
||||
continue;
|
||||
}
|
||||
NBTItem nbtItem = NBTItem.get(item);
|
||||
@ -148,7 +154,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
|
||||
cached.put(template.getId(), nbtItem.toItem());
|
||||
|
||||
inv.setItem(slots[n++], cached.get(template.getId()));
|
||||
inv.setItem(usedSlots[n++], cached.get(template.getId()));
|
||||
}
|
||||
|
||||
ItemStack noItem = VersionMaterial.GRAY_STAINED_GLASS_PANE.toItem();
|
||||
@ -192,8 +198,8 @@ public class ItemBrowser extends PluginInventory {
|
||||
inv.setItem(45, downloadPack);
|
||||
}
|
||||
|
||||
while (n < slots.length)
|
||||
inv.setItem(slots[n++], noItem);
|
||||
while (n < usedSlots.length)
|
||||
inv.setItem(usedSlots[n++], noItem);
|
||||
if (!deleteMode)
|
||||
inv.setItem(51, create);
|
||||
inv.setItem(47, delete);
|
||||
|
@ -214,6 +214,7 @@ public class RecipeManager implements Reloadable {
|
||||
return legacyCraftingRecipes;
|
||||
}
|
||||
public HashMap<NamespacedKey, MythicRecipeBlueprint> getCustomRecipes() { return customRecipes; }
|
||||
public ArrayList<MythicRecipeBlueprint> getBooklessRecipes() { return booklessRecipes; }
|
||||
|
||||
@Nullable
|
||||
ArrayList<NamespacedKey> generatedNKs;
|
||||
|
Loading…
Reference in New Issue
Block a user