aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/OneConfig.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/Window.java15
-rw-r--r--src/main/java/io/polyfrost/oneconfig/renderer/TextRenderer.java10
-rw-r--r--src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java10
5 files changed, 29 insertions, 10 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/OneConfig.java b/src/main/java/io/polyfrost/oneconfig/OneConfig.java
index a07176e..7596ab5 100644
--- a/src/main/java/io/polyfrost/oneconfig/OneConfig.java
+++ b/src/main/java/io/polyfrost/oneconfig/OneConfig.java
@@ -31,6 +31,6 @@ public class OneConfig {
public void onFMLInitialization(FMLInitializationEvent event) {
ClientCommandHandler.instance.registerCommand(new OneConfigCommand());
MinecraftForge.EVENT_BUS.register(this);
- Themes.openTheme(new File("C:\\Users\\Harry\\Documents\\Coding\\Minecraft\\Forge1.8.9\\OneConfig\\run\\OneConfig\\Themes\\one.zip"));
+ Themes.openTheme(new File("OneConfig/themes/one.zip").getAbsoluteFile());
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java b/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java
index 0b42795..d49cb06 100644
--- a/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java
+++ b/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java
@@ -46,7 +46,7 @@ public class OneConfigCommand implements ICommand {
new TickDelay(() -> mc.displayGuiScreen(new Window()), 1);
if(args.length != 0) {
mc.thePlayer.addChatMessage(new ChatComponentText("reloading theme!"));
- Themes.openTheme(new File("C:\\Users\\Harry\\Documents\\Coding\\Minecraft\\Forge1.8.9\\OneConfig\\run\\OneConfig\\Themes\\one.zip"));
+ Themes.openTheme(new File("OneConfig/themes/one.zip").getAbsoluteFile());
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/Window.java b/src/main/java/io/polyfrost/oneconfig/gui/Window.java
index a0c15cb..173ecee 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/Window.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/Window.java
@@ -3,6 +3,7 @@ package io.polyfrost.oneconfig.gui;
import io.polyfrost.oneconfig.themes.Theme;
import io.polyfrost.oneconfig.themes.ThemeElement;
import io.polyfrost.oneconfig.themes.Themes;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
@@ -15,10 +16,13 @@ public class Window extends GuiScreen {
private float currentProgress = 0f;
public static Window currentWindow;
private final Theme t = Themes.getActiveTheme();
+ private int guiScaleToRestore = -1;
public Window() {
super.initGui();
currentWindow = this;
+ guiScaleToRestore = Minecraft.getMinecraft().gameSettings.guiScale;
+ Minecraft.getMinecraft().gameSettings.guiScale = 1;
}
public boolean doesGuiPauseGame() {
@@ -43,8 +47,8 @@ public class Window extends GuiScreen {
int right = (int) (left + 1200 * currentProgress);
int top = middleY - 350;
int bottom = (int) (top + 700 * currentProgress);
- Gui.drawRect(left -1, top - 1, right + 1, bottom + 1, testingColor.getRGB());
- Gui.drawRect(left,top,right,bottom,t.getBaseColor().getRGB());
+ Gui.drawRect(left - 1, top - 1, right + 1, bottom + 1, testingColor.getRGB());
+ Gui.drawRect(left, top, right, bottom, t.getBaseColor().getRGB());
Gui.drawRect(left, top, right, top + 100, t.getTitleBarColor().getRGB());
Gui.drawRect(left, top + 100, right, top + 101, testingColor.getRGB());
@@ -56,5 +60,10 @@ public class Window extends GuiScreen {
return currentWindow;
}
-
+ @Override
+ public void onGuiClosed() {
+ if (guiScaleToRestore != -1) {
+ Minecraft.getMinecraft().gameSettings.guiScale = guiScaleToRestore;
+ }
+ }
}
diff --git a/src/main/java/io/polyfrost/oneconfig/renderer/TextRenderer.java b/src/main/java/io/polyfrost/oneconfig/renderer/TextRenderer.java
new file mode 100644
index 0000000..0c45d44
--- /dev/null
+++ b/src/main/java/io/polyfrost/oneconfig/renderer/TextRenderer.java
@@ -0,0 +1,10 @@
+package io.polyfrost.oneconfig.renderer;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.util.ResourceLocation;
+
+public class TextRenderer {
+ public static FontRenderer fontRenderer = new FontRenderer(Minecraft.getMinecraft().gameSettings, new ResourceLocation("oneconfig:font/ascii"),
+ Minecraft.getMinecraft().getTextureManager(), false);
+}
diff --git a/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java b/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
index 749dea6..fd636f2 100644
--- a/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
+++ b/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
@@ -1,6 +1,5 @@
package io.polyfrost.oneconfig.themes;
-import javafx.util.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
@@ -10,6 +9,7 @@ import net.minecraft.util.ResourceLocation;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import static io.polyfrost.oneconfig.themes.Themes.themeLog;
@@ -18,7 +18,7 @@ public class TextureManager {
private static final Minecraft mc = Minecraft.getMinecraft();
private final List<ResourceLocation> resources = new ArrayList<>();
private final List<ThemeElement> tickableTextureLocations = new ArrayList<>();
- private final List<Pair<Integer, Integer>> tickableTextures = new ArrayList<>();
+ private final HashMap<Integer, Integer> tickableTextures = new HashMap<>();
private int tick = 0;
/**
@@ -42,7 +42,7 @@ public class TextureManager {
if(img.getWidth() != img.getHeight()) {
themeLog.info("found tickable animated texture (" + element.name() + "). Loading texture");
tickableTextureLocations.add(element);
- tickableTextures.add(new Pair<>(img.getWidth(), img.getHeight()));
+ tickableTextures.put(img.getWidth(), img.getHeight());
}
}
}
@@ -62,8 +62,8 @@ public class TextureManager {
mc.getTextureManager().bindTexture(location);
try {
if(tickableTextureLocations.contains(element)) {
- int texWidth = tickableTextures.get(0).getKey(); // TODO unsure if this works safe
- int texHeight = tickableTextures.get(0).getValue();
+ int texWidth = tickableTextures.keySet().stream().findFirst().get(); // TODO unsure if this works safe
+ int texHeight = tickableTextures.values().stream().findFirst().get();
int frames = texHeight / texWidth;
while(tick < frames) {
Gui.drawModalRectWithCustomSizedTexture(x, y, 0, (tick * texWidth), texWidth, texWidth, texWidth, texWidth);