Skip to content

Commit

Permalink
1.3.2-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Richy-Z committed May 20, 2024
1 parent 949ea2a commit 500cfc3
Show file tree
Hide file tree
Showing 20 changed files with 270 additions and 61 deletions.
17 changes: 14 additions & 3 deletions README-modrinth.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,26 @@ For a more detailed description of what this does, please visit the [GitHub repo
## ⚙️ How does it work?
ThreatenGL works its magic by tinkering with Minecraft's internals. By injecting some code into the game's graphics setup process, it convinces Minecraft to opt for OpenGL 4.6 instead of the old 3.2. This simple tweak has the *potential* to make a difference in how the game performs.

## 📥 Installing the Mod (Please read if you're using Quilt or Forge)
## 📥 Installing the Mod
Installing this mod is as simple as putting it inside the `mods` directory of Minecraft.

**Since 1.3.2-beta.1, ThreatenGL no longer requires any more additional libraries!**

<details>
<summary><b>Installing versions before 1.3.2-beta.1 (Not recommended)</b></summary>
Please note that 1.3.1-beta.1 is completely broken on all platforms, do NOT use that version.

If you really want to install an earlier version for some reason, there will be some dependencies:

- If you are using Quilt, you will have to [install the Quilted Fabric API (QFAPI)](https://modrinth.com/mod/qsl).
- If you are using Forge, you will have to [install the Architectury API for Forge](https://modrinth.com/mod/architectury-api).

Fabric and NeoForge work without any additional dependencies!
Fabric and NeoForge have always worked without any additional dependencies.
</details>

## ❗Notes
ThreatenGL has been thoroughly tested to ensure it doesn't explore your device. However, please keep in mind that this is still an experiment and the efficacy of this mod is being actively researched and discussed. While many users have seen positive results, **your** results may vary depending on your setup.

If you encounter any issues, feel free to reach out by [posting an issue on GitHub](https://github.com/Numelon-Softworks/ThreatenGL/issues) or [joining the Discord Server](https://discord.gg/3eWzyjWWJc), and I'll do my best to assist you in any way I can! :)
If you encounter any issues, feel free to reach out by [posting an issue on GitHub](https://github.com/Numelon-Softworks/ThreatenGL/issues) or [joining the Discord Server](https://discord.gg/eYEDsnKh2T), and I'll do my best to assist you in any way I can! :)

**Have a great day/night, and enjoy this mod! 😊**
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ A Minecraft Fabric, Quilt, Forge and NeoForge mod that ***threatens*** Minecraft
>
> ThreatenGL: use version 4.6... or else..! 😡🔪

<!--
TODO: Talk about how Forge and NeoForge force OpenGL 4.6. This MUST have a reason, right?
Why would some people care so much about this mod? Why the controversy?
-->
## 🤨 Purpose of this mod
ThreatenGL aims to explore the ***potential*** performance benefits of encouraging Minecraft to use OpenGL 4.6 instead of 3.2. While traditional wisdom may suggest that OpenGL versions are merely indicative of GPU capabilities (and I do agree), users have reported tangible performance improvements with ThreatenGL.

Expand All @@ -36,11 +41,22 @@ This injected code intercepts the `glfwWindowHint` method of the GLFW library us

When the `glfwWindowHint` method is called by Minecraft, this mod checks whether the OpenGL version is being set. If so, then we manually override this version to be set to 4.6.

## 📥 Installing the Mod (Please read if you're using Quilt or Forge)
## 📥 Installing the Mod
Installing this mod is as simple as putting it inside the `mods` directory of Minecraft.

**Since 1.3.2-beta.1, ThreatenGL no longer requires any more additional libraries!**

<details>
<summary><b>Installing versions before 1.3.2-beta.1 (Not recommended)</b></summary>
Please note that 1.3.1-beta.1 is completely broken on all platforms, do NOT use that version.

If you really want to install an earlier version for some reason, there will be some dependencies:

- If you are using Quilt, you will have to [install the Quilted Fabric API (QFAPI)](https://modrinth.com/mod/qsl).
- If you are using Forge, you will have to [install the Architectury API for Forge](https://modrinth.com/mod/architectury-api).

Fabric and NeoForge work without any additional dependencies!
Fabric and NeoForge have always worked without any additional dependencies.
</details>

## ❗Notes
This mod has undergone extensive testing to ensure that it is stable and won't explode your device. There are no issues so far, however, it is important to note that this is an experiment, as we are threatening Minecraft to use an OpenGL version that it is clearly not meant to run. ~~Mojang has their reasons for still using OpenGL 3.2, even in Minecraft 1.21 in 2024, but I don't really agree with them (mainly because I'm unaffected by the lack of backwards compatibility with newer OpenGL versions)~~
Expand Down
20 changes: 10 additions & 10 deletions common/src/main/java/com/numelon/threatengl/ThreatenGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import dev.architectury.platform.Platform;
import dev.architectury.utils.Env;
// This was used as a platform agnostic way of checking the environment. Caused dependency issues for all.
//import dev.architectury.platform.Platform;
//import dev.architectury.utils.Env;

import org.lwjgl.glfw.GLFW;

Expand All @@ -14,17 +15,16 @@ public final class ThreatenGL {
public static final Logger LOGGER = LogManager.getLogger("ThreatenGL");

public static void init() {
// Write common init code here.

// just in case someone somehow forces this mod to run on servers despite the configuration specifying client only
if (Platform.getEnvironment() == Env.SERVER) {
LOGGER.info((char)27 + "[31mThreatenGL WILL NOT work on servers! It is a client-side mod ONLY! Please remove it from the server mods folder." + (char)27 + "[0m");
return;
}

// Common initialisation code: Shared across all mod loaders where init is called
LOGGER.info("Hark! This numelon mod doth seem to toil as expected! O, dear sire, rejoice! How tremendous!");

LOGGER.info("ThreatenGL will threaten Minecraft soon...");
LOGGER.info("Using GLFW Version " + GLFW.glfwGetVersionString() + ", not to be confused with OpenGL version.");
}

public static void warnServer() {
// moved the warning to here so that the message doesn't have to be manually changed for each platform
// it was causinf dependency issues on all platforms too when in the main init, as it depended on the architectury api to provide platform agnostic environment detection
LOGGER.info((char)27 + "[31mThreatenGL WILL NOT work on servers! It is a client-side mod ONLY! Please remove it from the server mods folder." + (char)27 + "[0m");
}
}
3 changes: 2 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"

// Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
// commented out to remove any dependencies. self sufficiency.
//modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"

common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import net.fabricmc.api.ModInitializer;

import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.api.EnvType;

import com.numelon.threatengl.ThreatenGL;

public final class ThreatenGLFabric implements ModInitializer {
Expand All @@ -11,7 +14,12 @@ public void onInitialize() {
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

// Run our common setup.
ThreatenGL.init();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
ThreatenGL.warnServer();
return;
}

// Moved to ThreatenGLFabricClient.java for client only run
//ThreatenGL.init();
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
/*package com.numelon.threatengl.fabric.client;
package com.numelon.threatengl.fabric.client;

import net.fabricmc.api.ClientModInitializer;

import com.numelon.threatengl.ThreatenGL;

public final class ThreatenGLFabricClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.

// Initialise on client only
ThreatenGL.init();
}
}*/
}
7 changes: 5 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@
"sources": "https://github.com/Numelon-Softworks/ThreatenGL",
"issues": "https://github.com/Numelon-Softworks/ThreatenGL/issues",

"discord": "https://discord.gg/3eWzyjWWJc",
"discord": "https://discord.gg/eYEDsnKh2T",
"twitter": "https://twitter.com/Numelons"
},

"icon": "threatengl-icon-notext-128.png",

"environment": "client",
"entrypoints": {
"main": ["com.numelon.threatengl.fabric.ThreatenGLFabric"]
"main": ["com.numelon.threatengl.fabric.ThreatenGLFabric"],
"client": [
"com.numelon.threatengl.fabric.client.ThreatenGLFabricClient"
]
},
"mixins": ["threatengl.mixins.json"],

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
package com.numelon.threatengl.forge;

import dev.architectury.platform.forge.EventBuses;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
// import dev.architectury.platform.forge.EventBuses;
// import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.api.distmarker.Dist;

import com.numelon.threatengl.ThreatenGL;

@Mod(ThreatenGL.MOD_ID)
public final class ThreatenGLForge {
public ThreatenGLForge() {
// Commented out to reduce dependance on the Architectury API. We won't be handling events with this mod anyways, so it was useless and an uncecessary import and mod dependancy.
// This means that we will NOT be able to listen for events in our common code, but who cares. Just uncomment later if needed.

// Submit our event bus to let Architectury API register our content on the right time.
EventBuses.registerModEventBus(ThreatenGL.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());
//EventBuses.registerModEventBus(ThreatenGL.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());

if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
ThreatenGL.warnServer();
return;
}

// Run our common setup.
ThreatenGL.init();
Expand Down
12 changes: 6 additions & 6 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ versionRange = "[1.17,)"
ordering = "NONE"
side = "CLIENT"

[[dependencies.threatengl]]
modId = "architectury"
mandatory = true
#[[dependencies.threatengl]]
#modId = "architectury"
#mandatory = false
# architectury api 2.10.12 is the last version to support minecraft 1.17.1
# versionRange = "[11.1.17,)"
versionRange = "[2.10.12,)"
ordering = "AFTER"
side = "CLIENT"
#versionRange = "[2.10.12,)"
#ordering = "AFTER"
#side = "CLIENT"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true

# Mod properties
mod_version = 1.3.1-beta.1
mod_version = 1.3.2-beta.1
maven_group = com.numelon.threatengl
archives_name = threatengl
enabled_platforms = fabric,forge,neoforge,quilt
Expand Down
8 changes: 7 additions & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ dependencies {
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"

// Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation "dev.architectury:architectury-neoforge:$rootProject.architectury_api_version"
// commented out to remove architectury api dependency. self sufficiency.
//modImplementation "dev.architectury:architectury-neoforge:$rootProject.architectury_api_version"

common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
Expand All @@ -44,6 +45,11 @@ dependencies {
processResources {
inputs.property 'version', project.version

filesMatching('META-INF/mods.toml') {
expand version: project.version
}

// this will be used when one day the mod will be used with 1.20.6
filesMatching('META-INF/neoforge.mods.toml') {
expand version: project.version
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

import net.neoforged.fml.common.Mod;

import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.api.distmarker.Dist;

import com.numelon.threatengl.ThreatenGL;

@Mod(ThreatenGL.MOD_ID)
public final class ThreatenGLNeoForge {
public ThreatenGLNeoForge() {
if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) {
ThreatenGL.warnServer();
return;
}

// Run our common setup.
ThreatenGL.init();
}
Expand Down
46 changes: 46 additions & 0 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
modLoader = "javafml"
loaderVersion = "[2,)"
issueTrackerURL = "https://github.com/Numelon-Softworks/ThreatenGL/issues"
license = "Unknown"

[[mods]]
modId = "threatengl"
version = "${version}"
displayName = "ThreatenGL"
authors = "Richy Z, Numelon"
description = '''
Threatens Minecraft to use a different version of OpenGL.
'''
logoFile = "threatengl-icon-notext-128.png"
modUrl = "https://modrinth.com/mod/threatengl"
displayURL = "https://modrinth.com/mod/threatengl"

[[dependencies.threatengl]]
modId = "neoforge"
type = "required"
# 1.20.1 has the old Forge Mod Loader versioning system
# 1.20.1 has 40* version naming, whereas 1.20.2 has 20.2.* and 1.20.3 has 20.3.* etc
# Therefore we have to specify [20,) instead of [40,) otherwise that will invalidate future Minecraft releases and future NeoForge loader releases who have the new versioning system instead of the fml versioning system
versionRange = "[20,)"
ordering = "NONE"
side = "CLIENT"

[[dependencies.threatengl]]
modId = "minecraft"
type = "required"
# Note that NeoForged was created in July 2023 and thus does not have support before Minecraft 1.20.1
versionRange = "[1.20.1,)"
ordering = "NONE"
side = "CLIENT"

#[[dependencies.threatengl]]
#modId = "architectury"
#type = "optional"
# NeoForge specific versions of architectury arent available for 1.20.1
# however Forge specific versions are, and this is the last version supporting 1.20.1
#versionRange = "[9.2.14,)"
#ordering = "AFTER"
#side = "CLIENT"

[[mixins]]
config = "threatengl.mixins.json"
12 changes: 6 additions & 6 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ versionRange = "[1.20.1,)"
ordering = "NONE"
side = "CLIENT"

[[dependencies.threatengl]]
modId = "architectury"
type = "optional"
#[[dependencies.threatengl]]
#modId = "architectury"
#type = "optional"
# NeoForge specific versions of architectury arent available for 1.20.1
# however Forge specific versions are, and this is the last version supporting 1.20.1
versionRange = "[9.2.14,)"
ordering = "AFTER"
side = "CLIENT"
#versionRange = "[9.2.14,)"
#ordering = "AFTER"
#side = "CLIENT"

[[mixins]]
config = "threatengl.mixins.json"
5 changes: 3 additions & 2 deletions quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ dependencies {
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:$rootProject.quilted_fabric_api_version"

// Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation("dev.architectury:architectury-fabric:$rootProject.architectury_api_version") {
// commented out to reduce dependance on the architectury api. self sufficiency.
/* modImplementation("dev.architectury:architectury-fabric:$rootProject.architectury_api_version") {
// We must not pull Fabric Loader and Fabric API from Architectury Fabric.
exclude group: 'net.fabricmc'
exclude group: 'net.fabricmc.fabric-api'
}
} */

common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionQuilt')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
package com.numelon.threatengl.quilt;

import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
import org.quiltmc.loader.api.ModContainer;

import com.numelon.threatengl.ThreatenGL;

import net.fabricmc.api.EnvType;
import org.quiltmc.loader.api.minecraft.MinecraftQuiltLoader;

public final class ThreatenGLQuilt implements ModInitializer {
@Override
public void onInitialize(ModContainer mod) {
// Run our common setup.

if (MinecraftQuiltLoader.getEnvironmentType() == EnvType.SERVER) {
ThreatenGL.warnServer();
return;
}

// moved to client initialiser
ThreatenGL.init();
}
}
Loading

0 comments on commit 500cfc3

Please sign in to comment.