diff --git a/src/main/java/baubles/api/BaubleType.java b/src/main/java/baubles/api/BaubleType.java index 22349ff7..5e513497 100644 --- a/src/main/java/baubles/api/BaubleType.java +++ b/src/main/java/baubles/api/BaubleType.java @@ -3,5 +3,6 @@ public enum BaubleType { RING, AMULET, - BELT + BELT, + UNIVERSAL } diff --git a/src/main/java/baubles/api/expanded/BaubleExpandedSlots.java b/src/main/java/baubles/api/expanded/BaubleExpandedSlots.java index 51ec8004..d66f22dd 100644 --- a/src/main/java/baubles/api/expanded/BaubleExpandedSlots.java +++ b/src/main/java/baubles/api/expanded/BaubleExpandedSlots.java @@ -23,6 +23,7 @@ public class BaubleExpandedSlots { public static final String ringType = "ring"; public static final String amuletType = "amulet"; public static final String beltType = "belt"; + public static final String universalType = "universal"; public static final String headType = "head"; public static final String bodyType = "body"; public static final String charmType = "charm"; @@ -36,7 +37,7 @@ public class BaubleExpandedSlots { /** * Registers a type and returns true if the type could be or has been registered. * Types can only be registered while the loader state is pre-initialization. - * + * * @param type The type to register. * @return If a type was registered or had been registered previously. */ @@ -57,10 +58,10 @@ public static boolean tryRegisterType(String type) { /** * Returns false if the type is unregistered or unknown, the minimum number of * assigned slots cannot be met, or the loader state is not pre-initialization. - * + * * @param type The type of the slot to evaluate and possibly assign. * @param minimumOfType The minimum slots of type to be assigned. - * + * * @return If the total assigned slots of the specified type equals or is more than the minimum. */ public static boolean tryAssignSlotsUpToMinimum(String type, int minimumOfType) { @@ -91,10 +92,10 @@ public static boolean tryAssignSlotsUpToMinimum(String type, int minimumOfType) /** * Returns false if the type is unregistered or unknown, or the * loader state is not pre-initialization. - * + * * @param type The type of the slot to evaluate and possibly unassign. * @param maximumOfType The maximum slots of type to be left assigned. - * + * * @return If the total assigned slots of the specified type equals or is less than the maximum. */ public static boolean tryUnassignSlotsDownToMaximum(String type, int maximumOfType) { @@ -130,9 +131,9 @@ public static boolean tryUnassignSlotsDownToMaximum(String type, int maximumOfTy * Returns if a slot was assigned successfully. * Does not assign a type to a slot if the type is unregistered, no slots * are free, or the loader state is not pre-initialization. - * + * * @param type The type to attempt assigning to a slot. - * + * * @return If assigning a type to a slot was successful or not. */ public static boolean tryAssignSlotOfType(String type) { @@ -148,9 +149,9 @@ public static boolean tryAssignSlotOfType(String type) { /** * Unassigns the last slot of the specified type if one can be found * and the loader state is pre-initialization. - * + * * @param type The type of the slot to be unassigned. - * + * * @return If unassigning a slot was successful or not. */ public static boolean tryUnassignSlotOfType(String type) { @@ -171,9 +172,9 @@ public static boolean tryUnassignSlotOfType(String type) { /** * Returns the current number of slots with a matching type. - * + * * @param type The type of slot being counted. - * + * * @return The current total slots with a matching type assigned. */ public static int totalCurrentlyAssignedSlotsOfType(String type) { @@ -191,9 +192,9 @@ public static int totalCurrentlyAssignedSlotsOfType(String type) { /** * Returns an array of slot indexes that have the specified type assigned. * Do not treat results from this as final until postinit or later. - * + * * @param type The type of slot being checked. - * + * * @return an array of slot indexes with the specified type. */ public static int[] getIndexesOfAssignedSlotsOfType(String type) { @@ -211,9 +212,9 @@ public static int[] getIndexesOfAssignedSlotsOfType(String type) { /** * Returns if the type is registered or not. - * + * * @param type The type to check the registration of. - * + * * @return If the type is registered or not. */ public static boolean isTypeRegistered(String type) { @@ -222,7 +223,7 @@ public static boolean isTypeRegistered(String type) { /** * Returns the number of bauble slots that are currently used. - * + * * @return The number of bauble slots currently used. */ public static int slotsCurrentlyUsed() { @@ -231,7 +232,7 @@ public static int slotsCurrentlyUsed() { /** * Returns the number of bauble slots that are currently unused. - * + * * @return The number of bauble slots currently unused. */ public static int slotsCurrentlyUnused() { @@ -240,7 +241,7 @@ public static int slotsCurrentlyUnused() { /** * Returns the type of the specified slot, "unknown" if out of range. - * + * * @param slot The slot to check * @return The type of the specified slot or unknown. */ @@ -255,7 +256,7 @@ public static String getSlotType(int slot) { /** * Returns the index of a certain type in the registeredType array * or -1 if it cannot be found. - * + * * @param type The type to get the index of * @return Index of a type or negative one */ @@ -266,7 +267,7 @@ public static int getIndexOfTypeInRegisteredTypes(String type) { /** * Returns the currently registered bauble types. * If pre-initialization is done this list is effectively final. - * + * * @return The currently registered bauble types. */ public static ArrayList getCurrentlyRegisteredTypes() { @@ -276,7 +277,7 @@ public static ArrayList getCurrentlyRegisteredTypes() { /** * Returns the current slot assignments as a string array. * If initialization is done this list is effectively final. - * + * * @return The current contents of the slots array. */ public static String[] getCurrentSlotAssignments() { @@ -285,9 +286,9 @@ public static String[] getCurrentSlotAssignments() { /** * Returns a type based on the specified BaubleType. - * + * * @param type The BaubleType to get a matching type from. - * + * * @return The type matching the BaubleType or unknown. */ public static String getTypeFromBaubleType(BaubleType type) { @@ -295,14 +296,16 @@ public static String getTypeFromBaubleType(BaubleType type) { return invalidType; } switch(type) { - case RING: - return ringType; - case AMULET: - return amuletType; - case BELT: - return beltType; - default: - return unknownType; + case RING: + return ringType; + case AMULET: + return amuletType; + case BELT: + return beltType; + case UNIVERSAL: + return universalType; + default: + return unknownType; } } @@ -312,7 +315,7 @@ public static String getTypeFromBaubleType(BaubleType type) { * Any entry that would go over slotLimit is ignored. * If an array is shorter than slotLimit all remaining slots are set to unknown. * Invalid slot types are set to unknown. - * + * * @param overrideSlots The array to override assigned slots with. */ public static void overrideSlots(String[] overrideSlots) { @@ -337,6 +340,7 @@ public static void overrideSlots(String[] overrideSlots) { registeredTypes.add(ringType); registeredTypes.add(amuletType); registeredTypes.add(beltType); + registeredTypes.add(universalType); registeredTypes.add(headType); registeredTypes.add(bodyType); registeredTypes.add(charmType); diff --git a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java index 043f8276..122c05c4 100644 --- a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java +++ b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java @@ -116,7 +116,7 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { types = new String[] {BaubleExpandedSlots.getTypeFromBaubleType(((IBauble)item).getBaubleType(returnStack))}; } for(String type : types) { - if(type.equals(BaubleExpandedSlots.getSlotType(baubleSlot - 4)) && !mergeItemStack(originalStack, baubleSlot, baubleSlot + 1, false)) { + if((type.equals(BaubleExpandedSlots.universalType) || type.equals(BaubleExpandedSlots.getSlotType(baubleSlot - 4))) && !mergeItemStack(originalStack, baubleSlot, baubleSlot + 1, false)) { returnStack = null; } } diff --git a/src/main/java/baubles/common/container/InventoryBaubles.java b/src/main/java/baubles/common/container/InventoryBaubles.java index 283feff6..34a12fed 100644 --- a/src/main/java/baubles/common/container/InventoryBaubles.java +++ b/src/main/java/baubles/common/container/InventoryBaubles.java @@ -210,7 +210,7 @@ public boolean isItemValidForSlot(int slot, ItemStack stack) { } for(String type : types) { - if(type.equals(slotType)) { + if(type.equals(BaubleExpandedSlots.universalType) || type.equals(slotType)) { return true; } }