Skip to content

Commit

Permalink
reformat whole file to the rescue!
Browse files Browse the repository at this point in the history
  • Loading branch information
viciscat committed Mar 19, 2024
1 parent c281160 commit fd91bf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void init() {
this.recipeBook.toggleOpen();
this.x = this.recipeBook.findLeftEdge(this.width, this.backgroundWidth) + 11;
button.setPosition(this.x + 5, this.height / 2 - 49);
if(moreCraftsButton != null) moreCraftsButton.setPosition(this.x + 174, this.y+62);
if (moreCraftsButton != null) moreCraftsButton.setPosition(this.x + 174, this.y + 62);
}));
moreCraftsButton = new TexturedButtonWidget(this.x + 174, y + 62, 16, 16, MORE_CRAFTS_TEXTURES,
button -> this.onMouseClick(handler.slots.get(26), handler.slots.get(26).id, 0, SlotActionType.PICKUP));
Expand Down Expand Up @@ -100,7 +100,7 @@ protected void drawBackground(DrawContext context, float delta, int mouseX, int
int i = this.x;
int j = (this.height - this.backgroundHeight) / 2;
context.drawTexture(TEXTURE, i, j, 0, 0, this.backgroundWidth, this.backgroundHeight);
context.drawGuiTexture(QUICK_CRAFT, i+173, j, 0, 25, 84);
context.drawGuiTexture(QUICK_CRAFT, i + 173, j, 0, 25, 84);
}

@Override
Expand All @@ -122,7 +122,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {

@Override
protected boolean isClickOutsideBounds(double mouseX, double mouseY, int left, int top, int button) {
boolean bl = mouseX < (double)left || mouseY < (double)top || mouseX >= (double)(left + this.backgroundWidth) || mouseY >= (double)(top + this.backgroundHeight);
boolean bl = mouseX < (double) left || mouseY < (double) top || mouseX >= (double) (left + this.backgroundWidth) || mouseY >= (double) (top + this.backgroundHeight);
return this.recipeBook.isClickOutsideBounds(mouseX, mouseY, this.x, this.y, this.backgroundWidth, this.backgroundHeight, button) && bl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public class SkyblockCraftingTableScreenHandler extends GenericContainerScreenHa
19, 20, 21, 23, 25,
28, 29, 30, 34
};

public SkyblockCraftingTableScreenHandler(ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, Inventory inventory, int rows) {
super(type, syncId, playerInventory, inventory, rows);
for (int i = 0; i < rows*9; i++) {
for (int i = 0; i < rows * 9; i++) {
Slot originalSlot = slots.get(i);
if (Arrays.binarySearch(normalSlots, i) >= 0) {
int[] coords = getCoords(i);
Expand All @@ -31,7 +32,7 @@ public SkyblockCraftingTableScreenHandler(ScreenHandlerType<?> type, int syncId,
}
}
int yOffset = (rows - 4) * 18 + 19;
for (int i = rows*9; i < slots.size(); i++) {
for (int i = rows * 9; i < slots.size(); i++) {
Slot originalSlot = slots.get(i);
Slot slot = new Slot(originalSlot.inventory, originalSlot.getIndex(), originalSlot.x, originalSlot.y - yOffset);
slot.id = i;
Expand All @@ -46,12 +47,12 @@ public SkyblockCraftingTableScreenHandler(GenericContainerScreenHandler handler,
private int[] getCoords(int slot) {
if (slot == 23) return new int[]{124, 35};
if (slot == 16 || slot == 25 || slot == 34) {
int y = (slot/9 - 1) * 18 + 8;
int y = (slot / 9 - 1) * 18 + 8;
return new int[]{174, y};
}
int gridX = slot%9 - 1;
int gridY = slot/9 - 1;
return new int[]{30 + gridX*18, 17+gridY*18};
int gridX = slot % 9 - 1;
int gridY = slot / 9 - 1;
return new int[]{30 + gridX * 18, 17 + gridY * 18};
}

public static class DisabledSlot extends Slot {
Expand Down

0 comments on commit fd91bf9

Please sign in to comment.