-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*Improved the mod config system *Fixed a bug with off hand moving whenever moving the main hand slider *Improved GUI
- Loading branch information
Showing
15 changed files
with
254 additions
and
178 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package net.i_no_am.viewmodel.client; | ||
|
||
import net.i_no_am.viewmodel.utils.Utils; | ||
|
||
public interface Global { | ||
String PREFIX = "§7[§aViewModel§7]§r "; | ||
String CURRENT_VERSION = "7.0"; | ||
String CURRENT_VERSION = Utils.getModVersion(); | ||
String modId = "viewmodel"; | ||
String[] screens = { | ||
"assets/viewmodel/improperui/screen.ui", | ||
"assets/viewmodel/improperui/secondScreen.ui" | ||
}; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/net/i_no_am/viewmodel/config/ConfigManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package net.i_no_am.viewmodel.config; | ||
|
||
import io.github.itzispyder.improperui.ImproperUIAPI; | ||
import io.github.itzispyder.improperui.config.ConfigReader; | ||
import net.i_no_am.viewmodel.client.Global; | ||
import net.i_no_am.viewmodel.config.settings.ViewModelSettings; | ||
import net.i_no_am.viewmodel.config.settings.SettingsManager; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ConfigManager implements Global, SettingsManager { | ||
|
||
private static final Map<ViewModelSettings, SettingStructure<?>> system = new HashMap<>(); | ||
|
||
/** | ||
* If you want to add more features, do it via using {@link SettingsManager} + {@link ViewModelSettings}. | ||
*/ | ||
|
||
|
||
public static void loadConfigValues() { | ||
ConfigReader VMconfig = ImproperUIAPI.getConfigReader(modId, "config.properties"); | ||
|
||
system.put(ViewModelSettings.MAIN_ROT_X, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.MAIN_ROT_X.getKey(), MAIN_ROTATION_X))); | ||
system.put(ViewModelSettings.MAIN_POS_X, new FloatSettingStructure((float) (VMconfig.readFloat(ViewModelSettings.MAIN_POS_X.getKey(), MAIN_POSITION_X) / DIVISION))); | ||
system.put(ViewModelSettings.MAIN_ROT_Z, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.MAIN_ROT_Z.getKey(), MAIN_ROTATION_Z))); | ||
system.put(ViewModelSettings.MAIN_POS_Z, new FloatSettingStructure((float) (VMconfig.readFloat(ViewModelSettings.MAIN_POS_Z.getKey(), MAIN_POSITION_Z) / DIVISION))); | ||
system.put(ViewModelSettings.MAIN_ROT_Y, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.MAIN_ROT_Y.getKey(), MAIN_ROTATION_Y))); | ||
system.put(ViewModelSettings.MAIN_POS_Y, new FloatSettingStructure((float) (VMconfig.readFloat(ViewModelSettings.MAIN_POS_Y.getKey(), MAIN_POSITION_Y) / DIVISION))); | ||
|
||
system.put(ViewModelSettings.OFF_ROT_X, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.OFF_ROT_X.getKey(), OFF_ROTATION_X))); | ||
system.put(ViewModelSettings.OFF_POS_X, new FloatSettingStructure((float) (VMconfig.readFloat(ViewModelSettings.OFF_POS_X.getKey(), OFF_POSITION_X) / DIVISION))); | ||
system.put(ViewModelSettings.OFF_ROT_Z, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.OFF_ROT_Z.getKey(), OFF_ROTATION_Z))); | ||
system.put(ViewModelSettings.OFF_POS_Z, new FloatSettingStructure((float) (VMconfig.readFloat(ViewModelSettings.OFF_POS_Z.getKey(), OFF_POSITION_Z) / DIVISION))); | ||
system.put(ViewModelSettings.OFF_ROT_Y, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.OFF_ROT_Y.getKey(), OFF_ROTATION_Y))); | ||
system.put(ViewModelSettings.OFF_POS_Y, new FloatSettingStructure((float) (VMconfig.readFloat(ViewModelSettings.OFF_POS_Y.getKey(), OFF_POSITION_Y) / DIVISION))); | ||
|
||
system.put(ViewModelSettings.NO_SWING_V2, new BooleanSetting(VMconfig.readBool(ViewModelSettings.NO_SWING_V2.getKey(), NO_SWING_V2))); | ||
system.put(ViewModelSettings.NO_SWING, new BooleanSetting(VMconfig.readBool(ViewModelSettings.NO_SWING.getKey(), NO_SWING))); | ||
system.put(ViewModelSettings.HAND_SWING_SPEED, new IntegerSettingStructure(2 * VMconfig.readInt(ViewModelSettings.HAND_SWING_SPEED.getKey(), HAND_SWING_SPEED))); | ||
system.put(ViewModelSettings.NO_FOOD_SWING, new BooleanSetting(VMconfig.readBool(ViewModelSettings.NO_FOOD_SWING.getKey(), NO_FOOD_SWING))); | ||
system.put(ViewModelSettings.MAIN_SCALE, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.MAIN_SCALE.getKey(), MAIN_SCALE))); | ||
system.put(ViewModelSettings.OFF_SCALE, new FloatSettingStructure((float) VMconfig.readFloat(ViewModelSettings.OFF_SCALE.getKey(), OFF_SCALE))); | ||
system.put(ViewModelSettings.NO_HAND, new BooleanSetting(VMconfig.readBool(ViewModelSettings.NO_HAND.getKey(), NO_HAND))); | ||
} | ||
|
||
public static SettingStructure<?> get(ViewModelSettings key) { | ||
return system.get(key); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/net/i_no_am/viewmodel/config/SettingStructure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package net.i_no_am.viewmodel.config; | ||
|
||
public abstract class SettingStructure<T> { | ||
private final T value; | ||
|
||
public SettingStructure(T value) { | ||
this.value = value; | ||
} | ||
|
||
public T getVal() { | ||
return value; | ||
} | ||
} | ||
|
||
class FloatSettingStructure extends SettingStructure<Float> { | ||
public FloatSettingStructure(Float value) { | ||
super(value); | ||
} | ||
} | ||
|
||
class BooleanSetting extends SettingStructure<Boolean> { | ||
public BooleanSetting(Boolean value) { | ||
super(value); | ||
} | ||
} | ||
|
||
class IntegerSettingStructure extends SettingStructure<Integer> { | ||
public IntegerSettingStructure(Integer value) { | ||
super(value); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/net/i_no_am/viewmodel/config/settings/SettingsManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package net.i_no_am.viewmodel.config.settings; | ||
|
||
import net.i_no_am.viewmodel.config.ConfigManager; | ||
|
||
public interface SettingsManager { | ||
/** | ||
* @Param Add here the default settings to every setting | ||
* After that go to: | ||
* {@link ConfigManager} | ||
*/ | ||
boolean NO_HAND = false; | ||
int HAND_SWING_SPEED = 6; | ||
int DIVISION = 10; | ||
boolean NO_SWING_V2 = false; | ||
boolean NO_SWING = false; | ||
boolean NO_FOOD_SWING = false; | ||
float MAIN_SCALE = 1.0F; | ||
float OFF_SCALE = 1.0F; | ||
float MAIN_ROTATION_X = 0.0F; | ||
float MAIN_POSITION_X = 0.0F; | ||
float MAIN_ROTATION_Z = 0.0F; | ||
float MAIN_POSITION_Z = 0.0F; | ||
float MAIN_ROTATION_Y = 0.0F; | ||
float MAIN_POSITION_Y = 0.0F; | ||
float OFF_ROTATION_X = 0.0F; | ||
float OFF_POSITION_X = 0.0F; | ||
float OFF_ROTATION_Z = 0.0F; | ||
float OFF_POSITION_Z = 0.0F; | ||
float OFF_ROTATION_Y = 0.0F; | ||
float OFF_POSITION_Y = 0.0F; | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/net/i_no_am/viewmodel/config/settings/ViewModelSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.i_no_am.viewmodel.config.settings; | ||
|
||
public enum ViewModelSettings { | ||
MAIN_ROT_X("main-rotation-x"), | ||
MAIN_POS_X("main-position-x"), | ||
MAIN_ROT_Z("main-rotation-z"), | ||
MAIN_POS_Z("main-position-z"), | ||
MAIN_ROT_Y("main-rotation-y"), | ||
MAIN_POS_Y("main-position-y"), | ||
OFF_ROT_X("off-rotation-x"), | ||
OFF_POS_X("off-position-x"), | ||
OFF_ROT_Z("off-rotation-z"), | ||
OFF_POS_Z("off-position-z"), | ||
OFF_ROT_Y("off-rotation-y"), | ||
OFF_POS_Y("off-position-y"), | ||
NO_SWING("no-hand-swing"), | ||
NO_SWING_V2("no-hand-swing-v2"), | ||
HAND_SWING_SPEED("hand-speed-swing"), | ||
NO_FOOD_SWING("no-food-swing"), | ||
MAIN_SCALE("main-hand-scale"), | ||
OFF_SCALE("off-hand-scale"), | ||
NO_HAND("no-hand-render"); | ||
|
||
private final String key; | ||
|
||
ViewModelSettings(String setting) { | ||
this.key = setting; | ||
} | ||
|
||
public String getKey() { | ||
return key; | ||
} | ||
} |
112 changes: 0 additions & 112 deletions
112
src/main/java/net/i_no_am/viewmodel/gui/ViewModelSettings.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.