Class Util
java.lang.Object
de.placeblock.betterinventories.util.Util
Utility Functions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Vector2dcalculateGUISize(Collection<?> items) Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.static Vector2dcalculateGUISize(Collection<?> items, int width) Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.static <T> Vector2dcalculateGUISize(T[] items) Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.static <T> Vector2dcalculateGUISize(T[] items, int width) Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.static intmodulo(int dividend, int divisor) Modulo that also works for negative numbersstatic Vector2dslotToVector(int slot, int width) Calculates the Vector given a slot and a widthstatic intvectorToSlot(Vector2d vector, int width) Calculates the slot given a Vector and a width
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
calculateGUISize
Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.- Type Parameters:
T- The type of the Items- Parameters:
items- The Items Array- Returns:
- The Inventory size
-
calculateGUISize
Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.- Type Parameters:
T- The type of the Items- Parameters:
items- The Items Arraywidth- The width of the GUI- Returns:
- The Inventory size
-
calculateGUISize
Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.- Parameters:
items- The Items Collection- Returns:
- The Inventory size
-
calculateGUISize
Can be used to calculate the size of an Inventory based on the amount of Items this Inventory should contain.- Parameters:
items- The Items Collectionwidth- The width of the GUI- Returns:
- The Inventory size
-
slotToVector
Calculates the Vector given a slot and a width- Parameters:
slot- The slotwidth- The width- Returns:
- The according Vector
-
vectorToSlot
Calculates the slot given a Vector and a width- Parameters:
vector- The Vectorwidth- The width- Returns:
- The according slot
-
modulo
public static int modulo(int dividend, int divisor) Modulo that also works for negative numbers- Parameters:
dividend- The dividenddivisor- The divisor- Returns:
- The modulo
-