More code improvements
This commit is contained in:
parent
d8751e939e
commit
1511a5cedb
61089
javascript/classes.js
61089
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -16,10 +16,10 @@
|
|||
|
||||
package com.google.common.base;
|
||||
|
||||
import com.google.common.annotations.GwtCompatible;
|
||||
import com.google.common.annotations.GwtIncompatible;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import com.google.common.annotations.GwtCompatible;
|
||||
|
||||
/**
|
||||
* Contains constant definitions for the six standard {@link Charset} instances,
|
||||
* which are guaranteed to be supported by all Java platform implementations.
|
||||
|
|
|
@ -12,13 +12,11 @@ import net.minecraft.client.Minecraft;
|
|||
|
||||
public abstract class Mod {
|
||||
|
||||
public Minecraft mc = Minecraft.getMinecraft();
|
||||
public int keyCode;
|
||||
|
||||
public String name;
|
||||
public Category category;
|
||||
public boolean enabled = false;
|
||||
public boolean hasSetting;
|
||||
protected Minecraft mc = Minecraft.getMinecraft();
|
||||
private String name;
|
||||
private Category category;
|
||||
private boolean enabled = false;
|
||||
private boolean hasSetting;
|
||||
|
||||
public List<Setting> settings = new ArrayList<>();
|
||||
|
||||
|
@ -26,26 +24,30 @@ public abstract class Mod {
|
|||
Module modInfo;
|
||||
if(getClass().isAnnotationPresent(Module.class)){
|
||||
modInfo = getClass().getAnnotation(Module.class);
|
||||
this.name = modInfo.name();
|
||||
this.category = modInfo.category();
|
||||
this.hasSetting = modInfo.hasSetting();
|
||||
this.setName(modInfo.name());
|
||||
this.setCategory(modInfo.category());
|
||||
this.setHasSetting(modInfo.hasSetting());
|
||||
}
|
||||
}
|
||||
|
||||
public void addSetting(final Setting... settings) {
|
||||
this.settings.addAll(Arrays.asList(settings));
|
||||
}
|
||||
|
||||
public void addSetting(final Setting... settings) { this.settings.addAll(Arrays.asList(settings)); }
|
||||
public void onEnable() {}
|
||||
public void onDisable() {}
|
||||
|
||||
public void toggle() {
|
||||
this.enabled = !this.enabled;
|
||||
if (this.enabled) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
private void onChange(){
|
||||
if(enabled)
|
||||
onEnable();
|
||||
} else {
|
||||
else
|
||||
onDisable();
|
||||
}
|
||||
}
|
||||
public void setEnabled(final boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
onChange();
|
||||
}
|
||||
|
||||
protected void drawRect(final int left, final int top, final int right, final int bottom, final int color){
|
||||
|
@ -62,11 +64,6 @@ public abstract class Mod {
|
|||
return x;
|
||||
}
|
||||
|
||||
public void setEnabled(final boolean state) {
|
||||
this.enabled = state;
|
||||
if (this.enabled) onEnable(); else onDisable();
|
||||
}
|
||||
|
||||
public enum Category {
|
||||
HUD("Hud"),
|
||||
MISC("Misc");
|
||||
|
@ -79,6 +76,11 @@ public abstract class Mod {
|
|||
}
|
||||
|
||||
public boolean isEnabled() { return enabled; }
|
||||
public boolean isHasSetting() { return hasSetting; }
|
||||
public String getName() { return name; }
|
||||
public Category getCategory() { return category; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
public void setCategory(Category category) { this.category = category; }
|
||||
public void setHasSetting(boolean hasSetting) { this.hasSetting = hasSetting; }
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import dev.resent.module.impl.misc.NoParticles;
|
|||
import dev.resent.module.impl.misc.NoRain;
|
||||
import dev.resent.module.impl.misc.NoSwingDelay;
|
||||
import dev.resent.module.impl.misc.Scoreboard;
|
||||
import dev.resent.module.impl.misc.SelfNametag;
|
||||
import dev.resent.module.impl.misc.Sprint;
|
||||
import dev.resent.module.impl.misc.TabGui;
|
||||
|
||||
|
@ -59,7 +58,6 @@ public class ModManager {
|
|||
//public static ChunkBorders chunkBorders;
|
||||
public static NoParticles noParticles = new NoParticles();
|
||||
public static Scoreboard scoreboard = new Scoreboard();
|
||||
public static SelfNametag selfNametag = new SelfNametag();
|
||||
public static ClearChat clearChat = new ClearChat();
|
||||
public static FPSB fpsb = new FPSB();
|
||||
public static Animations animations = new Animations();
|
||||
|
@ -112,7 +110,7 @@ public class ModManager {
|
|||
public ArrayList<Mod> modsInCategory(Category c){
|
||||
ArrayList<Mod> inCategory = new ArrayList<>();
|
||||
for(Mod m : this.modules){
|
||||
if(m.category == c)
|
||||
if(m.getCategory() == c)
|
||||
inCategory.add(m);
|
||||
}
|
||||
return inCategory;
|
||||
|
|
|
@ -18,9 +18,9 @@ public abstract class RenderMod extends Mod {
|
|||
RenderModule modInfo;
|
||||
if(getClass().isAnnotationPresent(RenderModule.class)){
|
||||
modInfo = getClass().getAnnotation(RenderModule.class);
|
||||
this.name = modInfo.name();
|
||||
this.category = modInfo.category();
|
||||
this.hasSetting = modInfo.hasSetting();
|
||||
this.setName(modInfo.name());
|
||||
this.setCategory(modInfo.category());
|
||||
this.setHasSetting(modInfo.hasSetting());
|
||||
this.x = modInfo.x();
|
||||
this.y = modInfo.y();
|
||||
}
|
||||
|
|
|
@ -36,9 +36,10 @@ public class ComboCounter extends RenderMod {
|
|||
|
||||
@Override
|
||||
public void draw() {
|
||||
if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.enabled){
|
||||
if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.isEnabled()){
|
||||
combo = 0;
|
||||
}
|
||||
|
||||
drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package dev.resent.module.impl.misc;
|
||||
|
||||
import dev.resent.annotation.Module;
|
||||
import dev.resent.module.base.Mod.Category;
|
||||
import dev.resent.module.base.Mod;
|
||||
|
||||
@Module(name = "Self Nametag", category = Category.MISC)
|
||||
public class SelfNametag extends Mod { }
|
|
@ -45,7 +45,7 @@ public class TabGui extends RenderMod{
|
|||
|
||||
offset = 0;
|
||||
for(Mod m : Resent.INSTANCE.modManager.modsInCategory(category)){
|
||||
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(m.name, x+73, y+6.5f+offset, -1);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(m.getName(), x+73, y+6.5f+offset, -1);
|
||||
offset += 16;
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class TabGui extends RenderMod{
|
|||
}
|
||||
}
|
||||
if (k ==KeyboardConstants.KEY_RIGHT){
|
||||
if(expanded && Resent.INSTANCE.modManager.modsInCategory(category).size() != 0 && Resent.INSTANCE.modManager.modsInCategory(category).get(category.i).name != "TabGUI"){
|
||||
if(expanded && Resent.INSTANCE.modManager.modsInCategory(category).size() != 0 && Resent.INSTANCE.modManager.modsInCategory(category).get(category.i).getName() != "TabGUI"){
|
||||
Resent.INSTANCE.modManager.modsInCategory(category).get(category.i).toggle();
|
||||
mc.gameSettings.saveOptions();
|
||||
}else {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ClickGUI extends GuiScreen {
|
|||
for (Mod m : Resent.INSTANCE.modManager.modules) {
|
||||
int fh = 9;
|
||||
|
||||
if (isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 - 1 - offset, this.x + 90 + xo - 1 + 21, height + 30 - fh * (-off) + 30 - 1 + 2 - 1 - offset) && m.hasSetting && modWatching == null) {
|
||||
if (isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 - 1 - offset, this.x + 90 + xo - 1 + 21, height + 30 - fh * (-off) + 30 - 1 + 2 - 1 - offset) && m.isHasSetting() && modWatching == null) {
|
||||
// Open settings
|
||||
this.modWatching = m;
|
||||
} else if (isMouseInside(mouseX, mouseY, x - 9 + 2, height + 27 + 9 + 2, x - 9 + 6 + fr.getStringWidth("<"), height + 33 + 9 + 2 + fr.getStringWidth("<")) && mouseButton == 0) {
|
||||
|
@ -154,7 +154,7 @@ public class ClickGUI extends GuiScreen {
|
|||
isMouseInside(mouseX, mouseY, this.x + 10 + xo - 1 + 10, height - 2 - fh * -(off) + 50 - 1 - offset, this.x + 90 + xo - 1 + 22, height + 30 - fh * (-off) + 30 - 1 + 2 - offset) ? new Color(105, 105, 105, 65).getRGB() : new Color(211, 211, 211, 65).getRGB()
|
||||
);
|
||||
|
||||
if (m.hasSetting) {
|
||||
if (m.isHasSetting()) {
|
||||
if(isMouseInside(mouseX, mouseY, this.x + 90 + xo - 1 + 10, height - 2 - fh * -(off) + 51 + 1 - offset, this.x + 90 + xo - 1 + 10 + fr.getStringWidth("o"), height - 2 - fh * -(off) + 51 + 1 - offset + 9))
|
||||
GlStateManager.color(1,1,1,0.6f);
|
||||
else {
|
||||
|
@ -166,12 +166,12 @@ public class ClickGUI extends GuiScreen {
|
|||
}
|
||||
}
|
||||
|
||||
fr.drawStringWithShadow(m.name, this.x + 15 + 7 + xo, height - fh * -(off) + 50 - offset, -1);
|
||||
fr.drawStringWithShadow(m.getName(), this.x + 15 + 7 + xo, height - fh * -(off) + 50 - offset, -1);
|
||||
}
|
||||
} else if (this.modWatching != null) {
|
||||
int var = 0;
|
||||
fr.drawString("<", x - 9 + 4, height + 29 + 9 + 2, -1);
|
||||
fr.drawStringWithShadow("Resent - " + modWatching.name, GuiScreen.width / 2 - (fr.getStringWidth("Resent - " + modWatching.name) / 2), height + 29 - 9 - 2, -1);
|
||||
fr.drawStringWithShadow("Resent - " + modWatching.getName(), GuiScreen.width / 2 - (fr.getStringWidth("Resent - " + modWatching.getName()) / 2), height + 29 - 9 - 2, -1);
|
||||
|
||||
for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) {
|
||||
ModeSetting mo;
|
||||
|
|
|
@ -12,7 +12,6 @@ import dev.resent.module.impl.misc.FPSB;
|
|||
import dev.resent.module.impl.misc.NoParticles;
|
||||
import dev.resent.module.impl.misc.NoRain;
|
||||
import dev.resent.module.impl.misc.Scoreboard;
|
||||
import dev.resent.module.impl.misc.SelfNametag;
|
||||
|
||||
public class W {
|
||||
|
||||
|
@ -24,7 +23,6 @@ public class W {
|
|||
return ModManager.dynamicFOV;
|
||||
}
|
||||
|
||||
//public static NoHurtCam noHurtCam(){ return ModManager.noHurtCam; }
|
||||
public static AutoGG autoGG() {
|
||||
return ModManager.autoGG;
|
||||
}
|
||||
|
@ -49,10 +47,6 @@ public class W {
|
|||
return ModManager.scoreboard;
|
||||
}
|
||||
|
||||
public static SelfNametag selfNametag() {
|
||||
return ModManager.selfNametag;
|
||||
}
|
||||
|
||||
public static ClearChat clearChat() {
|
||||
return ModManager.clearChat;
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ public class RenderManager {
|
|||
float f = entityIn.width / 2.0F;
|
||||
AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
|
||||
AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX - entityIn.posX + parDouble1, axisalignedbb.minY - entityIn.posY + parDouble2, axisalignedbb.minZ - entityIn.posZ + parDouble3, axisalignedbb.maxX - entityIn.posX + parDouble1, axisalignedbb.maxY - entityIn.posY + parDouble2, axisalignedbb.maxZ - entityIn.posZ + parDouble3);
|
||||
RenderGlobal.func_181563_a(axisalignedbb1, W.hitboxes().enabled ? RenderUtils.getColorWithoutRGB(Hitboxes.color).getRed() : 255, W.hitboxes().enabled ? RenderUtils.getColorWithoutRGB(Hitboxes.color).getGreen() : 255, W.hitboxes().enabled ? RenderUtils.getColorWithoutRGB(Hitboxes.color).getBlue() : 255, 255);
|
||||
RenderGlobal.func_181563_a(axisalignedbb1, W.hitboxes().isEnabled() ? RenderUtils.getColorWithoutRGB(Hitboxes.color).getRed() : 255, W.hitboxes().isEnabled() ? RenderUtils.getColorWithoutRGB(Hitboxes.color).getGreen() : 255, W.hitboxes().isEnabled() ? RenderUtils.getColorWithoutRGB(Hitboxes.color).getBlue() : 255, 255);
|
||||
if (entityIn instanceof EntityLivingBase) {
|
||||
float f1 = 0.01F;
|
||||
RenderGlobal.func_181563_a(new AxisAlignedBB(parDouble1 - (double) f, parDouble2 + (double) entityIn.getEyeHeight() - 0.009999999776482582D, parDouble3 - (double) f, parDouble1 + (double) f, parDouble2 + (double) entityIn.getEyeHeight() + 0.009999999776482582D, parDouble3 + (double) f), 255, 0, 0, 255);
|
||||
|
|
|
@ -236,8 +236,8 @@ public class GameSettings {
|
|||
this.language = EagRuntime.getConfiguration().getDefaultLocale();
|
||||
this.forceUnicodeFont = false;
|
||||
this.mc = mcIn;
|
||||
ModManager.scoreboard.enabled = true;
|
||||
ModManager.fpsb.enabled = true;
|
||||
ModManager.scoreboard.setEnabled(true);
|
||||
ModManager.fpsb.setEnabled(true);
|
||||
GameSettings.Options.RENDER_DISTANCE.setValueMax(18.0F);
|
||||
|
||||
this.renderDistanceChunks = 1;
|
||||
|
@ -1049,7 +1049,7 @@ public class GameSettings {
|
|||
}
|
||||
|
||||
for (Mod m : Resent.INSTANCE.modManager.modules) {
|
||||
if (astring[0].equals(m.name)) {
|
||||
if (astring[0].equals(m.getName())) {
|
||||
m.setEnabled(astring[1].equals("true"));
|
||||
}
|
||||
|
||||
|
@ -1059,28 +1059,28 @@ public class GameSettings {
|
|||
}
|
||||
|
||||
for (RenderMod rmod : rmodules) {
|
||||
if (astring[0].equals(rmod.name + "_x")) {
|
||||
if (astring[0].equals(rmod.getName() + "_x")) {
|
||||
rmod.setX(Integer.parseInt(astring[1]));
|
||||
}
|
||||
if (astring[0].equals(rmod.name + "_y")) {
|
||||
if (astring[0].equals(rmod.getName() + "_y")) {
|
||||
rmod.setY(Integer.parseInt(astring[1]));
|
||||
}
|
||||
if (astring[0].equals(rmod.name + "_lastx")) {
|
||||
if (astring[0].equals(rmod.getName() + "_lastx")) {
|
||||
rmod.lastX = Integer.parseInt(astring[1]);
|
||||
}
|
||||
if (astring[0].equals(rmod.name + "_lasty")) {
|
||||
if (astring[0].equals(rmod.getName() + "_lasty")) {
|
||||
rmod.lastY = Integer.parseInt(astring[1]);
|
||||
}
|
||||
}
|
||||
|
||||
for (Setting se : m.settings) {
|
||||
if (se instanceof ModeSetting) {
|
||||
if (astring[0].equals(m.name + "_modesetting_" + se.name)) {
|
||||
if (astring[0].equals(m.getName() + "_modesetting_" + se.name)) {
|
||||
((ModeSetting) se).setValue(astring[1]);
|
||||
}
|
||||
}
|
||||
if (se instanceof BooleanSetting) {
|
||||
if (astring[0].equals(m.name + "_boolsetting_" + se.name)) {
|
||||
if (astring[0].equals(m.getName() + "_boolsetting_" + se.name)) {
|
||||
((BooleanSetting) se).setValue(astring[1].equals("true"));
|
||||
}
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ public class GameSettings {
|
|||
}
|
||||
|
||||
for (Mod m : Resent.INSTANCE.modManager.modules) {
|
||||
printwriter.println(m.name + ":" + m.isEnabled());
|
||||
printwriter.println(m.getName() + ":" + m.isEnabled());
|
||||
|
||||
List<RenderMod> rmodules = new ArrayList<>();
|
||||
if (m instanceof RenderMod) {
|
||||
|
@ -1210,18 +1210,18 @@ public class GameSettings {
|
|||
}
|
||||
|
||||
for (RenderMod rmod : rmodules) {
|
||||
printwriter.println(rmod.name + "_x:" + rmod.getX());
|
||||
printwriter.println(rmod.name + "_y:" + rmod.getY());
|
||||
printwriter.println(rmod.name + "_lastx:" + rmod.lastX);
|
||||
printwriter.println(rmod.name + "_lastx:" + rmod.lastX);
|
||||
printwriter.println(rmod.getName() + "_x:" + rmod.getX());
|
||||
printwriter.println(rmod.getName() + "_y:" + rmod.getY());
|
||||
printwriter.println(rmod.getName() + "_lastx:" + rmod.lastX);
|
||||
printwriter.println(rmod.getName() + "_lastx:" + rmod.lastX);
|
||||
}
|
||||
|
||||
for (Setting s : m.settings) {
|
||||
if (s instanceof ModeSetting) {
|
||||
printwriter.println(m.name + "_modesetting_" + s.name + ":" + ((ModeSetting) s).getValue());
|
||||
printwriter.println(m.getName() + "_modesetting_" + s.name + ":" + ((ModeSetting) s).getValue());
|
||||
}
|
||||
if (s instanceof BooleanSetting) {
|
||||
printwriter.println(m.name + "_boolsetting_" + s.name + ":" + ((BooleanSetting) s).getValue());
|
||||
printwriter.println(m.getName() + "_boolsetting_" + s.name + ":" + ((BooleanSetting) s).getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user