Skip to content

Commit

Permalink
Replace update checker with MCLib one, fix wall creative tab
Browse files Browse the repository at this point in the history
Should've done this like a year ago lmao
closes #546 and closes #547
  • Loading branch information
Roadhog360 committed Nov 1, 2024
1 parent 28ee76c commit f8ba965
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 205 deletions.
4 changes: 2 additions & 2 deletions LATEST_VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Modrinth|GREEN|https://modrinth.com/mod/etfuturum/version/2.6.1
CurseForge|GOLD|https://legacy.curseforge.com/minecraft/mc-mods/et-futurum-requiem/files/5863598
GitHub|GRAY|https://github.com/Roadhog360/Et-Futurum-Requiem/releases/tag/2.6.1
#This file is used to store the latest version and their URLs, for the purpose of notifying users when a new update is ready.
#Each line has 3 pieces of information separated by |, first is the website name, second is its color and third is the URL.
#NO LONGER USED AS OF 2.6.2, see `updatejson/update.json`
#Will be updated temporarily for legacy purposes, may be removed in the future
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

// The planned name of the next release
def NEXT_VERSION = "2.6.1"
def NEXT_VERSION = "2.6.2"
version = NEXT_VERSION

// Append to the version as needed. If the variables look a bit strange, that's because they are -
Expand Down
21 changes: 6 additions & 15 deletions src/main/java/ganymedes01/etfuturum/EtFuturum.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import ganymedes01.etfuturum.world.nether.dimension.DimensionProviderEFRNether;
import ganymedes01.etfuturum.world.structure.OceanMonument;
import makamys.mclib.core.MCLib;
import makamys.mclib.core.MCLibModules;
import makamys.mclib.ext.assetdirector.ADConfig;
import makamys.mclib.ext.assetdirector.AssetDirectorAPI;
import net.minecraft.block.*;
Expand Down Expand Up @@ -227,25 +228,15 @@ public void preInit(FMLPreInitializationEvent event) {
networkWrapper.registerMessage(StartElytraFlyingHandler.class, StartElytraFlyingMessage.class, 6, Side.SERVER);
networkWrapper.registerMessage(AttackYawHandler.class, AttackYawMessage.class, 7, Side.CLIENT);

setupModMeta(event.getModMetadata());
String buildVer = event.getModMetadata().version;
Reference.SNAPSHOT_BUILD = buildVer.toLowerCase().contains("snapshot") || buildVer.contains("alpha") || buildVer.toLowerCase().contains("beta") || buildVer.toLowerCase().contains("rc");
if (!Reference.SNAPSHOT_BUILD && !Reference.DEV_ENVIRONMENT) {
MCLibModules.updateCheckAPI.submitModTask(Reference.MOD_ID, Reference.VERSION_URL);
}

CompatMisc.runModHooksPreInit();
}

private void setupModMeta(ModMetadata meta) {
//Define mod data here instead of in mcmod.info, adapted from Village Names.
//Thanks AstroTibs!
//Updated by Makamys to use mcmod.info again but also have color values without glitches.

meta.autogenerated = false; // stops it from complaining about missing mcmod.info

meta.name = "\u00a75\u00a7o" + meta.name; // name

String buildVer = meta.version;
Reference.SNAPSHOT_BUILD = buildVer.toLowerCase().contains("snapshot") || buildVer.contains("alpha") || buildVer.toLowerCase().contains("beta") || buildVer.toLowerCase().contains("rc");
meta.version = "\u00a7e" + meta.version; // version
}

@EventHandler
public void init(FMLInitializationEvent event) {
for (ModBlocks block : ModBlocks.values()) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/ganymedes01/etfuturum/blocks/BaseWall.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.collect.Maps;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
Expand Down Expand Up @@ -34,6 +35,7 @@ public BaseWall(Material material, String... names) {
blockMaterial = material;
this.types = names;
setNames(names[0].replace("bricks", "brick").replace("tiles", "tile") + "_wall");
setCreativeTab(EtFuturum.creativeTabBlocks);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,18 @@ public class ConfigFunctions extends ConfigBase {
public static String subtitleBlacklist;
public static String[] extraDropRawOres = new String[]{"oreCopper", "oreTin"};

static final String catUpdateChecker = "update_checker";
static final String catChanges = "changes";
static final String catSettings = "settings";
static final String catClient = "client";
static final String catCommands = "client";

public ConfigFunctions(File file) {
super(file);
setCategoryComment(catUpdateChecker, "Category solely for the update checker, to make it easier to find and disable for those who don't want it.");
setCategoryComment(catChanges, "Changes to existing content.");
setCategoryComment(catSettings, "Settings for Et Futurum content.");
setCategoryComment(catCommands, "New commands");
setCategoryComment(catClient, "Client-side settings or changes.");

configCats.add(getCategory(catUpdateChecker));
configCats.add(getCategory(catChanges));
configCats.add(getCategory(catSettings));
configCats.add(getCategory(catCommands));
Expand All @@ -193,8 +190,6 @@ public ConfigFunctions(File file) {
@Override
protected void syncConfigOptions() {
if (EtFuturumEarlyMixins.side == MixinEnvironment.Side.CLIENT) {
enableUpdateChecker = getBoolean("enableUpdateChecker", catUpdateChecker, true, "Check and print a chat message in-game if there's a new update available?");

enableAttackedAtYawFix = getBoolean("enableAttackedAtYawFix", catChanges, true, "Adds a packet to send the attackedAtYaw field value to the client, which allows the screen to tilt based on where damage came from, and either left or right for direction-less sources like drowning or burning, instead of tilting to the left no matter what.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import ganymedes01.etfuturum.configuration.configs.ConfigFunctions;
import ganymedes01.etfuturum.configuration.configs.ConfigMixins;
import ganymedes01.etfuturum.core.handlers.ClientEventHandler;
import ganymedes01.etfuturum.core.utils.VersionChecker;
import ganymedes01.etfuturum.entities.*;
import ganymedes01.etfuturum.lib.Reference;
import ganymedes01.etfuturum.lib.RenderIDs;
Expand Down Expand Up @@ -58,10 +57,6 @@ public void registerEvents() {
MinecraftForge.EVENT_BUS.register(GuiSubtitles.INSTANCE);
}

if (ConfigFunctions.enableUpdateChecker && !Reference.SNAPSHOT_BUILD && !Reference.DEV_ENVIRONMENT) {
FMLCommonHandler.instance().bus().register(VersionChecker.instance);
}

MinecraftForge.EVENT_BUS.register(BiomeFogEventHandler.INSTANCE);
}

Expand Down
176 changes: 0 additions & 176 deletions src/main/java/ganymedes01/etfuturum/core/utils/VersionChecker.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/ganymedes01/etfuturum/lib/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Reference {
public static final String VERSION_NUMBER = Tags.VERSION;
public static final boolean TESTING = Boolean.getBoolean("etfuturum.testing");
public static final boolean DEV_ENVIRONMENT = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
public static final String VERSION_URL = System.getProperty("etfuturum.versionUrl", "https://raw.githubusercontent.com/Roadhog360/Et-Futurum-Requiem/master/LATEST_VERSION");
public static final String VERSION_URL = System.getProperty("etfuturum.versionUrl", "https://raw.githubusercontent.com/Roadhog360/Et-Futurum-Requiem/master/updatejson/update.json");
public static final String MODRINTH_URL = "https://modrinth.com/mod/etfuturum";
public static final String CURSEFORGE_URL = "https://www.curseforge.com/minecraft/mc-mods/et-futurum-requiem";
public static final String GITHUB_URL = "https://github.com/Roadhog360/Et-Futurum-Requiem";
Expand Down
10 changes: 10 additions & 0 deletions updatejson/update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"homepages": {
"GitHub": "https://github.com/Roadhog360/Et-Futurum-Requiem/releases",
"Modrinth": "https://modrinth.com/mod/etfuturum/versions",
"CurseForge": "https://legacy.curseforge.com/minecraft/mc-mods/et-futurum-requiem/files"
},
"promos": {
"1.7.10-latest": "2.6.1"
}
}

0 comments on commit f8ba965

Please sign in to comment.