Jump to content

Steelseries GameSense Mod - MC 1.12.2


OneGaming36

Recommended Posts

Hey guys,

 

I got a new computer which actually supports Steelseries GameSense, a mod which changes the lighting of my keyboard depending on events ingame (like low health, being hungry, ...). So if I have full health my keyboard is green, but the lower my health gets it turns yellow/orange and finally red.

Now this mod seems to be only available on MC 1.8, but I need it to work on MC 1.12.2 (latest version). So I tried to reprogram it and change everything inside the coding which says version 1.8 to 1.12.2 (check pictures, where it says 1.8 I changed it to 1.12.2).

I saved everything and put the modified mod into the Forge mod folder.

But now the forge won't load the mod anymore (Forge 1.12.2), it just starts the game and doesn't show the mods in the mod list (ingame), although everything worked fine with unmoddified files on 1.8.

 

Could you guys please help me to make this mod running on the latest MC versions, in this case 1.12.2?

I don't have too much knowledge about java, but I'm doing my best to learn about it and figure out how everything works, or in my case doesn't work. O.o

 

 

Thanks for your help!

Code1.png

Code2.png

Link to comment
Share on other sites

Modified code of mcmod.info

[
{
  "modid": "gamesense",
  "name": "GameSense Mod",
  "description": "This is a mod that sends events to SteelSeries Engine 3 GameSense.",
  "version": "1.11",
  "mcversion": "1.12.2",
  "url": "",
  "updateUrl": "",
  "authorList": ["David Tibbetts"],
  "credits": "Thanks to MinecraftForge for providing the framework.",
  "logoFile": "",
  "screenshots": [],
  "dependencies": []
}
]

 

Modified code of GameSenseMod.class

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.sse3.gamesense;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.json.JSONException;
import org.json.JSONObject;

@Mod(
    modid = "gamesense",
    name = "gamesense",
    version = "1.11",
    acceptedMinecraftVersions = "[1.12.2]"
)
public class GameSenseMod {
    public static final String MODID = "gamesense";
    public static final String VERSION = "1.11";
    @Instance("gamesense")
    public static GameSenseMod instance;
    private CloseableHttpClient sseClient = null;
    private HttpPost ssePost = null;
    private String sse3Address = "";
    private Boolean isConnected = false;
    private long lastTick = 0L;

    public GameSenseMod() {
    }

    public void SendGameEvent(String eventName, int data, EntityPlayer player) {
        JSONObject eventData = new JSONObject();
        eventData.put("value", data);
        this.SendGameEvent(eventName, eventData, player);
    }

    public void SendGameEvent(String eventName, Boolean data, EntityPlayer player) {
        JSONObject eventData = new JSONObject();
        eventData.put("value", data);
        this.SendGameEvent(eventName, eventData, player);
    }

    public void SendGameEvent(String eventName, String data, EntityPlayer player) {
        JSONObject eventData = new JSONObject();
        eventData.put("value", data);
        this.SendGameEvent(eventName, eventData, player);
    }

    public void SendGameEvent(String eventName, JSONObject dataObject, EntityPlayer player) {
        JSONObject event = new JSONObject();
        event.put("game", "SSMCMOD");
        event.put("event", eventName);
        event.put("data", dataObject.toString());
        this.executePost(event.toString(), player);
    }

    private void executePost(String urlParameters, EntityPlayer player) {
        try {
            if (!this.isConnected) {
                if (System.currentTimeMillis() - this.lastTick < 5000L) {
                    return;
                }

                this.lastTick = System.currentTimeMillis();
            }

            this.isConnected = true;
            StringEntity se = new StringEntity(urlParameters);
            se.setContentType(new BasicHeader("Content-Type", "application/json"));
            this.ssePost.setEntity(se);
            HttpResponse response = this.sseClient.execute(this.ssePost);
            if (response != null) {
                this.ssePost.reset();
            }
        } catch (ConnectTimeoutException var5) {
            this.isConnected = false;
            if (player != null) {
                player.func_145747_a(new ChatComponentText("There was an error connecting to SteelSeries Engine 3"));
            }
        } catch (Exception var6) {
            ;
        }

    }

    private void ConnectToSSE3() {
        String jsonAddress = "";

        String corePropsFileName;
        BufferedReader coreProps;
        try {
            corePropsFileName = System.getenv("PROGRAMDATA") + "\\SteelSeries\\SteelSeries Engine 3\\coreProps.json";
            coreProps = new BufferedReader(new FileReader(corePropsFileName));
            jsonAddress = coreProps.readLine();
            System.out.println("Opened coreprops.json and read: " + jsonAddress);
            coreProps.close();
        } catch (FileNotFoundException var7) {
            System.out.println("coreprops.json not found (Mac check)");
        } catch (IOException var8) {
            var8.printStackTrace();
            System.out.println("Something terrible happened looking for coreProps.json");
        }

        if (jsonAddress == "") {
            try {
                corePropsFileName = "/Library/Application Support/SteelSeries Engine 3/coreProps.json";
                coreProps = new BufferedReader(new FileReader(corePropsFileName));
                jsonAddress = coreProps.readLine();
                System.out.println("Opened coreprops.json and read: " + jsonAddress);
                coreProps.close();
            } catch (FileNotFoundException var5) {
                System.out.println("coreprops.json not found (Windows check)");
            } catch (IOException var6) {
                var6.printStackTrace();
                System.out.println("Something terrible happened looking for coreProps.json");
            }
        }

        try {
            if (jsonAddress != "") {
                JSONObject obj = new JSONObject(jsonAddress);
                this.sse3Address = "http://" + obj.getString("address") + "/game_event";
            } else {
                this.sse3Address = "http://localhost:3000/game_event";
            }

            this.sseClient = HttpClients.createDefault();
            RequestConfig sseReqCfg = RequestConfig.custom().setSocketTimeout(10).setConnectTimeout(10).setConnectionRequestTimeout(50).build();
            this.ssePost = new HttpPost(this.sse3Address);
            this.ssePost.setConfig(sseReqCfg);
        } catch (JSONException var4) {
            var4.printStackTrace();
            System.out.println("Something terrible happened creating JSONObject from coreProps.json.");
        }

    }

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
    }

    @EventHandler
    public void init(FMLInitializationEvent event) {
        this.ConnectToSSE3();
    }

    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(new GameSenseEventReceiver(Minecraft.func_71410_x()));
    }
}

 

If you need any more info just tell me.

Link to comment
Share on other sites

48 minutes ago, diesieben07 said:

The mod is open source on Github. Instead of decompiling it, fork it and create a pull request with your updated code. And just randomly changing strings will not update a mod, you need to actually fix the code that is broken. Programming knowledge is required.

Alright, I will have a look into this. As I said, I'm programming, especially in java, is new to me and I'm really trying my best.

So the website says they have been porting it to 1.12.2, how can I download the new version of the mod? I don't really get how the website and all the content in the list are supposed to work. :/

Link to comment
Share on other sites

11 minutes ago, diesieben07 said:

That is a pull request, a request to merge changes into the main repository. It has not yet been merged, so there is no built version of it yet. However you might be able to clone the repository and branch that contains the pull request changes and build a version for yourself from that.

No idea how this works, I guess I need to learn a lot first before I can do this.

Do you know where I could find someone who would do this for me? Is github the only place for things like this?

Link to comment
Share on other sites

15 minutes ago, diesieben07 said:

Github is not the only place where you can host a git repository, no. But it is by far the most popular one as far as I know.

There are many people on this forum (including me) who could do this for you, the question is whether someone is willing to do it for free.

Alright thank you, I guess I need to wait till someone does it, altough its been already at least 1 month ago.

Maybe I will try to learn all this myself, but I suppose it takes a lot of time, which I don't really have. :-\

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.