aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
diff options
context:
space:
mode:
authorvicisacat <victor.branchu@gmail.com>2024-03-24 17:59:31 +0100
committervicisacat <victor.branchu@gmail.com>2024-04-12 17:19:31 +0200
commit8ed55895fc8469e22e3ae65bf450f3af794d2545 (patch)
tree2dacbb0590ac6cddc03e260f8debca34832e4709 /src/main/java/de
parent1afa4bfdf9c8fc4a80d252868d72001c7a34f185 (diff)
downloadSkyblocker-8ed55895fc8469e22e3ae65bf450f3af794d2545.tar.gz
Skyblocker-8ed55895fc8469e22e3ae65bf450f3af794d2545.tar.bz2
Skyblocker-8ed55895fc8469e22e3ae65bf450f3af794d2545.zip
REFORMAT WHOLE FILE THE SEQUEL
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java5
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java53
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java15
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/auction/EditBidPopup.java2
4 files changed, 42 insertions, 33 deletions
diff --git a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java
index 566cc18f..373785d0 100644
--- a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java
+++ b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.java
@@ -29,7 +29,7 @@ public interface HandledScreenProviderMixin<T extends ScreenHandler> {
if (player == null) return;
if (!Utils.isOnSkyblock()) return;
T screenHandler = type.create(id, player.getInventory());
- if (!(screenHandler instanceof GenericContainerScreenHandler containerScreenHandler)) return;
+ if (!(screenHandler instanceof GenericContainerScreenHandler containerScreenHandler)) return;
String nameLowercase = name.getString().toLowerCase();
if (SkyblockerConfigManager.get().general.betterPartyFinder && PartyFinderScreen.possibleInventoryNames.contains(nameLowercase)) {
if (SkyblockerConfigManager.get().general.betterPartyFinder && screenHandler instanceof GenericContainerScreenHandler containerScreenHandler && PartyFinderScreen.possibleInventoryNames.contains(name.getString().toLowerCase())) {
@@ -63,7 +63,8 @@ public interface HandledScreenProviderMixin<T extends ScreenHandler> {
client.player.currentScreenHandler = auctionHouseScreenHandler;
if (client.currentScreen instanceof AuctionViewScreen auctionViewScreen) {
auctionViewScreen.changeHandler(auctionHouseScreenHandler);
- } else client.setScreen(new AuctionViewScreen(auctionHouseScreenHandler, client.player.getInventory(), name));
+ } else
+ client.setScreen(new AuctionViewScreen(auctionHouseScreenHandler, client.player.getInventory(), name));
ci.cancel();
} else if (SkyblockerConfigManager.get().general.fancyAuctionHouse.enabled && (nameLowercase.contains("confirm purchase") || nameLowercase.contains("confirm bid")) && client.currentScreen instanceof AuctionViewScreen auctionViewScreen) {
client.setScreen(auctionViewScreen.getConfirmPurchasePopup(name));
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java
index 8e0c695b..6d87515d 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionBrowserScreen.java
@@ -91,8 +91,8 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
resetFiltersButton.setTooltip(Tooltip.of(Text.literal("Reset Filters")));
resetFiltersButton.setTooltipDelay(500);
- addDrawableChild(new ButtonWidget.Builder( Text.literal("<"), button -> this.clickSlot(BACK_BUTTON_SLOT))
- .position(x + 98, y+4)
+ addDrawableChild(new ButtonWidget.Builder(Text.literal("<"), button -> this.clickSlot(BACK_BUTTON_SLOT))
+ .position(x + 98, y + 4)
.size(12, 12)
.build());
@@ -132,9 +132,9 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
MatrixStack matrices = context.getMatrices();
matrices.push();
- matrices.translate(x,y,0);
+ matrices.translate(x, y, 0);
// Search
- context.enableScissor(x+7, y+4, x+97, y+16);
+ context.enableScissor(x + 7, y + 4, x + 97, y + 16);
context.drawText(textRenderer, Text.literal(search).fillStyle(Style.EMPTY.withUnderline(onSearchField(mouseX, mouseY))), 9, 6, Colors.WHITE, true);
context.disableScissor();
@@ -154,7 +154,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
if (totalPages <= 1)
context.drawGuiTexture(SCROLLER_TEXTURE, 156, 18, 12, 15);
else
- context.drawGuiTexture(SCROLLER_TEXTURE, 156, (int) (18 + (float)(Math.min(currentPage, totalPages)-1)/(totalPages-1)*37), 12, 15);
+ context.drawGuiTexture(SCROLLER_TEXTURE, 156, (int) (18 + (float) (Math.min(currentPage, totalPages) - 1) / (totalPages - 1) * 37), 12, 15);
matrices.pop();
@@ -171,23 +171,23 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
@Override
protected void onMouseClick(Slot slot, int slotId, int button, SlotActionType actionType) {
- if (slotId >= handler.getRows()*9) return;
+ if (slotId >= handler.getRows() * 9) return;
super.onMouseClick(slot, slotId, button, actionType);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (isWaitingForServer) return super.mouseClicked(mouseX, mouseY, button);
- if (onScrollbarTop((int)mouseX, (int) mouseY) && prevPageVisible) {
+ if (onScrollbarTop((int) mouseX, (int) mouseY) && prevPageVisible) {
clickSlot(PREV_PAGE_BUTTON);
return true;
}
- if (onScrollbarBottom((int)mouseX, (int) mouseY) && nextPageVisible) {
+ if (onScrollbarBottom((int) mouseX, (int) mouseY) && nextPageVisible) {
clickSlot(NEXT_PAGE_BUTTON);
return true;
}
- if (onSearchField((int)mouseX, (int) mouseY)) {
+ if (onSearchField((int) mouseX, (int) mouseY)) {
clickSlot(SEARCH_BUTTON_SLOT);
return true;
}
@@ -205,6 +205,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
int localY = mouseY - y;
return localX > 154 && localX < 169 && localY > 43 && localY < 80;
}
+
private boolean onSearchField(int mouseX, int mouseY) {
int localX = mouseX - x;
int localY = mouseY - y;
@@ -231,16 +232,19 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
parsePage(stack);
}
}
- case SORT_BUTTON_SLOT -> sortWidget.setCurrent(SortWidget.Option.get(getOrdinal(stack.getTooltip(client.player, TooltipContext.BASIC))));
- case AUCTION_TYPE_BUTTON_SLOT -> auctionTypeWidget.setCurrent(AuctionTypeWidget.Option.get(getOrdinal(stack.getTooltip(client.player, TooltipContext.BASIC))));
+ case SORT_BUTTON_SLOT ->
+ sortWidget.setCurrent(SortWidget.Option.get(getOrdinal(stack.getTooltip(client.player, TooltipContext.BASIC))));
+ case AUCTION_TYPE_BUTTON_SLOT ->
+ auctionTypeWidget.setCurrent(AuctionTypeWidget.Option.get(getOrdinal(stack.getTooltip(client.player, TooltipContext.BASIC))));
case RARITY_BUTTON_SLOT -> {
List<Text> tooltip = stack.getTooltip(client.player, TooltipContext.BASIC);
int ordinal = getOrdinal(tooltip);
- String split = tooltip.get(ordinal+2).getString().substring(2);
- rarityWidget.setText(tooltip.subList(1, tooltip.size()-3), split);
+ String split = tooltip.get(ordinal + 2).getString().substring(2);
+ rarityWidget.setText(tooltip.subList(1, tooltip.size() - 3), split);
}
case RESET_BUTTON_SLOT -> {
- if (resetFiltersButton != null) resetFiltersButton.active = handler.getSlot(slotId).getStack().isOf(Items.ANVIL);
+ if (resetFiltersButton != null)
+ resetFiltersButton.active = handler.getSlot(slotId).getStack().isOf(Items.ANVIL);
}
case SEARCH_BUTTON_SLOT -> {
List<Text> tooltipSearch = stack.getTooltip(client.player, TooltipContext.BASIC);
@@ -256,7 +260,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
}
}
default -> {
- if (slotId < this.handler.getRows()*9 && slotId%9 == 0) {
+ if (slotId < this.handler.getRows() * 9 && slotId % 9 == 0) {
CategoryTabWidget categoryTabWidget = categoryTabWidgets.get(slotId / 9);
categoryTabWidget.setSlotId(slotId);
categoryTabWidget.setIcon(handler.getSlot(slotId).getStack());
@@ -271,7 +275,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
break;
} else categoryTabWidget.setToggled(false);
}
- } else if (slotId > 9 && slotId < (handler.getRows()-1)*9 && slotId%9 > 1 && slotId%9 < 8) {
+ } else if (slotId > 9 && slotId < (handler.getRows() - 1) * 9 && slotId % 9 > 1 && slotId % 9 < 8) {
List<Text> tooltip = stack.getTooltip(client.player, TooltipContext.BASIC);
if (!SkyblockerConfigManager.get().general.fancyAuctionHouse.highlightCheapBIN) return;
for (int k = tooltip.size() - 1; k >= 0; k--) {
@@ -295,7 +299,8 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
else {
isSlotHighlighted.put(slotId, jsonElement.getAsDouble() > parsed);
}
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
}
}
}
@@ -305,9 +310,9 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
private static int getOrdinal(List<Text> tooltip) {
int ordinal = 0;
- for (int j = 0; j < tooltip.size()-3; j++) {
- if (j+2 >= tooltip.size()) break;
- if (tooltip.get(j+2).getString().contains("▶")) {
+ for (int j = 0; j < tooltip.size() - 3; j++) {
+ if (j + 2 >= tooltip.size()) break;
+ if (tooltip.get(j + 2).getString().contains("▶")) {
ordinal = j;
break;
}
@@ -319,6 +324,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
int totalPages = 1;
private boolean prevPageVisible = false;
private boolean nextPageVisible = false;
+
private void parsePage(ItemStack stack) {
assert client != null;
List<Text> tooltip = stack.getTooltip(client.player, TooltipContext.BASIC);
@@ -328,12 +334,13 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
try {
currentPage = Integer.parseInt(parts[0].replace(",", "")); // parse current page
totalPages = Integer.parseInt(parts[1].replace(",", "")); // parse total
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
}
@Override
protected boolean isClickOutsideBounds(double mouseX, double mouseY, int left, int top, int button) {
- return mouseX < (double)left - 32 || mouseY < (double)top || mouseX >= (double)(left + this.backgroundWidth) || mouseY >= (double)(top + this.backgroundHeight);
+ return mouseX < (double) left - 32 || mouseY < (double) top || mouseX >= (double) (left + this.backgroundWidth) || mouseY >= (double) (top + this.backgroundHeight);
}
private static class ScaledTextButtonWidget extends ButtonWidget {
@@ -350,7 +357,7 @@ public class AuctionBrowserScreen extends AbstractCustomHypixelGUI<AuctionHouseS
float textScale = 2.f;
pose.push();
- pose.translate(((this.getX() + this.width / 2f) - font.getWidth(getMessage()) * textScale / 2) + 1, (float)this.getY() + (this.height - font.fontHeight * textScale) / 2f - 1, 0);
+ pose.translate(((this.getX() + this.width / 2f) - font.getWidth(getMessage()) * textScale / 2) + 1, (float) this.getY() + (this.height - font.fontHeight * textScale) / 2f - 1, 0);
pose.scale(textScale, textScale, 1);
graphics.drawText(font, getMessage(), 0, 0, color | MathHelper.ceil(this.alpha * 255.0F) << 24, true);
pose.pop();
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java
index 82cd4a91..a365b799 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/AuctionViewScreen.java
@@ -70,7 +70,7 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre
infoTextWidget = new TextWidget(Text.literal("Can't Afford"), textRenderer).alignCenter();
verticalLayout.add(infoTextWidget);
- buyButton = ButtonWidget.builder(isBinAuction ? Text.translatable("skyblocker.fancyAuctionHouse.buy") : Text.translatable("skyblocker.fancyAuctionHouse.bid"), button -> {
+ buyButton = ButtonWidget.builder(isBinAuction ? Text.translatable("skyblocker.fancyAuctionHouse.buy") : Text.translatable("skyblocker.fancyAuctionHouse.bid"), button -> {
if (buySlotID == -1) return;
clickSlot(buySlotID);
}).size(60, 15).build();
@@ -78,8 +78,8 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre
verticalLayout.forEachChild(this::addDrawableChild);
updateLayout();
- addDrawableChild(new ButtonWidget.Builder( Text.literal("<"), button -> this.clickSlot(BACK_BUTTON_SLOT))
- .position(x + backgroundWidth - 16, y+4)
+ addDrawableChild(new ButtonWidget.Builder(Text.literal("<"), button -> this.clickSlot(BACK_BUTTON_SLOT))
+ .position(x + backgroundWidth - 16, y + 4)
.size(12, 12)
.build());
@@ -94,10 +94,11 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre
infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.cantAfford").withColor(Colors.RED));
buyButton.active = false;
}
- case TOP_BID -> infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.alreadyTopBid").withColor(Colors.LIGHT_YELLOW));
+ case TOP_BID ->
+ infoTextWidget.setMessage(Text.translatable("skyblocker.fancyAuctionHouse.alreadyTopBid").withColor(Colors.LIGHT_YELLOW));
case AFFORD -> infoTextWidget.setMessage(Text.empty());
case COLLECT_AUCTION -> {
- infoTextWidget.setMessage(changeProfile ? Text.translatable("skyblocker.fancyAuctionHouse.differentProfile"): wonAuction ? Text.empty() : Text.translatable("skyblocker.fancyAuctionHouse.didntWin"));
+ infoTextWidget.setMessage(changeProfile ? Text.translatable("skyblocker.fancyAuctionHouse.differentProfile") : wonAuction ? Text.empty() : Text.translatable("skyblocker.fancyAuctionHouse.didntWin"));
//priceWidget.setMessage(Text.empty());
priceWidget.active = false;
@@ -259,9 +260,9 @@ public class AuctionViewScreen extends AbstractCustomHypixelGUI<AuctionHouseScre
}
text.visit((style, asString) -> {
// The regex removes [, ] and +. To ignore mvp++ rank and orange + in mvp+
- String res = Objects.equals(style.getColor(), TextColor.fromFormatting(Formatting.GOLD)) && !asString.matches(".*[]\\[+].*") && !asString.contains("Collect") ? asString: null;
+ String res = Objects.equals(style.getColor(), TextColor.fromFormatting(Formatting.GOLD)) && !asString.matches(".*[]\\[+].*") && !asString.contains("Collect") ? asString : null;
return Optional.ofNullable(res);
- }, Style.EMPTY).ifPresent(s -> stringAtomicReference.set(stringAtomicReference.get()+s));
+ }, Style.EMPTY).ifPresent(s -> stringAtomicReference.set(stringAtomicReference.get() + s));
}
//System.out.println("Experiment: " + stringAtomicReference.get());
if (priceString == null) priceString = stringAtomicReference.get();
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/EditBidPopup.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/EditBidPopup.java
index 6853d0c4..86d5c44b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/auction/EditBidPopup.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/EditBidPopup.java
@@ -34,7 +34,7 @@ public class EditBidPopup extends BarebonesPopupScreen {
super.init();
layout = DirectionalLayoutWidget.vertical();
layout.spacing(8).getMainPositioner().alignHorizontalCenter();
- textFieldWidget = new TextFieldWidget(textRenderer, 120, 15, Text.empty()){
+ textFieldWidget = new TextFieldWidget(textRenderer, 120, 15, Text.empty()) {
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (!super.keyPressed(keyCode, scanCode, modifiers)) {