diff options
Diffstat (limited to 'src/main/java')
22 files changed, 278 insertions, 0 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/OneConfig.java b/src/main/java/io/polyfrost/oneconfig/OneConfig.java new file mode 100644 index 0000000..4b916d9 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/OneConfig.java @@ -0,0 +1,17 @@ +package io.polyfrost.oneconfig; + +import io.polyfrost.oneconfig.command.OneConfigCommand; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; + +@Mod(modid = "oneconfig", name = "OneConfig", version = "${version}") +public class OneConfig { + + @Mod.EventHandler + public void onFMLInitialization(FMLInitializationEvent event) { + ClientCommandHandler.instance.registerCommand(new OneConfigCommand()); + MinecraftForge.EVENT_BUS.register(this); + } +} diff --git a/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java b/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java new file mode 100644 index 0000000..3433c56 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/command/OneConfigCommand.java @@ -0,0 +1,65 @@ +package io.polyfrost.oneconfig.command; + +import io.polyfrost.oneconfig.gui.Window; +import io.polyfrost.oneconfig.utils.TickDelay; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class OneConfigCommand implements ICommand { + + private final List<String> aliases; + private static final Minecraft mc = Minecraft.getMinecraft(); + + public OneConfigCommand() { + aliases = new ArrayList<>(); + aliases.add("oneconfig"); + aliases.add("ocfg"); + } + + @Override + public String getCommandName() { + return "oneconfig"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "oneconfig <>"; + } + + @Override + public List<String> getCommandAliases() { + return this.aliases; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + new TickDelay(() -> mc.displayGuiScreen(new Window()), 1); + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + return null; + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + @Override + public int compareTo(@NotNull ICommand o) { + return 0; + } +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/Window.java b/src/main/java/io/polyfrost/oneconfig/gui/Window.java new file mode 100644 index 0000000..ed420aa --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/Window.java @@ -0,0 +1,46 @@ +package io.polyfrost.oneconfig.gui; + +import io.polyfrost.oneconfig.renderer.Renderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; + +import java.awt.*; + +import static io.polyfrost.oneconfig.renderer.Renderer.easeOut; + +public class Window extends GuiScreen { + private static ResourceLocation location = new ResourceLocation("oneconfig", "textures/hudsettings128.png"); + private float currentProgress = 0f; + public static Window currentWindow; + + public Window() { + super.initGui(); + currentWindow = this; + } + + public boolean doesGuiPauseGame() { + return false; + } + + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + currentProgress = easeOut(currentProgress, 1f); + int alphaVal = (int) (50 * currentProgress); + //drawGradientRect(0, 0, super.width, super.height, new Color(80, 80, 80, alphaVal).getRGB(), new Color(80, 80, 80, alphaVal + 10).getRGB()); + drawWindow(); + + } + + public void drawWindow() { + Renderer.drawScaledImage(location, 10, 10, 64 ,64); + Renderer.drawRoundRectangle(50,50,100,100,10,-1); + } + + public static Window getWindow() { + return currentWindow; + } + + +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java new file mode 100644 index 0000000..774d936 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements; + +public class OCBlock { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCButton.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCButton.java new file mode 100644 index 0000000..4df6f93 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCButton.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements; + +public class OCButton { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCColorPicker.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCColorPicker.java new file mode 100644 index 0000000..e055d25 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCColorPicker.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements; + +public class OCColorPicker { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCSelector.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCSelector.java new file mode 100644 index 0000000..83805fa --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCSelector.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements; + +public class OCSelector { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCTextField.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCTextField.java new file mode 100644 index 0000000..da0df96 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCTextField.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements; + +public class OCTextField { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java new file mode 100644 index 0000000..de21d9d --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements.config; + +public class OConfigButton { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java new file mode 100644 index 0000000..299c4f2 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements.config; + +public class OConfigColor { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java new file mode 100644 index 0000000..cc76814 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements.config; + +public class OConfigSelector { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java new file mode 100644 index 0000000..38bacf7 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements.config; + +public class OConfigSlider { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java new file mode 100644 index 0000000..c9d6091 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements.config; + +public class OConfigSwitch { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java new file mode 100644 index 0000000..68f2b8b --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.elements.config; + +public class OConfigText { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/BasicWindowPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/BasicWindowPage.java new file mode 100644 index 0000000..0d09526 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/BasicWindowPage.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.pages; + +public class BasicWindowPage { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java new file mode 100644 index 0000000..65ad1e9 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.pages; + +public class HomePage { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java new file mode 100644 index 0000000..4cbda94 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.pages; + +public class ModsPage { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/SettingsPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/SettingsPage.java new file mode 100644 index 0000000..9fecc75 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/SettingsPage.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.pages; + +public class SettingsPage { +} diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/StorePage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/StorePage.java new file mode 100644 index 0000000..4aa1616 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/StorePage.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.gui.pages; + +public class StorePage { +} diff --git a/src/main/java/io/polyfrost/oneconfig/renderer/Renderer.java b/src/main/java/io/polyfrost/oneconfig/renderer/Renderer.java new file mode 100644 index 0000000..05e2731 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/renderer/Renderer.java @@ -0,0 +1,39 @@ +package io.polyfrost.oneconfig.renderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class Renderer extends Gui { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final FontRenderer fr = mc.fontRendererObj; + + public static void drawRectangle(int left, int top, int right, int bottom, int color) { + Gui.drawRect(left, top, right, bottom, color); + } + + public static void drawString(String text, int x, int y, int color, boolean shadow) { + fr.drawString(text, x, y, color, shadow); + } + + public static void drawScaledImage(ResourceLocation location, int x, int y, int targetX, int targetY) { + //GlStateManager.color(1f, 1f, 1f, 1f); + mc.getTextureManager().bindTexture(location); + Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, targetX, targetY, targetX, targetY, targetX, targetY); + } + + public static void drawRoundRectangle(int left, int top, int right, int bottom, int cornerRadius, int color) { + + } + + + public static float easeOut(float current, float goal) { + if (Math.floor(Math.abs(goal - current) / (float) 0.01) > 0) { + return current + (goal - current) / (float) 20.0; + } else { + return goal; + } + } + +} diff --git a/src/main/java/io/polyfrost/oneconfig/themes/Themes.java b/src/main/java/io/polyfrost/oneconfig/themes/Themes.java new file mode 100644 index 0000000..7ba8097 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/themes/Themes.java @@ -0,0 +1,4 @@ +package io.polyfrost.oneconfig.themes; + +public class Themes { +} diff --git a/src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java b/src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java new file mode 100644 index 0000000..33b02fe --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java @@ -0,0 +1,43 @@ +package io.polyfrost.oneconfig.utils; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class TickDelay { + Integer delay; + Runnable function; + + public TickDelay(Runnable functionName, int ticks) { + register(); + delay = ticks; + function = functionName; + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.START) { + // Delay expired + if (delay < 1) { + run(); + destroy(); + } + delay--; + } + } + + @EventHandler() + private void destroy() { + MinecraftForge.EVENT_BUS.unregister(this); + } + + @EventHandler() + private void register() { + MinecraftForge.EVENT_BUS.register(this); + } + + private void run() { + function.run(); + } +} |