-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da085a7
commit 0ebc25a
Showing
7 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
22 changes: 22 additions & 0 deletions
22
src/main/java/me/ghosttypes/orion/mixins/TitleScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.ghosttypes.orion.mixins; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import net.minecraft.client.gui.screen.TitleScreen; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
|
||
import me.ghosttypes.orion.utils.UpdateUtil; | ||
import meteordevelopment.meteorclient.utils.network.MeteorExecutor; | ||
|
||
@Mixin(value = TitleScreen.class) | ||
public class TitleScreenMixin { | ||
@Inject(method = "render", at = @At("TAIL")) | ||
private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) { | ||
MeteorExecutor.execute(() -> { | ||
UpdateUtil.checkUpdate(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package me.ghosttypes.orion.utils; | ||
|
||
import com.google.gson.JsonObject; | ||
import net.minecraft.item.Items; | ||
|
||
import net.fabricmc.loader.api.FabricLoader; | ||
import me.ghosttypes.orion.Orion; | ||
import meteordevelopment.meteorclient.utils.network.Http; | ||
import meteordevelopment.meteorclient.utils.render.MeteorToast; | ||
|
||
import static meteordevelopment.meteorclient.MeteorClient.mc; | ||
|
||
public class UpdateUtil { | ||
private static boolean firstTimeTitleScreen = true; | ||
private static final String TAGNAME = "latest-1.18"; | ||
|
||
public static void checkUpdate() { | ||
if (!firstTimeTitleScreen) return; | ||
firstTimeTitleScreen = false; | ||
|
||
Orion.LOG.info("Checking for Orion update..."); | ||
|
||
String gitHash = FabricLoader | ||
.getInstance() | ||
.getModContainer("orion") | ||
.get().getMetadata() | ||
.getCustomValue("updater:sha") | ||
.getAsString().trim(); | ||
|
||
JsonObject tag = Http.get("https://api.github.com/repos/AntiCope/orion/git/ref/tags/"+TAGNAME).sendJson(JsonObject.class); | ||
if (tag.get("object").getAsJsonObject().get("sha").getAsString().trim().equals(gitHash)) return; | ||
|
||
mc.getToastManager().add(new MeteorToast(Items.OBSIDIAN, "New Orion update.", "Download it from Github", 8000)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters