Skip to content

Commit

Permalink
check moreculling version
Browse files Browse the repository at this point in the history
  • Loading branch information
isXander committed Jul 10, 2022
1 parent 55112fc commit 32de9be
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
14 changes: 8 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ plugins {

id("com.modrinth.minotaur") version "2.+"
id("com.matthewprenger.cursegradle") version "1.+"
id("com.github.breadmoirai.github-release") version "2.3.+"
id("com.github.breadmoirai.github-release") version "2.4.+"
`maven-publish`

id("io.github.p03w.machete") version "1.+"
}

group = "dev.isxander"
version = "1.0.2"
version = "1.0.3"

repositories {
mavenCentral()
Expand Down Expand Up @@ -41,7 +41,7 @@ dependencies {
modImplementation("me.shedaniel.cloth:cloth-config-fabric:7.+") {
exclude(module = "fabric-api")
}
modImplementation("com.terraformersmc:modmenu:4.+")
modImplementation("com.terraformersmc:modmenu:4.0.0")

"com.github.llamalad7:mixinextras:0.0.+".let {
implementation(it)
Expand All @@ -53,7 +53,7 @@ dependencies {
modImplementation("me.jellysquid.mods:sodium-fabric:0.4.2+build.+")

// more culling compat
modImplementation("com.github.fxmorin.MoreCulling:moreculling:v0.3.1")
modImplementation("com.github.fxmorin.MoreCulling:moreculling:v0.5.0")
"com.github.Fallen-Breath:conditional-mixin:v0.3.0".let {
modImplementation(it)
include(it)
Expand Down Expand Up @@ -165,8 +165,8 @@ githubRelease {
publishing {
publications {
create<MavenPublication>("mod") {
groupId = group.toString()
artifactId = base.archivesName.get()
groupId = "dev.isxander"
artifactId = "cull-less-leaves"

from(components["java"])
}
Expand All @@ -180,6 +180,8 @@ publishing {
password = property("xander-repo.password")?.toString()
}
}
} else {
println("Xander Repo not available!")
}
}
}
1 change: 1 addition & 0 deletions changelogs/1.0.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- MoreCulling compatibility
16 changes: 16 additions & 0 deletions src/main/java/dev/isxander/culllessleaves/CullLessLeaves.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.VersionParsingException;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
import net.fabricmc.loader.impl.FormattedException;
import net.fabricmc.loader.impl.util.version.VersionPredicateParser;
import net.minecraft.block.LeavesBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
Expand All @@ -15,6 +19,18 @@
public class CullLessLeaves implements ClientModInitializer, PreLaunchEntrypoint {
@Override
public void onInitializeClient() {
FabricLoader.getInstance().getModContainer("moreculling").ifPresent((mod) -> {
try {
var predicate = VersionPredicateParser.parse(">=0.5.0");
if (!predicate.test(mod.getMetadata().getVersion())) {
throw new FormattedException("Incompatible mod set!", "moreculling is present but does not match " + predicate);
}
} catch (VersionParsingException e) {
e.printStackTrace();
}

});

AutoConfig.register(CullLessLeavesConfig.class, Toml4jConfigSerializer::new);
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
"fabricloader": ">=0.14.0",
"minecraft": "1.19.x",
"java": ">=17"
},
"suggests": {
"sodium": "*"
}
}

0 comments on commit 32de9be

Please sign in to comment.