Skip to content

Commit

Permalink
Migrate to EnumUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 committed Dec 24, 2024
1 parent 8025b6b commit 16871f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.hysky.skyblocker.skyblock.fancybars;

import de.hysky.skyblocker.utils.EnumUtils;
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
Expand Down Expand Up @@ -211,7 +212,7 @@ public void setCurrent(T current) {

@Override
public void onClick(double mouseX, double mouseY) {
current = values[(current.ordinal() + 1) % values.length];
current = EnumUtils.cycle(current);
if (onChange != null) onChange.accept(current);
super.onClick(mouseX, mouseY);
}
Expand Down Expand Up @@ -334,4 +335,4 @@ protected int getContentsHeightWithPadding() {
protected double getDeltaYPerScroll() {
return 0;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.hysky.skyblocker.skyblock.item;

import com.mojang.serialization.Codec;
import de.hysky.skyblocker.utils.EnumUtils;
import net.minecraft.util.Formatting;
import net.minecraft.util.StringIdentifiable;

Expand Down Expand Up @@ -41,6 +42,6 @@ public String asString() {
}

public SkyblockItemRarity next() {
return values()[(ordinal() + 1) % values().length];
return EnumUtils.cycle(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr;
import de.hysky.skyblocker.skyblock.tabhud.widget.HudWidget;
import de.hysky.skyblocker.skyblock.tabhud.widget.TabHudWidget;
import de.hysky.skyblocker.utils.EnumUtils;
import de.hysky.skyblocker.utils.ItemUtils;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.render.gui.DropdownWidget;
Expand Down Expand Up @@ -307,8 +308,7 @@ void onHudWidgetSelected(@Nullable HudWidget hudWidget) {
widgetOptions.addWidget(ButtonWidget.builder(Text.literal(ye), button -> {
ScreenBuilder builder = ScreenMaster.getScreenBuilder(getCurrentLocation());
PositionRule rule = builder.getPositionRuleOrDefault(hudWidget.getInternalID());
ScreenMaster.ScreenLayer[] values = ScreenMaster.ScreenLayer.values();
ScreenMaster.ScreenLayer newLayer = values[(rule.screenLayer().ordinal() + 1) % values.length];
ScreenMaster.ScreenLayer newLayer = EnumUtils.cycle(rule.screenLayer());

PositionRule newRule = new PositionRule(
rule.parent(),
Expand Down

0 comments on commit 16871f7

Please sign in to comment.