Fully ported lambda system to load & save settings
This commit is contained in:
parent
fdefd9b446
commit
fd24371748
58849
javascript/classes.js
58849
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,15 +1,11 @@
|
|||
package dev.resent;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import dev.resent.module.base.Mod;
|
||||
import dev.resent.module.base.ModManager;
|
||||
import dev.resent.module.base.RenderMod;
|
||||
import dev.resent.module.setting.BooleanSetting;
|
||||
import dev.resent.module.setting.ModeSetting;
|
||||
import dev.resent.module.setting.Setting;
|
||||
|
||||
public class Resent {
|
||||
|
||||
|
@ -26,7 +22,6 @@ public class Resent {
|
|||
}
|
||||
|
||||
public void save(PrintWriter printwriter){
|
||||
|
||||
Resent.INSTANCE.modManager.modules.stream().forEach( m -> {
|
||||
printwriter.println(m.getName() + ":" + m.isEnabled());
|
||||
if(m instanceof RenderMod){
|
||||
|
@ -47,32 +42,28 @@ public class Resent {
|
|||
}
|
||||
|
||||
public void load(String[] astring){
|
||||
for (Mod m : Resent.INSTANCE.modManager.modules) {
|
||||
|
||||
Resent.INSTANCE.modManager.modules.stream().forEach(m -> {
|
||||
if (astring[0].equals(m.getName())) {
|
||||
m.setEnabled(astring[1].equals("true"));
|
||||
}
|
||||
|
||||
List<RenderMod> rmodules = new ArrayList<>();
|
||||
if(m instanceof RenderMod){
|
||||
rmodules.add((RenderMod) m);
|
||||
if (astring[0].equals(m.getName() + "_x")) {
|
||||
((RenderMod)m).setX(Integer.parseInt(astring[1]));
|
||||
}
|
||||
|
||||
for (RenderMod rmod : rmodules) {
|
||||
if (astring[0].equals(rmod.getName() + "_x")) {
|
||||
rmod.setX(Integer.parseInt(astring[1]));
|
||||
if (astring[0].equals(m.getName() + "_y")) {
|
||||
((RenderMod)m).setY(Integer.parseInt(astring[1]));
|
||||
}
|
||||
if (astring[0].equals(rmod.getName() + "_y")) {
|
||||
rmod.setY(Integer.parseInt(astring[1]));
|
||||
if (astring[0].equals(m.getName() + "_lastx")) {
|
||||
((RenderMod)m).lastX = Integer.parseInt(astring[1]);
|
||||
}
|
||||
if (astring[0].equals(rmod.getName() + "_lastx")) {
|
||||
rmod.lastX = Integer.parseInt(astring[1]);
|
||||
}
|
||||
if (astring[0].equals(rmod.getName() + "_lasty")) {
|
||||
rmod.lastY = Integer.parseInt(astring[1]);
|
||||
if (astring[0].equals(m.getName() + "_lasty")) {
|
||||
((RenderMod)m).lastY = Integer.parseInt(astring[1]);
|
||||
}
|
||||
}
|
||||
|
||||
for (Setting se : m.settings) {
|
||||
m.settings.stream().forEach(se ->{
|
||||
if (se instanceof ModeSetting) {
|
||||
if (astring[0].equals(m.getName() + "_modesetting_" + se.name)) {
|
||||
((ModeSetting) se).setValue(astring[1]);
|
||||
|
@ -83,39 +74,14 @@ public class Resent {
|
|||
((BooleanSetting) se).setValue(astring[1].equals("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//Legacy code below.
|
||||
|
||||
//private ISound uwu;
|
||||
|
||||
/*for (Mod m : Resent.INSTANCE.modManager.modules) {
|
||||
printwriter.println(m.getName() + ":" + m.isEnabled());
|
||||
|
||||
List<RenderMod> rmodules = new ArrayList<>();
|
||||
if (m instanceof RenderMod) {
|
||||
rmodules.add((RenderMod) m);
|
||||
}
|
||||
|
||||
for (RenderMod rmod : rmodules) {
|
||||
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.getName() + "_modesetting_" + s.name + ":" + ((ModeSetting) s).getValue());
|
||||
}
|
||||
if (s instanceof BooleanSetting) {
|
||||
printwriter.println(m.getName() + "_boolsetting_" + s.name + ":" + ((BooleanSetting) s).getValue());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*public void playMusic(ResourceLocation loc){
|
||||
this.uwu = PositionedSoundRecord.create(loc);
|
||||
if(uwu != null){
|
||||
|
|
|
@ -4,13 +4,13 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
|
Loading…
Reference in New Issue
Block a user