aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/utils/render/title
diff options
context:
space:
mode:
authorAaron <51387595+AzureAaron@users.noreply.github.com>2023-09-26 12:58:40 -0400
committerAaron <51387595+AzureAaron@users.noreply.github.com>2023-09-26 12:58:40 -0400
commit84aedfe464bc648cbb18b4f2a7eaeb695091b2b5 (patch)
tree6e6bf0121e445e64e7185c7a691b4fa798f110ef /src/main/java/me/xmrvizzy/skyblocker/utils/render/title
parent04f97400a0216d7fdd1154b8c8fa64ac65df63cb (diff)
downloadSkyblocker-84aedfe464bc648cbb18b4f2a7eaeb695091b2b5.tar.gz
Skyblocker-84aedfe464bc648cbb18b4f2a7eaeb695091b2b5.tar.bz2
Skyblocker-84aedfe464bc648cbb18b4f2a7eaeb695091b2b5.zip
Rename Config Files
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/utils/render/title')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainer.java30
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainerConfigScreen.java60
2 files changed, 45 insertions, 45 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainer.java b/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainer.java
index 5044b814..a55965dc 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainer.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainer.java
@@ -1,7 +1,7 @@
package me.xmrvizzy.skyblocker.utils.render.title;
-import me.xmrvizzy.skyblocker.config.ConfigModel;
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
+import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager;
import me.xmrvizzy.skyblocker.utils.scheduler.Scheduler;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
@@ -82,7 +82,7 @@ public class TitleContainer {
}
private static void render(DrawContext context, float tickDelta) {
- render(context, titles, SkyblockerConfig.get().general.titleContainer.x, SkyblockerConfig.get().general.titleContainer.y, tickDelta);
+ render(context, titles, SkyblockerConfigManager.get().general.titleContainer.x, SkyblockerConfigManager.get().general.titleContainer.y, tickDelta);
}
protected static void render(DrawContext context, Set<Title> titles, int xPos, int yPos, float tickDelta) {
@@ -90,11 +90,11 @@ public class TitleContainer {
TextRenderer textRenderer = client.textRenderer;
// Calculate Scale to use
- float scale = 3F * (SkyblockerConfig.get().general.titleContainer.titleContainerScale / 100F);
+ float scale = 3F * (SkyblockerConfigManager.get().general.titleContainer.titleContainerScale / 100F);
// Grab direction and alignment values
- ConfigModel.Direction direction = SkyblockerConfig.get().general.titleContainer.direction;
- ConfigModel.Alignment alignment = SkyblockerConfig.get().general.titleContainer.alignment;
+ SkyblockerConfig.Direction direction = SkyblockerConfigManager.get().general.titleContainer.direction;
+ SkyblockerConfig.Alignment alignment = SkyblockerConfigManager.get().general.titleContainer.alignment;
// x/y refer to the starting position for the text
// y always starts at yPos
float x = 0;
@@ -106,8 +106,8 @@ public class TitleContainer {
width += textRenderer.getWidth(title.getText()) * scale + 10;
}
- if (alignment == ConfigModel.Alignment.MIDDLE) {
- if (direction == ConfigModel.Direction.HORIZONTAL) {
+ if (alignment == SkyblockerConfig.Alignment.MIDDLE) {
+ if (direction == SkyblockerConfig.Direction.HORIZONTAL) {
//If middle aligned horizontally, start the xPosition at half of the width to the left.
x = xPos - (width / 2);
} else {
@@ -115,7 +115,7 @@ public class TitleContainer {
x = xPos;
}
}
- if (alignment == ConfigModel.Alignment.LEFT || alignment == ConfigModel.Alignment.RIGHT) {
+ if (alignment == SkyblockerConfig.Alignment.LEFT || alignment == SkyblockerConfig.Alignment.RIGHT) {
//If left or right aligned, start at xPos, we will shift each text later
x = xPos;
}
@@ -124,14 +124,14 @@ public class TitleContainer {
//Calculate which x the text should use
float xToUse;
- if (direction == ConfigModel.Direction.HORIZONTAL) {
- xToUse = alignment == ConfigModel.Alignment.RIGHT ?
+ if (direction == SkyblockerConfig.Direction.HORIZONTAL) {
+ xToUse = alignment == SkyblockerConfig.Alignment.RIGHT ?
x - (textRenderer.getWidth(title.getText()) * scale) : //if right aligned we need the text position to be aligned on the right side.
x;
} else {
- xToUse = alignment == ConfigModel.Alignment.MIDDLE ?
+ xToUse = alignment == SkyblockerConfig.Alignment.MIDDLE ?
x - (textRenderer.getWidth(title.getText()) * scale) / 2 : //if middle aligned we need the text position to be aligned in the middle.
- alignment == ConfigModel.Alignment.RIGHT ?
+ alignment == SkyblockerConfig.Alignment.RIGHT ?
x - (textRenderer.getWidth(title.getText()) * scale) : //if right aligned we need the text position to be aligned on the right side.
x;
}
@@ -156,13 +156,13 @@ public class TitleContainer {
context.getMatrices().pop();
//Calculate the x and y positions for the next title
- if (direction == ConfigModel.Direction.HORIZONTAL) {
- if (alignment == ConfigModel.Alignment.MIDDLE || alignment == ConfigModel.Alignment.LEFT) {
+ if (direction == SkyblockerConfig.Direction.HORIZONTAL) {
+ if (alignment == SkyblockerConfig.Alignment.MIDDLE || alignment == SkyblockerConfig.Alignment.LEFT) {
//Move to the right if middle or left aligned
x += textRenderer.getWidth(title.getText()) * scale + 10;
}
- if (alignment == ConfigModel.Alignment.RIGHT) {
+ if (alignment == SkyblockerConfig.Alignment.RIGHT) {
//Move to the left if right aligned
x -= textRenderer.getWidth(title.getText()) * scale + 10;
}
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainerConfigScreen.java b/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainerConfigScreen.java
index d8e3b43c..caf9fbf0 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainerConfigScreen.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/utils/render/title/TitleContainerConfigScreen.java
@@ -1,7 +1,7 @@
package me.xmrvizzy.skyblocker.utils.render.title;
-import me.xmrvizzy.skyblocker.config.ConfigModel;
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
+import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager;
import me.xmrvizzy.skyblocker.utils.render.RenderHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
@@ -18,8 +18,8 @@ public class TitleContainerConfigScreen extends Screen {
private final Title example1 = new Title(Text.literal("Test1").formatted(Formatting.RED));
private final Title example2 = new Title(Text.literal("Test23").formatted(Formatting.AQUA));
private final Title example3 = new Title(Text.literal("Testing1234").formatted(Formatting.DARK_GREEN));
- private float hudX = SkyblockerConfig.get().general.titleContainer.x;
- private float hudY = SkyblockerConfig.get().general.titleContainer.y;
+ private float hudX = SkyblockerConfigManager.get().general.titleContainer.x;
+ private float hudY = SkyblockerConfigManager.get().general.titleContainer.y;
private final Screen parent;
protected TitleContainerConfigScreen() {
@@ -36,8 +36,8 @@ public class TitleContainerConfigScreen extends Screen {
super.render(context, mouseX, mouseY, delta);
renderBackground(context, mouseX, mouseY, delta);
TitleContainer.render(context, Set.of(example1, example2, example3), (int) hudX, (int) hudY, delta);
- ConfigModel.Direction direction = SkyblockerConfig.get().general.titleContainer.direction;
- ConfigModel.Alignment alignment = SkyblockerConfig.get().general.titleContainer.alignment;
+ SkyblockerConfig.Direction direction = SkyblockerConfigManager.get().general.titleContainer.direction;
+ SkyblockerConfig.Alignment alignment = SkyblockerConfigManager.get().general.titleContainer.alignment;
context.drawCenteredTextWithShadow(textRenderer, "Press Q/E to change Alignment: " + alignment, width / 2, textRenderer.fontHeight * 2, Color.WHITE.getRGB());
context.drawCenteredTextWithShadow(textRenderer, "Press R to change Direction: " + direction, width / 2, textRenderer.fontHeight * 3 + 5, Color.WHITE.getRGB());
context.drawCenteredTextWithShadow(textRenderer, "Press +/- to change Scale", width / 2, textRenderer.fontHeight * 4 + 10, Color.WHITE.getRGB());
@@ -56,7 +56,7 @@ public class TitleContainerConfigScreen extends Screen {
}
private Pair<Vector2f, Vector2f> getSelectionBoundingBox() {
- ConfigModel.Alignment alignment = SkyblockerConfig.get().general.titleContainer.alignment;
+ SkyblockerConfig.Alignment alignment = SkyblockerConfigManager.get().general.titleContainer.alignment;
float midWidth = getSelectionWidth() / 2F;
float x1 = 0;
@@ -81,15 +81,15 @@ public class TitleContainerConfigScreen extends Screen {
}
private float getSelectionHeight() {
- float scale = (3F * (SkyblockerConfig.get().general.titleContainer.titleContainerScale / 100F));
- return SkyblockerConfig.get().general.titleContainer.direction == ConfigModel.Direction.HORIZONTAL ?
+ float scale = (3F * (SkyblockerConfigManager.get().general.titleContainer.titleContainerScale / 100F));
+ return SkyblockerConfigManager.get().general.titleContainer.direction == SkyblockerConfig.Direction.HORIZONTAL ?
(textRenderer.fontHeight * scale) :
(textRenderer.fontHeight + 10F) * 3F * scale;
}
private float getSelectionWidth() {
- float scale = (3F * (SkyblockerConfig.get().general.titleContainer.titleContainerScale / 100F));
- return SkyblockerConfig.get().general.titleContainer.direction == ConfigModel.Direction.HORIZONTAL ?
+ float scale = (3F * (SkyblockerConfigManager.get().general.titleContainer.titleContainerScale / 100F));
+ return SkyblockerConfigManager.get().general.titleContainer.direction == SkyblockerConfig.Direction.HORIZONTAL ?
(textRenderer.getWidth("Test1") + 10 + textRenderer.getWidth("Test23") + 10 + textRenderer.getWidth("Testing1234")) * scale :
textRenderer.getWidth("Testing1234") * scale;
}
@@ -98,7 +98,7 @@ public class TitleContainerConfigScreen extends Screen {
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
float midWidth = getSelectionWidth() / 2;
float midHeight = getSelectionHeight() / 2;
- var alignment = SkyblockerConfig.get().general.titleContainer.alignment;
+ var alignment = SkyblockerConfigManager.get().general.titleContainer.alignment;
Pair<Vector2f, Vector2f> boundingBox = getSelectionBoundingBox();
float x1 = boundingBox.getLeft().getX();
@@ -129,42 +129,42 @@ public class TitleContainerConfigScreen extends Screen {
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_Q) {
- ConfigModel.Alignment current = SkyblockerConfig.get().general.titleContainer.alignment;
- SkyblockerConfig.get().general.titleContainer.alignment = switch (current) {
- case LEFT -> ConfigModel.Alignment.MIDDLE;
- case MIDDLE -> ConfigModel.Alignment.RIGHT;
- case RIGHT -> ConfigModel.Alignment.LEFT;
+ SkyblockerConfig.Alignment current = SkyblockerConfigManager.get().general.titleContainer.alignment;
+ SkyblockerConfigManager.get().general.titleContainer.alignment = switch (current) {
+ case LEFT -> SkyblockerConfig.Alignment.MIDDLE;
+ case MIDDLE -> SkyblockerConfig.Alignment.RIGHT;
+ case RIGHT -> SkyblockerConfig.Alignment.LEFT;
};
}
if (keyCode == GLFW.GLFW_KEY_E) {
- ConfigModel.Alignment current = SkyblockerConfig.get().general.titleContainer.alignment;
- SkyblockerConfig.get().general.titleContainer.alignment = switch (current) {
- case LEFT -> ConfigModel.Alignment.RIGHT;
- case MIDDLE -> ConfigModel.Alignment.LEFT;
- case RIGHT -> ConfigModel.Alignment.MIDDLE;
+ SkyblockerConfig.Alignment current = SkyblockerConfigManager.get().general.titleContainer.alignment;
+ SkyblockerConfigManager.get().general.titleContainer.alignment = switch (current) {
+ case LEFT -> SkyblockerConfig.Alignment.RIGHT;
+ case MIDDLE -> SkyblockerConfig.Alignment.LEFT;
+ case RIGHT -> SkyblockerConfig.Alignment.MIDDLE;
};
}
if (keyCode == GLFW.GLFW_KEY_R) {
- ConfigModel.Direction current = SkyblockerConfig.get().general.titleContainer.direction;
- SkyblockerConfig.get().general.titleContainer.direction = switch (current) {
- case HORIZONTAL -> ConfigModel.Direction.VERTICAL;
- case VERTICAL -> ConfigModel.Direction.HORIZONTAL;
+ SkyblockerConfig.Direction current = SkyblockerConfigManager.get().general.titleContainer.direction;
+ SkyblockerConfigManager.get().general.titleContainer.direction = switch (current) {
+ case HORIZONTAL -> SkyblockerConfig.Direction.VERTICAL;
+ case VERTICAL -> SkyblockerConfig.Direction.HORIZONTAL;
};
}
if (keyCode == GLFW.GLFW_KEY_EQUAL) {
- SkyblockerConfig.get().general.titleContainer.titleContainerScale += 10;
+ SkyblockerConfigManager.get().general.titleContainer.titleContainerScale += 10;
}
if (keyCode == GLFW.GLFW_KEY_MINUS) {
- SkyblockerConfig.get().general.titleContainer.titleContainerScale -= 10;
+ SkyblockerConfigManager.get().general.titleContainer.titleContainerScale -= 10;
}
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public void close() {
- SkyblockerConfig.get().general.titleContainer.x = (int) hudX;
- SkyblockerConfig.get().general.titleContainer.y = (int) hudY;
- SkyblockerConfig.save();
+ SkyblockerConfigManager.get().general.titleContainer.x = (int) hudX;
+ SkyblockerConfigManager.get().general.titleContainer.y = (int) hudY;
+ SkyblockerConfigManager.save();
this.client.setScreen(parent);
}
}