mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-11-25 06:14:30 +00:00
WIP API for adding new slots
Rendering needs reworked and shift-clicking needs some improvements.
This commit is contained in:
1 parent
36a332e597
commit
e50c4de348
11 files changed
+393
-434
No files matched your search
@@ -0,0 +1,65 @@
|
||||
package baubles.api.expanded;
|
||||
|
||||
public class BaubleExpandedSlots {
|
||||
|
||||
public static final int slotLimit = 20;
|
||||
|
||||
private static String[] slots = new String[slotLimit];
|
||||
private static int newSlotsRemaining = slotLimit;
|
||||
|
||||
static {
|
||||
requestAddSlot("AMULET");
|
||||
requestAddSlot("RING");
|
||||
requestAddSlot("RING");
|
||||
requestAddSlot("BELT");
|
||||
}
|
||||
|
||||
public static boolean requestAddSlot(String type) {
|
||||
//TODO: block after GUI init
|
||||
if(newSlotsRemaining >= 1) {
|
||||
slots[slotLimit - newSlotsRemaining] = type;
|
||||
newSlotsRemaining--;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean requestRemoveSlot(String type) {
|
||||
//TODO: block after GUI init
|
||||
for(int slotToCheck = 0; slotToCheck < slotLimit; slotToCheck++) {
|
||||
if(slots[slotToCheck].equals(type)) {
|
||||
for(int slotToMove = slotToCheck + 1; slotToMove < slotLimit; slotToMove++) {
|
||||
slots[slotToMove - 1] = slots[slotToMove];
|
||||
}
|
||||
slots[slotLimit - 1] = null;
|
||||
newSlotsRemaining++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int totalCurrentSlotsForType(String type) {
|
||||
int total = 0;
|
||||
for(int slotToCheck = 0; slotToCheck < slotLimit; slotToCheck++) {
|
||||
if(slots[slotToCheck].equals(type)) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public static int getTotalSlots() {
|
||||
return slotLimit - newSlotsRemaining;
|
||||
}
|
||||
|
||||
public static String getTypeInSlot(int slot) {
|
||||
if (slot > 0 & slot < slotLimit) {
|
||||
return slots[slot];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user