From b043e75245429a2b6ee1402cee826fcec8f7af04 Mon Sep 17 00:00:00 2001 From: makamys Date: Tue, 21 Jun 2022 09:21:26 +0200 Subject: Add update check via MCLib --- gradle.properties | 1 + makalibs.gradle | 19 +++++++++++++++++++ project.gradle | 2 ++ src/main/java/makamys/neodymium/Neodymium.java | 9 +++++++++ updatejson/update.json | 9 +++++++++ 5 files changed, 40 insertions(+) create mode 100644 makalibs.gradle create mode 100644 updatejson/update.json diff --git a/gradle.properties b/gradle.properties index a8e70f2..28ac386 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,7 @@ group=makamys.neodymium # Forge properties minecraft_version=1.7.10 forge_version=10.13.4.1614-1.7.10 +update_url=https://raw.githubusercontent.com/makamys/neodymium/master/updatejson/update.json enable_mixin=true multiproject_structure=false diff --git a/makalibs.gradle b/makalibs.gradle new file mode 100644 index 0000000..1460a57 --- /dev/null +++ b/makalibs.gradle @@ -0,0 +1,19 @@ +/* Common code in my projects using my libraries */ + +repositories { + maven { url 'https://jitpack.io' } +} + +minecraft { + srgExtra "PK: makamys/mclib makamys/${project.modid}/repackage/makamys/mclib" +} + +dependencies { + shade('com.github.makamys:MCLib:0.3.3'){ + exclude group: "codechicken" + } +} + +minecraft { + replace '@UPDATE_URL@', project.update_url +} diff --git a/project.gradle b/project.gradle index c25475a..ed0b64a 100644 --- a/project.gradle +++ b/project.gradle @@ -5,3 +5,5 @@ jar { ) } } + +apply from: "makalibs.gradle" diff --git a/src/main/java/makamys/neodymium/Neodymium.java b/src/main/java/makamys/neodymium/Neodymium.java index 2b4ab75..d70330a 100644 --- a/src/main/java/makamys/neodymium/Neodymium.java +++ b/src/main/java/makamys/neodymium/Neodymium.java @@ -14,12 +14,15 @@ import org.lwjgl.input.Keyboard; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.event.FMLConstructionEvent; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import makamys.mclib.core.MCLib; +import makamys.mclib.core.MCLibModules; import makamys.neodymium.renderer.NeoRenderer; import makamys.neodymium.util.SpriteUtil; import net.minecraft.client.Minecraft; @@ -50,9 +53,15 @@ public class Neodymium public static boolean ofFastRender; private static Method ofIsFastRenderMethod; + @EventHandler + public void preInit(FMLConstructionEvent event) { + MCLib.init(); + } + @EventHandler public void preInit(FMLPreInitializationEvent event) { + MCLibModules.updateCheckAPI.submitModTask(MODID, "@UPDATE_URL@"); Config.reloadConfig(); } diff --git a/updatejson/update.json b/updatejson/update.json new file mode 100644 index 0000000..55309d7 --- /dev/null +++ b/updatejson/update.json @@ -0,0 +1,9 @@ +{ + "homepage": "https://github.com/makamys/neodymium/releases", + "1.7.10": { + "0.1": "" + }, + "promos": { + "1.7.10-latest": "0.1" + } +} \ No newline at end of file -- cgit