Fix keystrokes transparency issue and add settings save?
This commit is contained in:
parent
f533d032b9
commit
875b857ada
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
148195
javascript/classes.js
148195
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -31,71 +31,7 @@ public class Resent {
|
|||
public ModManager modManager;
|
||||
|
||||
public void init() {
|
||||
modManager = new ModManager();
|
||||
}
|
||||
|
||||
public void saveSettings(PrintWriter printwriter){
|
||||
for(Mod m : modManager.modules){
|
||||
|
||||
List<RenderModule> rmodules = new ArrayList<>();
|
||||
if(m instanceof RenderModule){ rmodules.add((RenderModule)m); }
|
||||
|
||||
for(RenderModule rmod : rmodules){
|
||||
printwriter.println(rmod.name+"x:"+rmod.x);
|
||||
printwriter.println(rmod.name+"y:"+rmod.y);
|
||||
printwriter.println(rmod.name+"lastx:"+rmod.lastX);
|
||||
printwriter.println(rmod.name+"lastx:"+rmod.lastX);
|
||||
}
|
||||
|
||||
for(Setting s : m.settings){
|
||||
if(s instanceof ModeSetting){
|
||||
printwriter.println(m.name+"modesetting"+s.name+":"+((ModeSetting) s).getValue());
|
||||
}
|
||||
if(s instanceof BooleanSetting){
|
||||
printwriter.println(m.name+"boolsetting"+s.name+":"+((BooleanSetting) s).getValue());
|
||||
}
|
||||
}
|
||||
|
||||
printwriter.println(m.name + ":" + m.enabled);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadSettings(String[] astring){
|
||||
for(Mod m : modManager.modules){
|
||||
|
||||
List<RenderModule> rmodules = new ArrayList<>();
|
||||
if(m instanceof RenderModule){ rmodules.add((RenderModule)m); }
|
||||
|
||||
for(RenderModule rmod : rmodules){
|
||||
if(astring[0].equals(rmod.name+"x")){
|
||||
rmod.x=Integer.parseInt(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(rmod.name+"y")){
|
||||
rmod.y=Integer.parseInt(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(rmod.name+"lastx")){
|
||||
rmod.lastX=Integer.parseInt(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(rmod.name+"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)){
|
||||
((ModeSetting)se).setValue(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(m.name+"boolsetting"+se.name)){
|
||||
((BooleanSetting)se).setValue(astring[1].equals("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(astring[0].equals(m.name)){
|
||||
m.setEnabled(astring[1].equals("true"));
|
||||
}
|
||||
}
|
||||
this.modManager = new ModManager();
|
||||
}
|
||||
|
||||
public EventBus<Event> events() {
|
||||
|
|
|
@ -67,7 +67,6 @@ public class KeyStrokes extends RenderModule{
|
|||
|
||||
@Override
|
||||
public void draw() {
|
||||
if (!transparent.getValue()) {
|
||||
|
||||
boolean pressed = mc.gameSettings.keyBindAttack.pressed;
|
||||
boolean rpressed = mc.gameSettings.keyBindUseItem.pressed;
|
||||
|
@ -90,6 +89,7 @@ public class KeyStrokes extends RenderModule{
|
|||
GlStateManager.scale(getSize(this.size), getSize(this.size), getSize(this.size));
|
||||
GlStateManager.translate(-(this.x + 1), -(this.y + 1), 0);
|
||||
|
||||
if (!transparent.getValue()) {
|
||||
//W
|
||||
Gui.drawRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3,
|
||||
mc.gameSettings.keyBindForward.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
|
||||
|
@ -113,12 +113,12 @@ public class KeyStrokes extends RenderModule{
|
|||
if(jump.getValue())
|
||||
Gui.drawRect(this.x + 3, this.y+84, this.x+85-3,
|
||||
this.y + 105 - 6, mc.gameSettings.keyBindJump.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
|
||||
}
|
||||
|
||||
// Sneak
|
||||
if (sneak.getValue() && !transparent.getValue())
|
||||
if (sneak.getValue())
|
||||
Gui.drawRect(this.x + 3, jump.getValue() ? this.y+102 : this.y+84, this.x+85-3,
|
||||
jump.getValue() ? this.y+120-3 : this.y+105-6, mc.gameSettings.keyBindSneak.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
|
||||
}
|
||||
|
||||
|
||||
mc.fontRendererObj.drawString("W", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("W") + 4), this.y+8+3, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : mc.gameSettings.keyBindForward.pressed ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
|
||||
|
|
|
@ -704,8 +704,6 @@ public class GameSettings {
|
|||
try {
|
||||
String[] astring = s.split(":");
|
||||
|
||||
Resent.INSTANCE.loadSettings(astring);
|
||||
|
||||
if (astring[0].equals("mouseSensitivity")) {
|
||||
this.mouseSensitivity = this.parseFloat(astring[1]);
|
||||
}
|
||||
|
@ -1005,6 +1003,42 @@ public class GameSettings {
|
|||
}
|
||||
}
|
||||
|
||||
for(Mod m : Resent.INSTANCE.modManager.modules){
|
||||
|
||||
List<RenderModule> rmodules = new ArrayList<>();
|
||||
if(m instanceof RenderModule){ rmodules.add((RenderModule)m); }
|
||||
|
||||
for(RenderModule rmod : rmodules){
|
||||
if(astring[0].equals(rmod.name+"x")){
|
||||
rmod.x=Integer.parseInt(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(rmod.name+"y")){
|
||||
rmod.y=Integer.parseInt(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(rmod.name+"lastx")){
|
||||
rmod.lastX=Integer.parseInt(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(rmod.name+"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)){
|
||||
((ModeSetting)se).setValue(astring[1]);
|
||||
}
|
||||
if(astring[0].equals(m.name+"boolsetting"+se.name)){
|
||||
((BooleanSetting)se).setValue(astring[1].equals("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(astring[0].equals(m.name)){
|
||||
m.setEnabled(astring[1].equals("true"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values()) {
|
||||
if (astring[0].equals("modelPart_" + enumplayermodelparts.getPartName())) {
|
||||
|
@ -1038,8 +1072,6 @@ public class GameSettings {
|
|||
ByteArrayOutputStream bao = new ByteArrayOutputStream();
|
||||
PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(EaglerZLIB.newGZIPOutputStream(bao)));
|
||||
|
||||
Resent.INSTANCE.saveSettings(printwriter);
|
||||
|
||||
printwriter.println("invertYMouse:" + this.invertMouse);
|
||||
printwriter.println("mouseSensitivity:" + this.mouseSensitivity);
|
||||
printwriter.println("fov:" + (this.fovSetting - 70.0F) / 40.0F);
|
||||
|
@ -1114,6 +1146,29 @@ public class GameSettings {
|
|||
printwriter.println("hud24h:" + this.hud24h);
|
||||
printwriter.println("chunkFix:" + this.chunkFix);
|
||||
printwriter.println("fog:" + this.fog);
|
||||
for(Mod m : Resent.INSTANCE.modManager.modules){
|
||||
|
||||
List<RenderModule> rmodules = new ArrayList<>();
|
||||
if(m instanceof RenderModule){ rmodules.add((RenderModule)m); }
|
||||
|
||||
for(RenderModule rmod : rmodules){
|
||||
printwriter.println(rmod.name+"x:"+rmod.x);
|
||||
printwriter.println(rmod.name+"y:"+rmod.y);
|
||||
printwriter.println(rmod.name+"lastx:"+rmod.lastX);
|
||||
printwriter.println(rmod.name+"lastx:"+rmod.lastX);
|
||||
}
|
||||
|
||||
for(Setting s : m.settings){
|
||||
if(s instanceof ModeSetting){
|
||||
printwriter.println(m.name+"modesetting"+s.name+":"+((ModeSetting) s).getValue());
|
||||
}
|
||||
if(s instanceof BooleanSetting){
|
||||
printwriter.println(m.name+"boolsetting"+s.name+":"+((BooleanSetting) s).getValue());
|
||||
}
|
||||
}
|
||||
|
||||
printwriter.println(m.name + ":" + m.enabled);
|
||||
}
|
||||
|
||||
for (KeyBinding keybinding : this.keyBindings) {
|
||||
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
|
||||
|
|
Loading…
Reference in New Issue
Block a user