diff options
author | ILikePlayingGames <22475143+ILikePlayingGames@users.noreply.github.com> | 2024-07-31 06:55:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-31 11:55:08 +0100 |
commit | d68bf1c7b51e0d6335f9439818e6effd5f9ae501 (patch) | |
tree | bb2823ef29c1745a5c800897849545947810fadb | |
parent | 3a60715b57d9af5ad63d20465504214979a7c85d (diff) | |
download | HyPixelForgeModAPI-d68bf1c7b51e0d6335f9439818e6effd5f9ae501.tar.gz HyPixelForgeModAPI-d68bf1c7b51e0d6335f9439818e6effd5f9ae501.tar.bz2 HyPixelForgeModAPI-d68bf1c7b51e0d6335f9439818e6effd5f9ae501.zip |
Various build script improvements (#6)
- Add DevAuth for logging into online mode servers (disabled by default)
- Fill in mod version during build in ForgeModAPI.java
- Fix gradle running out of memory during `gradlew setupDecompWorkspace`
- Add some development tips to README.md
- Change logging to log4j in ForgeModAPI.java
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | build.gradle | 7 | ||||
-rw-r--r-- | gradle.properties | 2 | ||||
-rw-r--r-- | src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java | 12 |
4 files changed, 25 insertions, 7 deletions
@@ -5,4 +5,13 @@ This repository contains the implementation of the Hypixel Mod API for the Froge ## Contributing -If you wish to contribute to this implementation of the Mod API to offer improvements or fixes, you can do so by forking the repository and creating a pull request.
\ No newline at end of file +If you wish to contribute to this implementation of the Mod API to offer improvements or fixes, you can do so by forking the repository and creating a pull request. + +> [!IMPORTANT] +> Run `gradlew setupDecompWorkspace` after importing the project to generate the files required to build it + +If IntelliJ still shows unknown symbol errors after running the command, you may need to [clear the filesystem cache](https://www.jetbrains.com/help/idea/invalidate-caches.html). + +### Testing Your Changes + +You can enable DevAuth to log in to the Hypixel server with your Minecraft account. Please see the [DevAuth docs](https://github.com/DJtheRedstoner/DevAuth) for more details.
\ No newline at end of file diff --git a/build.gradle b/build.gradle index b6ba6fd..e198753 100755 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,9 @@ repositories { maven { url "https://repo.hypixel.net/repository/Hypixel/" } + maven { + url "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1" + } mavenLocal() } @@ -31,6 +34,9 @@ minecraft { runDir = "run" mappings = "stable_22" + + replace('${version}', project.version) + replaceIn("ForgeModAPI.java") } configurations { @@ -40,6 +46,7 @@ configurations { dependencies { shade "net.hypixel:mod-api:1.0" + runtimeOnly "me.djtheredstoner:DevAuth-forge-legacy:1.2.1" } jar { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..fbb5570 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +# Ensure Gradle has enough RAM to decompile Minecraft +org.gradle.jvmargs=-Xmx2G
\ No newline at end of file diff --git a/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java b/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java index c7c31c2..282408c 100644 --- a/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java +++ b/src/main/java/net/hypixel/modapi/forge/ForgeModAPI.java @@ -20,14 +20,14 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent; -import java.util.logging.Level; -import java.util.logging.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; @Mod(modid = ForgeModAPI.MODID, version = ForgeModAPI.VERSION, clientSideOnly = true, name = "Hypixel Mod API") public class ForgeModAPI { public static final String MODID = "hypixel_mod_api"; - public static final String VERSION = "1.0.0.1"; - private static final Logger LOGGER = Logger.getLogger("HypixelModAPI"); + public static final String VERSION = "${version}"; + private static final Logger LOGGER = LogManager.getLogger("HypixelModAPI"); // We store a local reference to the net handler, so it's instantly available from the moment we connect private NetHandlerPlayClient netHandler; @@ -55,7 +55,7 @@ public class ForgeModAPI { } if (!netHandler.getNetworkManager().isChannelOpen()) { - LOGGER.warning("Attempted to send packet while channel is closed!"); + LOGGER.warn("Attempted to send packet while channel is closed!"); netHandler = null; return false; } @@ -91,7 +91,7 @@ public class ForgeModAPI { try { HypixelModAPI.getInstance().handle(identifier, new PacketSerializer(buffer)); } catch (Exception e) { - LOGGER.log(Level.WARNING, "Failed to handle packet " + identifier, e); + LOGGER.warn("Failed to handle packet {}", identifier, e); } finally { buffer.release(); } |