mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-11-27 15:23:12 +00:00
fix off-by-one error in slot unassignment logic
This commit is contained in:
1 file changed
+2
-2
@@ -110,7 +110,7 @@ public class BaubleExpandedSlots {
|
||||
if(total > maximumOfType) {
|
||||
total -= maximumOfType;
|
||||
for(int i = 0; i < total; i++) {
|
||||
for(int slotToCheck = slotsCurrentlyUsed(); slotToCheck > 0; slotToCheck--) {
|
||||
for(int slotToCheck = slotsCurrentlyUsed(); slotToCheck >= 0; slotToCheck--) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
for(int slotToMove = slotToCheck + 1; slotToMove < slotLimit; slotToMove++) {
|
||||
assignedSlots[slotToMove - 1] = assignedSlots[slotToMove];
|
||||
@@ -156,7 +156,7 @@ public class BaubleExpandedSlots {
|
||||
*/
|
||||
public static boolean tryUnassignSlotOfType(String type) {
|
||||
if(newSlotsRemaining < slotLimit && type != null && !type.equals(unknownType) && Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION) {
|
||||
for(int slotToCheck = slotsCurrentlyUsed(); slotToCheck > 0; slotToCheck--) {
|
||||
for(int slotToCheck = slotsCurrentlyUsed(); slotToCheck >= 0; slotToCheck--) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
for(int slotToMove = slotToCheck + 1; slotToMove < slotLimit; slotToMove++) {
|
||||
assignedSlots[slotToMove - 1] = assignedSlots[slotToMove];
|
||||
|
||||
Reference in new issue
Block a user