fixed new gui not saving settings and partially added Tab Settings
This commit is contained in:
parent
531b433426
commit
eb94cb02e0
60716
javascript/classes.js
60716
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:title" content="Resent 1.8" />
|
<meta property="og:title" content="Resent 1.8" />
|
||||||
<meta property="og:description" content="Resent 1.8" />
|
<meta property="og:description" content="Resent 1.8" />
|
||||||
<link type="image/png" rel="shortcut icon" href="favicon.png" />
|
<link type="image/png" rel="shortcut icon" href="favicon.png" id="favicon"/>
|
||||||
<script type="text/javascript" src="classes.js"></script>
|
<script type="text/javascript" src="classes.js"></script>
|
||||||
<script type="text/javascript" src="fix-webm-duration.js"></script>
|
<script type="text/javascript" src="fix-webm-duration.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
@ -108,6 +108,10 @@
|
||||||
let hasSiteInteractionHappened = false;
|
let hasSiteInteractionHappened = false;
|
||||||
let tooLate = false;
|
let tooLate = false;
|
||||||
|
|
||||||
|
if (localStorage.getItem("isTabSettingsModEnabled")){
|
||||||
|
document.title = localStorage.getItem("tabTitle");
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("click", () =>{
|
document.addEventListener("click", () =>{
|
||||||
hasSiteInteractionHappened = true;
|
hasSiteInteractionHappened = true;
|
||||||
});
|
});
|
||||||
|
@ -215,6 +219,39 @@
|
||||||
return hasSiteInteractionHappened;
|
return hasSiteInteractionHappened;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFavicon(){
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.onload = function (e) {
|
||||||
|
document.getElementById("favicon").href = getBase64Image(e.target.result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBase64Image(img) {
|
||||||
|
var canvas = document.createElement("canvas");
|
||||||
|
canvas.width = img.width;
|
||||||
|
canvas.height = img.height;
|
||||||
|
|
||||||
|
var ctx = canvas.getContext("2d");
|
||||||
|
ctx.drawImage(img, 0, 0);
|
||||||
|
|
||||||
|
var dataURL = canvas.toDataURL("image/png");
|
||||||
|
|
||||||
|
return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTitle(){
|
||||||
|
let title = prompt("Type Tab Title here:");
|
||||||
|
localStorage.setItem("tabTitle", title);
|
||||||
|
document.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleTabSettingsMod(isEnabled){
|
||||||
|
localStorage.setItem("isTabSettingsModEnabled", isEnabled);
|
||||||
|
if (!isEnabled){
|
||||||
|
document.title = "Resent Client";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
|
@ -477,4 +477,13 @@ public class PlatformRuntime {
|
||||||
public static void removeLoadScreen() {
|
public static void removeLoadScreen() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
public static void changeFavicon() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
public static void changeTitle() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
public static void toggleTabTitleMod(boolean isEnabled) {
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import dev.resent.module.impl.misc.HUD;
|
||||||
import dev.resent.module.impl.misc.ParticleMultiplier;
|
import dev.resent.module.impl.misc.ParticleMultiplier;
|
||||||
import dev.resent.module.impl.misc.Scoreboard;
|
import dev.resent.module.impl.misc.Scoreboard;
|
||||||
import dev.resent.module.impl.misc.Sprint;
|
import dev.resent.module.impl.misc.Sprint;
|
||||||
|
import dev.resent.module.impl.misc.TabSettings;
|
||||||
import dev.resent.module.impl.setting.Animations;
|
import dev.resent.module.impl.setting.Animations;
|
||||||
import dev.resent.module.impl.setting.Hand;
|
import dev.resent.module.impl.setting.Hand;
|
||||||
import dev.resent.module.impl.setting.MinimalViewBobbing;
|
import dev.resent.module.impl.setting.MinimalViewBobbing;
|
||||||
|
@ -81,6 +82,7 @@ public class ModManager {
|
||||||
public static AdminSpawner adminSpawner = new AdminSpawner();
|
public static AdminSpawner adminSpawner = new AdminSpawner();
|
||||||
public static ParticleMultiplier particleMultiplier = new ParticleMultiplier();
|
public static ParticleMultiplier particleMultiplier = new ParticleMultiplier();
|
||||||
public static Hand hand;
|
public static Hand hand;
|
||||||
|
private static TabSettings tabSettings;
|
||||||
|
|
||||||
//public static Crosshair crosshair = new Crosshair();
|
//public static Crosshair crosshair = new Crosshair();
|
||||||
|
|
||||||
|
@ -125,6 +127,7 @@ public class ModManager {
|
||||||
register(scoreboard);
|
register(scoreboard);
|
||||||
register(clearChat);
|
register(clearChat);
|
||||||
register(animations);
|
register(animations);
|
||||||
|
register(tabSettings = new TabSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Mod> modsInCategory(Category c) {
|
public ArrayList<Mod> modsInCategory(Category c) {
|
||||||
|
|
37
src/main/java/dev/resent/module/impl/misc/TabSettings.java
Normal file
37
src/main/java/dev/resent/module/impl/misc/TabSettings.java
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
package dev.resent.module.impl.misc;
|
||||||
|
|
||||||
|
import dev.resent.annotation.Module;
|
||||||
|
import dev.resent.module.base.Mod;
|
||||||
|
import dev.resent.module.base.Mod.Category;
|
||||||
|
import dev.resent.module.base.setting.CustomRectSettingDraw;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||||
|
|
||||||
|
@Module(name = "Tab Settings", category = Category.MISC, hasSetting = true, description = "Change the icon or title of the tab you're on!")
|
||||||
|
public class TabSettings extends Mod {
|
||||||
|
public CustomRectSettingDraw addTabTitle = new CustomRectSettingDraw("Set Tab Title...", "") {
|
||||||
|
@Override
|
||||||
|
public void onPress() {
|
||||||
|
PlatformRuntime.changeTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
public CustomRectSettingDraw addTabIcon = new CustomRectSettingDraw("Set Tab Icon...", "") {
|
||||||
|
@Override
|
||||||
|
public void onPress() {
|
||||||
|
PlatformRuntime.changeFavicon();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public void onEnable() {
|
||||||
|
PlatformRuntime.toggleTabTitleMod(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {
|
||||||
|
PlatformRuntime.toggleTabTitleMod(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TabSettings() {
|
||||||
|
addSetting(addTabTitle, addTabIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -160,9 +160,25 @@ public class ClickGuiRewrite extends GuiScreen {
|
||||||
|
|
||||||
// Mod Categories
|
// Mod Categories
|
||||||
RenderUtils.drawRoundedRect(x + 80, y+90, (x + width) - 30, y+120, 8, new Color(30, 30, 30).getRGB());
|
RenderUtils.drawRoundedRect(x + 80, y+90, (x + width) - 30, y+120, 8, new Color(30, 30, 30).getRGB());
|
||||||
|
// pls dont remove the thing that switches the colors, doesnt look good without the color switching
|
||||||
|
if (selectedCategory == null) {
|
||||||
RenderUtils.drawRoundedRect(x + 85, y+95, x + 130, y+115, 8, secondaryFontColor.getRGB());
|
RenderUtils.drawRoundedRect(x + 85, y+95, x + 130, y+115, 8, secondaryFontColor.getRGB());
|
||||||
RenderUtils.drawRoundedRect(x + 135, y+95, x + 180, y+115, 8,secondaryFontColor.getRGB());
|
}
|
||||||
|
else {
|
||||||
|
RenderUtils.drawRoundedRect(x + 85, y+95, x + 130, y+115, 8, new Color(40, 40, 40).getRGB());
|
||||||
|
}
|
||||||
|
if (selectedCategory == Category.HUD) {
|
||||||
|
RenderUtils.drawRoundedRect(x + 135, y+95, x + 180, y+115, 8, secondaryFontColor.getRGB());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RenderUtils.drawRoundedRect(x + 135, y+95, x + 180, y+115, 8, new Color(40, 40, 40).getRGB());
|
||||||
|
}
|
||||||
|
if (selectedCategory == Category.MISC) {
|
||||||
RenderUtils.drawRoundedRect(x + 185, y+95, x + 230, y+115, 8, secondaryFontColor.getRGB());
|
RenderUtils.drawRoundedRect(x + 185, y+95, x + 230, y+115, 8, secondaryFontColor.getRGB());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RenderUtils.drawRoundedRect(x + 185, y+95, x + 230, y+115, 8, new Color(40, 40, 40).getRGB());
|
||||||
|
}
|
||||||
fr.drawString("All", (int) x+102, (int) y+102, -1);
|
fr.drawString("All", (int) x+102, (int) y+102, -1);
|
||||||
fr.drawString("HUD", (int) x+149, (int) y+102, -1);
|
fr.drawString("HUD", (int) x+149, (int) y+102, -1);
|
||||||
fr.drawString("Misc", (int) x+198, (int) y+102, -1);
|
fr.drawString("Misc", (int) x+198, (int) y+102, -1);
|
||||||
|
@ -173,7 +189,13 @@ public class ClickGuiRewrite extends GuiScreen {
|
||||||
if (isMouseInside(mouseX, mouseY, (x+width)-70, y+90, (x+width)-40, y+120)) {
|
if (isMouseInside(mouseX, mouseY, (x+width)-70, y+90, (x+width)-40, y+120)) {
|
||||||
RenderUtils.drawRoundedRect((x+width)-72, y+92, (x+width)-37, y+117, 2, secondaryFontColor.getRGB());
|
RenderUtils.drawRoundedRect((x+width)-72, y+92, (x+width)-37, y+117, 2, secondaryFontColor.getRGB());
|
||||||
}
|
}
|
||||||
mc.getTextureManager().bindTexture(new ResourceLocation("eagler:gui/button_"+currentView+".png"));
|
if (currentView == "gridView") {
|
||||||
|
mc.getTextureManager().bindTexture(new ResourceLocation("eagler:gui/button_gridView.png"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mc.getTextureManager().bindTexture(new ResourceLocation("eagler:gui/button_normalView.png"));
|
||||||
|
}
|
||||||
|
|
||||||
GlStateManager.color(1, 1, 1);
|
GlStateManager.color(1, 1, 1);
|
||||||
Gui.drawModalRectWithCustomSizedTexture((x+width)-70, (int) y+90, 0, 0, 30, 30, 30, 30);
|
Gui.drawModalRectWithCustomSizedTexture((x+width)-70, (int) y+90, 0, 0, 30, 30, 30, 30);
|
||||||
|
|
||||||
|
@ -413,6 +435,7 @@ public class ClickGuiRewrite extends GuiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
|
this.mc.gameSettings.loadOptions();
|
||||||
sr = new ScaledResolution(mc);
|
sr = new ScaledResolution(mc);
|
||||||
x = sr.getScaledWidth() / 10;
|
x = sr.getScaledWidth() / 10;
|
||||||
y = sr.getScaledHeight() / 10;
|
y = sr.getScaledHeight() / 10;
|
||||||
|
@ -469,7 +492,7 @@ public class ClickGuiRewrite extends GuiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed() {
|
||||||
mc.gameSettings.saveOptions();
|
this.mc.gameSettings.saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawSetting() {
|
public void drawSetting() {
|
||||||
|
|
|
@ -619,4 +619,13 @@ public class PlatformRuntime {
|
||||||
|
|
||||||
@JSBody(params = {}, script = "die2();")
|
@JSBody(params = {}, script = "die2();")
|
||||||
public static native void removeLoadScreen();
|
public static native void removeLoadScreen();
|
||||||
|
|
||||||
|
@JSBody(params = {}, script = "setFavicon()")
|
||||||
|
public static native void changeFavicon();
|
||||||
|
|
||||||
|
@JSBody(params = {}, script = "setTitle()")
|
||||||
|
public static native void changeTitle();
|
||||||
|
|
||||||
|
@JSBody(params = { "isEnabled" }, script = "toggleTabSettingsMod(isEnabled)")
|
||||||
|
public static native void toggleTabTitleMod(boolean isEnabled);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user