Skip to content

Commit

Permalink
Fixed addContent methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 11, 2024
1 parent 6ee7c46 commit 58c6922
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gui/base/src/main/java/it/angrybear/yagl/guis/GUIImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean isMovable(int slot) {
int j = 0;
for (int i = 0; i < contents.length; i++) {
j = addSingle(contents[i], j);
if (j == -1)
if (j >= size())
throw new IllegalArgumentException(String.format("Could not set content at index %s because contents are already full", i));
}
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package it.angrybear.yagl.guis;


import org.jetbrains.annotations.NotNull;
import it.angrybear.yagl.contents.GUIContent;
import org.jetbrains.annotations.NotNull;

/**
* Represents a "chest" GUI that can be resized.
Expand Down Expand Up @@ -39,7 +39,7 @@ public ResizableGUI(int size) {
for (int i = 0; i < contents.length; i++) {
GUIContent content = contents[i];
j = addSingle(content, j);
if (j != -1) continue;
if (j < size()) continue;
if (size() < MAX_SIZE) {
resize(size() + 9);
this.contents.set(j, new Contents(content));
Expand Down

0 comments on commit 58c6922

Please sign in to comment.