Skip to content

Commit

Permalink
update for 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
moehreag committed Jan 1, 2025
1 parent ed1a020 commit 8abfeed
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 29 deletions.
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ repositories {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}*/
maven {
url = "https://repo.hypixel.net/repository/Hypixel/"
content {
includeGroup("net.hypixel")
}
}
mavenLocal()
mavenCentral()
}
Expand All @@ -44,12 +50,14 @@ dependencies {

modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader}"

modCompileOnly("io.github.axolotlclient:AxolotlClient:${project.client}+${project.minecraft_18}") {
modImplementation("io.github.axolotlclient:AxolotlClient:${project.client}+${project.minecraft_18}") {
transitive = false
}
compileOnly("io.github.axolotlclient:common:${project.client}") {
implementation("io.github.axolotlclient.AxolotlClient:AxolotlClient-common:${project.client}") {
transitive = false
}
modApi("io.github.moehreag:search-in-resources:1.0.6+1.8.9")
implementation("net.hypixel:mod-api:1.0.1")
ploceus.dependOsl(project.osl)
modImplementation ("io.github.axolotlclient:AxolotlClient-config:${project.config}+${project.minecraft_18}")
include "io.github.axolotlclient:AxolotlClient-config:${project.config}+${project.minecraft_18}"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Mod Properties
version=1.0.1-ornithe
version=1.0.2-ornithe

maven_group=io.github.axolotlclient.oldanimations
archives_base_name=AxolotlClient-OldAnimations
Expand All @@ -17,4 +17,4 @@ fabric_loader=0.16.1

osl=0.16.1
config=3.0.0-beta.62
client=3.0.4
client=3.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@
package io.github.axolotlclient.oldanimations;

import io.github.axolotlclient.AxolotlClient;
import io.github.axolotlclient.AxolotlClientConfig.api.options.OptionCategory;
import io.github.axolotlclient.modules.AbstractModule;

public class AxolotlClientModule extends AbstractModule {
@Override
public void init() {
Object con = AxolotlClient.CONFIG;
try {
OptionCategory rendering = (OptionCategory) con.getClass().getField("rendering").get(con);
rendering.add(OldAnimations.getInstance().getCategory().includeInParentTree(false));
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new RuntimeException(e);
}
OldAnimations.runAfterFabricLoad(() -> AxolotlClient.CONFIG.rendering.add(OldAnimations.getInstance().getCategory()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@

package io.github.axolotlclient.oldanimations;

import io.github.axolotlclient.AxolotlClient;
import java.util.ArrayList;
import java.util.List;

import io.github.axolotlclient.AxolotlClientConfig.api.AxolotlClientConfig;
import io.github.axolotlclient.AxolotlClientConfig.api.manager.ConfigManager;
import io.github.axolotlclient.AxolotlClientConfig.api.options.OptionCategory;
import io.github.axolotlclient.AxolotlClientConfig.impl.managers.VersionedJsonConfigManager;
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
Expand All @@ -35,11 +38,10 @@ public class OldAnimations implements ClientModInitializer {
public static final String MODID = "axolotlclient-oldanimations";
public static boolean AXOLOTLCLIENT;

@Getter
private final static OldAnimations instance = new OldAnimations();
private static OldAnimations instance;

@Getter
private final OptionCategory category = OptionCategory.create(MODID);
private final OptionCategory category = OptionCategory.create(MODID).includeInParentTree(false);

public final BooleanOption enabled = new BooleanOption("enabled", true);
public final BooleanOption useAndMine = new BooleanOption("useAndMine", true);
Expand All @@ -54,10 +56,36 @@ public class OldAnimations implements ClientModInitializer {
public final BooleanOption heartFlashing = new BooleanOption("heartFlashing", true);
public final BooleanOption debugOverlay = new BooleanOption("debugOverlay", true);


private Minecraft mc;

// Since AxolotlClient may initialize this class as a module before it gets loaded as a mod by fabric we have to defer the former to run after the latter.
// But since the load order is non-deterministic this may not always be the case
private static boolean loadedByFabric;
private static final List<Runnable> tasks = new ArrayList<>();

public OldAnimations() {
if (instance != null) {
throw new IllegalStateException();
}
loadedByFabric = true;
instance = this;
tasks.forEach(Runnable::run);
tasks.clear();
}

public static OldAnimations getInstance() {
return OldAnimations.instance;
}

public static void runAfterFabricLoad(Runnable task) {
if (loadedByFabric) {
task.run();
} else tasks.add(task);
}

@Override
public void initClient() {

category.add(
enabled,
useAndMine,
Expand All @@ -72,20 +100,13 @@ public OldAnimations() {
heartFlashing,
debugOverlay
);
category.includeInParentTree(false);
AXOLOTLCLIENT = FabricLoader.getInstance().isModLoaded("axolotlclient");


if (AXOLOTLCLIENT) {
// TODO once we have 3.1.0 on the maven this can be uncommented again
//AxolotlClient.CONFIG.rendering.add(category);
}
}
AXOLOTLCLIENT = FabricLoader.getInstance().isModLoaded("axolotlclient");

@Override
public void initClient() {
AxolotlClientConfig.getInstance().register(new VersionedJsonConfigManager(FabricLoader.getInstance().getConfigDir().resolve(MODID + ".json"),
category, 1, (configVersion, configVersion1, optionCategory, jsonObject) -> jsonObject));
ConfigManager configManager = new VersionedJsonConfigManager(FabricLoader.getInstance().getConfigDir().resolve(MODID + ".json"),
category, 1, (configVersion, configVersion1, optionCategory, jsonObject) -> jsonObject);
AxolotlClientConfig.getInstance().register(configManager);
configManager.load();
}

public void tick() {
Expand All @@ -108,4 +129,5 @@ public void tick() {
}
}
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.ducks;

/* welcome back! */
Expand Down

0 comments on commit 8abfeed

Please sign in to comment.