Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #327

Merged
merged 9 commits into from
Nov 7, 2024
Prev Previous commit
Next Next commit
More icon updates, and fix gui fixes
  • Loading branch information
UnRealDinnerbone committed Oct 14, 2024
commit 0b06e7cafacc6d9cec6c13bdb5db1559e4d23363
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
import dev.ftb.mods.ftblibrary.icon.ImageIcon;
import dev.ftb.mods.ftblibrary.math.MathUtils;
import dev.ftb.mods.ftblibrary.math.XZ;
import dev.ftb.mods.ftblibrary.ui.*;
import dev.ftb.mods.ftblibrary.ui.Button;
import dev.ftb.mods.ftblibrary.ui.GuiHelper;
import dev.ftb.mods.ftblibrary.ui.Panel;
import dev.ftb.mods.ftblibrary.ui.ScreenWrapper;
import dev.ftb.mods.ftblibrary.ui.Theme;
import dev.ftb.mods.ftblibrary.ui.input.Key;
import dev.ftb.mods.ftblibrary.ui.input.MouseButton;
import dev.ftb.mods.ftblibrary.util.TimeUtils;
Expand All @@ -38,7 +42,15 @@
import net.minecraft.world.level.ChunkPos;
import org.lwjgl.glfw.GLFW;

import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;

import static dev.ftb.mods.ftbchunks.net.RequestChunkChangePacket.ChunkChangeOp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import dev.ftb.mods.ftblibrary.ui.SimpleButton;
import dev.ftb.mods.ftblibrary.ui.TextField;
import dev.ftb.mods.ftblibrary.ui.Theme;
import dev.ftb.mods.ftblibrary.ui.ToggleableButton;
import dev.ftb.mods.ftblibrary.ui.misc.AbstractThreePanelScreen;
import dev.ftb.mods.ftblibrary.util.TooltipList;
import dev.ftb.mods.ftblibrary.util.client.ClientTextComponentUtils;
Expand Down Expand Up @@ -122,7 +123,7 @@ public class InfoEntry extends Panel {

public InfoEntry(MinimapInfoComponent infoComponent, Panel panel) {
super(panel);
hideButton = ToggleVisibilityButton.create(this, !isComponentDisabled(infoComponent), (enabled) -> setComponentEnabled(infoComponent, enabled));
hideButton = new ToggleableButton(this, !isComponentDisabled(infoComponent), Icons.VISIBILITY_SHOW, Icons.VISIBILITY_HIDE, (widget, newState) -> setComponentEnabled(infoComponent, newState));
down = new SortScreenButton(InfoEntry.this, Component.translatable("ftbchunks.gui.move_up"), Icons.UP, (widget, button) -> move(false, isShiftKeyDown()));
up = new SortScreenButton(InfoEntry.this, Component.translatable("ftbchunks.gui.move_down"), Icons.DOWN, (widget, button) -> move(true, isShiftKeyDown()));
configButton = new SimpleButton(InfoEntry.this, Component.translatable("gui.settings"), Icons.SETTINGS, (widget, button) -> {
Expand Down Expand Up @@ -169,7 +170,7 @@ public void addWidgets() {
public void alignWidgets() {
down.setPosAndSize(6, height / 6 + 1, 6, 8);
up.setPosAndSize(6, height / 6 + 11, 6, 8);
hideButton.setPosAndSize(width - 18, height / 6, 12, 12);
hideButton.setPosAndSize(width - 18, height / 6 + 2, 12, 12);
field.setPosAndSize(16, 8, width - 37, height);
field.setPosAndSize(16, 8, width - 37, height);
if(!infoComponent.getConfigComponents().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void draw(MapType mapType, GuiGraphics graphics, int x, int y, int w, int
Player player = Minecraft.getInstance().player;
graphics.pose().pushPose();
graphics.pose().translate(x + w / 2f, y + h / 2f, 0F);
graphics.pose().scale(2f, 2f, 2f);
float scale = mapType == MapType.LARGE_MAP ? 2.5F : 2F;
graphics.pose().scale(scale, scale, scale);
graphics.pose().mulPose(Axis.ZP.rotationDegrees(player.getYRot() + 180F));
POINTER.draw(graphics, - w / 2, -h / 2, w, h);
graphics.pose().popPose();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import dev.ftb.mods.ftblibrary.ui.SimpleButton;
import dev.ftb.mods.ftblibrary.ui.TextField;
import dev.ftb.mods.ftblibrary.ui.Theme;
import dev.ftb.mods.ftblibrary.ui.ToggleableButton;
import dev.ftb.mods.ftblibrary.ui.input.Key;
import dev.ftb.mods.ftblibrary.ui.input.MouseButton;
import dev.ftb.mods.ftblibrary.ui.misc.AbstractButtonListScreen;
Expand Down Expand Up @@ -88,7 +89,7 @@ private void computeWaypointTextWidth() {

private void toggleAll(boolean collapsed) {
boolean allOpen = this.collapsed.values().stream().noneMatch(b -> b);
//Don't try and re-render if everything is already open
// Don't try and re-render if everything is already open
if (allOpen && !collapsed) {
return;
}
Expand Down Expand Up @@ -246,7 +247,7 @@ public RowPanel(Panel panel, WaypointImpl wp) {

@Override
public void addWidgets() {
add(hideButton = ToggleVisibilityButton.create(this, !wp.isHidden(), hidden -> wp.setHidden(!hidden)));
add(hideButton = new ToggleableButton(this, !wp.isHidden(), (widget, newState) -> wp.setHidden(!newState)));

add(nameField = new TextField(this).setTrim().setColor(Color4I.rgb(wp.getColor())).addFlags(Theme.SHADOW));

Expand Down Expand Up @@ -280,8 +281,8 @@ public void setWidth(int newWidth) {

int yOff = (this.height - getTheme().getFontHeight()) / 2 + 1;

hideButton.setPosAndSize(farRight - 8 - 16, 1, 12, 12);
deleteButton.setPosAndSize(farRight - 8, 1, 12, 12);
hideButton.setPosAndSize(farRight - 8 - 16, 3, 12, 12);
deleteButton.setPosAndSize(farRight - 8, 3, 12, 12);

distField.setPos(hideButton.getPosX() - 5 - distField.width, yOff);

Expand Down