Skip to content

Commit

Permalink
Update 9.0
Browse files Browse the repository at this point in the history
Changelog:

*Improved code quality and efficiency.

*Changed the update checking method.

*Removed hand scaling.

*Fixed a bug where hand positions would change while swimming.

*Fixed hand swing speed.
  • Loading branch information
I-No-oNe committed Sep 19, 2024
1 parent f612f13 commit 939ec0f
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 351 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.15.11

# Mod Properties
mod_version = 8.0-1.21-fabric
mod_version = 9.0-1.21-fabric
maven_group=net.i_no_am.view_model
archives_base_name=view-model

# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.100.4+1.21
# ImproperUI
# check latest release on https://github.com/ItziSpyder/ImproperUI/releases
# ImproperUI Properties
# check on https://github.com/ItziSpyder/ImproperUI/releases/latest
improperui_version=1.21-0.0.6-BETA
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package net.i_no_am.viewmodel.client;
package net.i_no_am.viewmodel;

import net.i_no_am.viewmodel.utils.Utils;
import net.minecraft.client.MinecraftClient;

public interface Global {
MinecraftClient mc = MinecraftClient.getInstance();
String PREFIX = "§7[§aViewModel§7]§r ";
String CURRENT_VERSION = Utils.getModVersion();
String modId = "viewmodel";
String[] screens = {
"assets/viewmodel/improperui/screen.ui",
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/net/i_no_am/viewmodel/ViewModel.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
package net.i_no_am.viewmodel;

import net.i_no_am.viewmodel.client.Global;
import io.github.itzispyder.improperui.ImproperUIAPI;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.i_no_am.viewmodel.config.ConfigManager;
import net.i_no_am.viewmodel.version.Version;
import net.i_no_am.viewmodel.config.Config;
import net.i_no_am.viewmodel.event.SecondMenuCallBack;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;

public class ViewModel implements ModInitializer, Global {

public static final KeyBinding BIND = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"binds.viewmodel.menu",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_V,
"binds.viewmodel"
));
public static boolean isOutdated = false;
public static final KeyBinding BIND = KeyBindingHelper.registerKeyBinding(new KeyBinding("binds.viewmodel.menu", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_V, "binds.viewmodel"));

@Override
public void onInitialize() {
Version.checkUpdates();
ImproperUIAPI.init(modId, ViewModel.class, screens);
ClientTickEvents.END_CLIENT_TICK.register(client -> {
Config.loadConfig();
while (BIND.wasPressed()) {
ImproperUIAPI.parseAndRunFile(modId, "screen.ui",new SecondMenuCallBack());
}
ConfigManager.loadConfigValues();
});
}
}
72 changes: 0 additions & 72 deletions src/main/java/net/i_no_am/viewmodel/client/ModVersionChecker.java

This file was deleted.

This file was deleted.

65 changes: 65 additions & 0 deletions src/main/java/net/i_no_am/viewmodel/config/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package net.i_no_am.viewmodel.config;

import io.github.itzispyder.improperui.ImproperUIAPI;
import io.github.itzispyder.improperui.config.ConfigReader;
import io.github.itzispyder.improperui.util.ChatUtils;
import net.i_no_am.viewmodel.Global;
import net.i_no_am.viewmodel.config.settings.ConfigSettings;
import net.minecraft.util.Formatting;

public class Config implements Global {

private static final ConfigReader VMConfig = ImproperUIAPI.getConfigReader(modId, "config.properties");

/*First Page Settings:*/
public static ConfigSettings<Double> mainPositionX;
public static ConfigSettings<Double> mainRotationX;
public static ConfigSettings<Double> offPositionX;
public static ConfigSettings<Double> offRotationX;
public static ConfigSettings<Double> mainPositionY;
public static ConfigSettings<Double> mainRotationY;
public static ConfigSettings<Double> offPositionY;
public static ConfigSettings<Double> offRotationY;
public static ConfigSettings<Double> mainPositionZ;
public static ConfigSettings<Double> mainRotationZ;
public static ConfigSettings<Double> offPositionZ;
public static ConfigSettings<Double> offRotationZ;
/*Second Page Settings*/
public static ConfigSettings<Double> handSpeedSwing;
public static ConfigSettings<Double> mainHandScale;
public static ConfigSettings<Double> offHandScale;
public static ConfigSettings<Boolean> noHandSwingV2;
public static ConfigSettings<Boolean> noHandSwingV1;
public static ConfigSettings<Boolean> noFoodSwing;
public static ConfigSettings<Boolean> noHandRender;

public static void loadConfig() {
/*First Page Settings:*/
mainPositionX = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-position-x", 0.0));
mainRotationX = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-rotation-x", 0.0));
offPositionX = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-position-x", 0.0));
offRotationX = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-rotation-x", 0.0));
mainPositionY = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-position-y", 0.0));
mainRotationY = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-rotation-y", 0.0));
offPositionY = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-position-y", 0.0));
offRotationY = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-rotation-y", 0.0));
mainPositionZ = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-position-z", 0.0));
mainRotationZ = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-rotation-z", 0.0));
offPositionZ = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-position-z", 0.0));
offRotationZ = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-rotation-z", 0.0));
/*Second Page Settings:*/
handSpeedSwing = new ConfigSettings<>(Double.class, VMConfig.readDouble("hand-speed-swing", 4.0));///it was 1 - 7, from now its 0 - 5 (2 and below didnt work)
mainHandScale = new ConfigSettings<>(Double.class, VMConfig.readDouble("main-hand-scale", 1.0));
offHandScale = new ConfigSettings<>(Double.class, VMConfig.readDouble("off-hand-scale", 1.0));
noHandSwingV2 = new ConfigSettings<>(Boolean.class, VMConfig.readBool("no-hand-swing-v2", false));
noHandSwingV1 = new ConfigSettings<>(Boolean.class, VMConfig.readBool("no-hand-swing-v1", false));
noFoodSwing = new ConfigSettings<>(Boolean.class, VMConfig.readBool("no-food-swing", false));
noHandRender = new ConfigSettings<>(Boolean.class, VMConfig.readBool("no-hand-render", false));
/*No Swing Logic*/
if (noHandSwingV2.getVal() && (noHandSwingV1.getVal())) {
VMConfig.write("no-hand-swing", false);
VMConfig.write("no-hand-swing-v2", false);
ChatUtils.sendMessage(PREFIX + Formatting.RED + "CHOOSE ONE OPTION!");
}
}
}
50 changes: 0 additions & 50 deletions src/main/java/net/i_no_am/viewmodel/config/ConfigManager.java

This file was deleted.

31 changes: 0 additions & 31 deletions src/main/java/net/i_no_am/viewmodel/config/SettingStructure.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.i_no_am.viewmodel.config.settings;

public class ConfigSettings<T> {
private final T value;

public ConfigSettings(Class<T> type, T value) {
this.value = value;
}

public T getVal() {
return value;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import io.github.itzispyder.improperui.script.CallbackHandler;
import io.github.itzispyder.improperui.script.CallbackListener;
import io.github.itzispyder.improperui.script.events.MouseEvent;
import net.i_no_am.viewmodel.client.Global;
import net.i_no_am.viewmodel.Global;


public class SecondMenuCallBack implements CallbackListener, Global {


@CallbackHandler
public void openHandsSettingScreen(MouseEvent e) {
if (e.input.isDown())
Expand Down
Loading

0 comments on commit 939ec0f

Please sign in to comment.