-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #708 from BigloBot/main
Profile Viewer
- Loading branch information
Showing
59 changed files
with
2,539 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerNavButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package de.hysky.skyblocker.skyblock.profileviewer; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
import de.hysky.skyblocker.skyblock.profileviewer.utils.SkullCreator; | ||
import de.hysky.skyblocker.skyblock.tabhud.util.Ico; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; | ||
import net.minecraft.client.gui.widget.ClickableWidget; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.Map; | ||
|
||
public class ProfileViewerNavButton extends ClickableWidget { | ||
private final static Identifier BUTTON_TEXTURES_TOGGLED = Identifier.of("container/creative_inventory/tab_top_selected_2"); | ||
private final static Identifier BUTTON_TEXTURES = Identifier.of("container/creative_inventory/tab_top_unselected_2"); | ||
private boolean toggled; | ||
private final int index; | ||
private final ProfileViewerScreen screen; | ||
private final ItemStack icon; | ||
|
||
private static final Map<String, ItemStack> HEAD_ICON = Map.ofEntries( | ||
Map.entry("Skills", Ico.IRON_SWORD), | ||
Map.entry("Slayers", SkullCreator.createSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzkzMzZkN2NjOTVjYmY2Njg5ZjVlOGM5NTQyOTRlYzhkMWVmYzQ5NGE0MDMxMzI1YmI0MjdiYzgxZDU2YTQ4NGQifX19")), | ||
Map.entry("Pets", Ico.BONE), | ||
Map.entry("Dungeons", SkullCreator.createSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzliNTY4OTViOTY1OTg5NmFkNjQ3ZjU4NTk5MjM4YWY1MzJkNDZkYjljMWIwMzg5YjhiYmViNzA5OTlkYWIzM2QifX19")), | ||
Map.entry("Inventories", Ico.E_CHEST), | ||
Map.entry("Collections", Ico.PAINTING) | ||
); | ||
|
||
public ProfileViewerNavButton(ProfileViewerScreen screen, String tabName, int index, boolean toggled) { | ||
super(-100, -100, 28, 32, Text.empty()); | ||
this.screen = screen; | ||
this.toggled = toggled; | ||
this.index = index; | ||
this.icon = HEAD_ICON.getOrDefault(tabName, Ico.BARRIER); | ||
} | ||
|
||
@Override | ||
protected void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) { | ||
RenderSystem.disableDepthTest(); | ||
|
||
context.drawGuiTexture(toggled ? BUTTON_TEXTURES_TOGGLED : BUTTON_TEXTURES, this.getX(), this.getY(), this.width, this.height - ((this.toggled) ? 0 : 4)); | ||
context.drawItem(this.icon, this.getX() + 6, this.getY() + (this.toggled ? 7 : 9)); | ||
|
||
RenderSystem.enableDepthTest(); | ||
} | ||
|
||
@Override | ||
public void onClick(double mouseX, double mouseY) { | ||
screen.onNavButtonClick(this); | ||
} | ||
|
||
@Override | ||
protected void appendClickableNarrations(NarrationMessageBuilder builder) {} | ||
|
||
public void setToggled(boolean toggled) { | ||
this.toggled = toggled; | ||
} | ||
|
||
public int getIndex() { | ||
return index; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package de.hysky.skyblocker.skyblock.profileviewer; | ||
|
||
import de.hysky.skyblocker.skyblock.profileviewer.utils.SubPageSelectButton; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.widget.ClickableWidget; | ||
|
||
import java.util.List; | ||
|
||
public interface ProfileViewerPage { | ||
void render(DrawContext context, int mouseX, int mouseY, float delta, int rootX, int rootY); | ||
default List<ClickableWidget> getButtons() { | ||
return null; | ||
} | ||
default void onNavButtonClick(SubPageSelectButton selectButton) {} | ||
default void markWidgetsAsVisible() {} | ||
default void markWidgetsAsInvisible() {} | ||
default void nextPage() {} | ||
default void previousPage() {} | ||
} |
Oops, something went wrong.