Skip to content

Commit

Permalink
feat: 1.0.6 - small feature changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed Mar 17, 2024
1 parent 1e5f377 commit 160dc60
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 23 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
- Update icon.
- Fix a typo in the mod renaming warning.
- Add a few new methods to the `JamLibPlatform.Platform` enum.
- `JamLib` is no longer entirely `ApiStatus.Internal` (there are some stable API methods in there. Non-stable public internal methods are annotated as such).
- Build system improvements.
- Update the icon again.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 Jamalam
Copyright 2024 Jamalam

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "com.github.breadmoirai.github-release" version "2.4.1"
id "maven-publish"
}
Expand Down
8 changes: 6 additions & 2 deletions common/src/main/java/io/github/jamalam360/jamlib/JamLib.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.jamalam360.jamlib;

import dev.architectury.event.events.client.ClientPlayerEvent;
import dev.architectury.platform.Platform;
import dev.architectury.utils.EnvExecutor;
import net.fabricmc.api.EnvType;
import net.minecraft.client.Minecraft;
Expand All @@ -11,13 +12,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ApiStatus.Internal
public class JamLib {
public static final String MOD_ID = "jamlib";
public static final String MOD_NAME = "JamLib";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);
private static final JarRenamingChecker JAR_RENAMING_CHECKER = new JarRenamingChecker();

@ApiStatus.Internal
public static void init() {
LOGGER.info("Initializing JamLib on " + JamLibPlatform.getPlatform());
checkForJarRenaming(JamLib.class);
Expand All @@ -26,7 +27,9 @@ public static void init() {
}

public static void checkForJarRenaming(Class<?> anyModClass) {
JAR_RENAMING_CHECKER.checkJar(anyModClass);
if (!Platform.isDevelopmentEnvironment()) {
JAR_RENAMING_CHECKER.checkJar(anyModClass);
}
}

private static void onPlayerJoin(LocalPlayer player) {
Expand All @@ -50,6 +53,7 @@ private static void onPlayerJoin(LocalPlayer player) {
JAR_RENAMING_CHECKER.afterNotify();
}

@ApiStatus.Internal
public static ResourceLocation id(String path) {
return new ResourceLocation(MOD_ID, path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ public enum Platform {
NEOFORGE,
QUILT;

public boolean isFabric() {
return this == FABRIC;
}

public boolean isForge() {
return this == FORGE;
}

public boolean isNeoForge() {
return this == NEOFORGE;
}

public boolean isQuilt() {
return this == QUILT;
}

public boolean isFabricLike() {
return this == FABRIC || this == QUILT;
}

public boolean isForgeLike() {
return this == FORGE || this == NEOFORGE;
}

@Override
public String toString() {
return switch (this) {
Expand Down
Binary file modified common/src/main/resources/assets/jamlib/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions common/src/main/resources/assets/jamlib/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"config.jamlib.requires_restart_tooltip": "A restart is required for this change to take effect",
"config.jamlib.within_range_tooltip": "Value should be between %d and %d",
"text.jamlib.renamed_1": "The following files seem to have been renamed - this is often a sign of a mod being redistributed without permission.",
"text.jamlib.renamed_2": "Sites such as minecraft harm modders and can be used to distribute malware. Please use official sources such as Curseforge or Modrinth!",
"text.jamlib.renamed_2": "Sites such as 9minecraft harm modders and can be used to distribute malware. Please use official sources such as Curseforge or Modrinth!",
"text.jamlib.renamed_3": "This message will only appear once. If you believe this is a false positive, please contact the mod author."

}
8 changes: 7 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ publishing {

processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"fabric_api_version": libs.versions.fabric.api.get(),
"architectury_version": libs.versions.architectury.get()
}

inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "fabric_api_version", libs.versions.fabric.api.get()
inputs.property "architectury_version", libs.versions.architectury.get()
}

shadowJar {
Expand Down
6 changes: 3 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"mixins": [
],
"depends": {
"fabric": "*",
"minecraft": ">=1.20.4",
"architectury": ">=11.0.9"
"fabric": ">=${fabric_api_version}",
"minecraft": ">=${minecraft_version}",
"architectury": ">=${architectury_version}"
}
}
10 changes: 10 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ publishing {
}
}

processResources {
filesMatching("mods.toml") {
expand "minecraft_version": project.minecraft_version,
"architectury_version": libs.versions.architectury.get()
}

inputs.property "minecraft_version", project.minecraft_version
inputs.property "architectury_version", libs.versions.architectury.get()
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
Expand Down
4 changes: 2 additions & 2 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ side = "BOTH"
[[dependencies.jamlib]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.4,)"
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"

[[dependencies.jamlib]]
modId = "architectury"
mandatory = true
versionRange = "[11.0.9,)"
versionRange = "[${architectury_version},)"
ordering = "AFTER"
side = "BOTH"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.parallel=true
version=1.0.5+1.20.4
version=1.0.6+1.20.4
minecraft_version=1.20.4
branch=main
group=io.github.jamalam360
Expand Down
10 changes: 10 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ publishing {
}
}

processResources {
filesMatching("mods.toml") {
expand "minecraft_version": project.minecraft_version,
"architectury_version": libs.versions.architectury.get()
}

inputs.property "minecraft_version", project.minecraft_version
inputs.property "architectury_version", libs.versions.architectury.get()
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"
Expand Down
4 changes: 2 additions & 2 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ side = "BOTH"
[[dependencies.jamlib]]
modId = "minecraft"
type = "required"
versionRange = "[1.20.4,)"
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"

[[dependencies.jamlib]]
modId = "architectury"
type = "required"
versionRange = "[11.0.9,)"
versionRange = "[${architectury_version},)"
ordering = "AFTER"
side = "BOTH"
6 changes: 5 additions & 1 deletion quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ publishing {

processResources {
filesMatching("quilt.mod.json") {
expand "version": project.version
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"architectury_version": libs.versions.architectury.get()
}

inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "architectury_version", libs.versions.architectury.get()
}

shadowJar {
Expand Down
8 changes: 2 additions & 6 deletions quilt/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@
]
},
"depends": [
{
"id": "quilt_loader",
"version": "*"
},
{
"id": "quilt_base",
"version": "*"
},
{
"id": "minecraft",
"version": ">=1.20.4"
"version": ">=${minecraft_version}"
},
{
"id": "architectury",
"version": ">=11.0.9"
"version": ">=${architectury_version}"
}
]
},
Expand Down

0 comments on commit 160dc60

Please sign in to comment.