Skip to content

Commit

Permalink
1.20.2 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGravyBoat committed Nov 20, 2023
1 parent 0204c54 commit fa18489
Show file tree
Hide file tree
Showing 35 changed files with 660 additions and 59 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Upload Forge Releases (Curse/Modrinth/Github)
id: forge_release
if: contains(steps.properties.outputs.enabledPlatforms, 'forge')
uses: Kir-Antipov/mc-publish@v3.2
uses: Kir-Antipov/mc-publish@v3.3
with:
curseforge-id: ${{ vars.CURSE_ID }}
curseforge-token: ${{ secrets.CURSE_TOKEN }}
Expand All @@ -57,10 +57,30 @@ jobs:
game-versions: ${{ steps.properties.outputs.minecraftVersion }}
version-resolver: exact

- name: Upload NeoForge Releases (Curse/Modrinth/Github)
id: neoforge_release
if: contains(steps.properties.outputs.enabledPlatforms, 'neoforge')
uses: Kir-Antipov/[email protected]
with:
curseforge-id: ${{ vars.CURSE_ID }}
curseforge-token: ${{ secrets.CURSE_TOKEN }}

modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

files: ./neoforge/build/libs/!(*-@(dev|sources|dev-shadow)).jar
name: "[NeoForge] Athena ${{ steps.properties.outputs.version }}"
version: ${{ steps.properties.outputs.version }}
version-type: release
changelog-file: changelog.md
loaders: forge
game-versions: ${{ steps.properties.outputs.minecraftVersion }}
version-resolver: exact

- name: Upload Fabric Releases (Curse/Modrinth/Github)
id: fabric_release
if: contains(steps.properties.outputs.enabledPlatforms, 'fabric')
uses: Kir-Antipov/mc-publish@v3.2
uses: Kir-Antipov/mc-publish@v3.3
with:
curseforge-id: ${{ vars.CURSE_ID }}
curseforge-token: ${{ secrets.CURSE_TOKEN }}
Expand All @@ -80,8 +100,9 @@ jobs:
- name: Generate Discord Embed
run: ./gradlew injectEmbed
env:
FORGE_RELEASE_URL: ${{ steps.forge_release.outputs.modrinth-url }}
FABRIC_RELEASE_URL: ${{ steps.fabric_release.outputs.modrinth-url }}
FORGE_RELEASE_URL: ${{ steps.forge_release.outputs.modrinth-version }}
FABRIC_RELEASE_URL: ${{ steps.fabric_release.outputs.modrinth-version }}
NEOFORGE_RELEASE_URL: ${{ steps.neoforge_release.outputs.modrinth-version }}

- name: Upload Discord Embed
uses: tsickert/[email protected]
Expand Down
14 changes: 12 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
java
id("maven-publish")
id("com.teamresourceful.resourcefulgradle") version "0.0.+"
id("dev.architectury.loom") version "1.2-SNAPSHOT" apply false
id("dev.architectury.loom") version "1.4-SNAPSHOT" apply false
id("architectury-plugin") version "3.4-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
}
Expand Down Expand Up @@ -40,12 +40,13 @@ subprojects {
repositories {
maven(url = "https://maven.architectury.dev/")
maven(url = "https://maven.minecraftforge.net/")
maven(url = "https://maven.neoforged.net/releases/")
maven(url = "https://maven.msrandom.net/repository/root")
maven(url = "https://maven.resourcefulbees.com/repository/maven-public/")
}

dependencies {
"minecraft"("::${minecraftVersion}")
"minecraft"("::$minecraftVersion")
"mappings"(project.the<LoomGradleExtensionAPI>().officialMojangMappings())
}

Expand All @@ -61,6 +62,13 @@ subprojects {
archiveClassifier.set(null as String?)
}

tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
filesMatching(listOf("META-INF/mods.toml", "fabric.mod.json")) {
expand("version" to project.version)
}
}

if (!isCommon) {
configure<ArchitectPluginExtension> {
platformSetupLoomIde()
Expand Down Expand Up @@ -128,6 +136,7 @@ resourcefulGradle {
val changelog: String = file("changelog.md").readText(Charsets.UTF_8)
val fabricLink: String? = System.getenv("FABRIC_RELEASE_URL")
val forgeLink: String? = System.getenv("FORGE_RELEASE_URL")
val neoforgeLink: String? = System.getenv("NEOFORGE_RELEASE_URL")

source.set(file("templates/embed.json.template"))
injectedValues.set(mapOf(
Expand All @@ -136,6 +145,7 @@ resourcefulGradle {
"changelog" to StringEscapeUtils.escapeJava(changelog),
"fabric_link" to fabricLink,
"forge_link" to forgeLink,
"neoforge_link" to neoforgeLink,
))
}
}
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Fixed lighting issues
- 1.20.2 Update
- Added support for NeoForge
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package earth.terrarium.athena.api.client.forge;
package earth.terrarium.athena.api.client.utils;

import com.google.gson.JsonObject;
import earth.terrarium.athena.api.client.models.AthenaBlockModel;
import earth.terrarium.athena.api.client.models.AthenaModelFactory;
import earth.terrarium.athena.impl.loading.AthenaDataLoader;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.Nullable;

import java.util.function.Function;
import java.util.function.Supplier;

public class AthenaUnbakedModelLoader {

private final ResourceLocation id;
private final AthenaModelFactory factory;
private final Function<Supplier<AthenaBlockModel>, UnbakedModel> loader;

public AthenaUnbakedModelLoader(ResourceLocation id, AthenaModelFactory factory) {
public AthenaUnbakedModelLoader(ResourceLocation id, AthenaModelFactory factory, Function<Supplier<AthenaBlockModel>, UnbakedModel> loader) {
this.id = id;
this.factory = factory;
this.loader = loader;
}

public @Nullable UnbakedModel loadModel(ModelResourceLocation modelId) {
Expand All @@ -26,7 +32,7 @@ public AthenaUnbakedModelLoader(ResourceLocation id, AthenaModelFactory factory)

public UnbakedModel loadModel(JsonObject json) {
if (json != null) {
return new AthenaUnbakedModel(this.factory.create(json));
return this.loader.apply(this.factory.create(json));
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package earth.terrarium.athena.api.client.utils.forge;
package earth.terrarium.athena.api.client.utils;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -8,7 +8,7 @@

public class NullableEnumMap<K extends Enum<K>, V> implements Map<K, V> {

public final MapEntry empty = new MapEntry(null);
private final MapEntry empty = new MapEntry(null);

private final Class<K> enumClass;
private final K[] keys;
Expand Down
8 changes: 0 additions & 8 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,4 @@ dependencies {

modImplementation(group = "net.fabricmc", name = "fabric-loader", version = fabricLoaderVersion)
modApi(group = "net.fabricmc.fabric-api", name = "fabric-api", version = "$fabricApiVersion+$minecraftVersion")
}

tasks.processResources {
inputs.property("version", version)

filesMatching("fabric.mod.json") {
expand("version" to version)
}
}
2 changes: 1 addition & 1 deletion fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fabricApiVersion=0.83.1
fabricApiVersion=0.90.7
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package earth.terrarium.athena.api.client.fabric;

import com.google.gson.JsonObject;
import earth.terrarium.athena.api.client.models.AthenaModelFactory;
import earth.terrarium.athena.impl.loading.AthenaDataLoader;
import earth.terrarium.athena.api.client.utils.AthenaUnbakedModelLoader;
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
import net.fabricmc.fabric.api.client.model.ModelVariantProvider;
import net.minecraft.client.resources.model.ModelResourceLocation;
Expand All @@ -12,21 +11,14 @@

public class AthenaModelVariantProvider implements ModelVariantProvider {

private final ResourceLocation id;
private final AthenaModelFactory factory;
private final AthenaUnbakedModelLoader loader;

public AthenaModelVariantProvider(ResourceLocation id, AthenaModelFactory factory) {
this.id = id;
this.factory = factory;
this.loader = new AthenaUnbakedModelLoader(id, factory, AthenaUnbakedModel::new);
}

@Override
public @Nullable UnbakedModel loadModelVariant(ModelResourceLocation modelId, ModelProviderContext context) {
if ("inventory".equals(modelId.getVariant())) return null;
JsonObject json = AthenaDataLoader.getData(this.id, modelId);
if (json != null) {
return new AthenaUnbakedModel(this.factory.create(json));
}
return null;
return this.loader.loadModel(modelId);
}
}
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"contributors": [
],
"contact": {
"website": "https://www.curseforge.com/minecraft/mc-mods/athena",
"website": "https://modrinth.com/mod/athena-ctm",
"repo": "https://github.com/terrarium-earth/athena",
"issues": "https://github.com/terrarium-earth/athena/issues"
},
Expand All @@ -34,6 +34,6 @@
},
"depends": {
"fabric": "*",
"minecraft": ">=1.20"
"minecraft": ">=1.20.2"
}
}
8 changes: 0 additions & 8 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,3 @@ dependencies {
isTransitive = false
}
}

tasks.processResources {
inputs.property("version", version)

filesMatching("META-INF/mods.toml") {
expand("version" to version)
}
}
2 changes: 1 addition & 1 deletion forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
loom.platform=forge

forgeVersion=47.0.1
forgeVersion=48.0.39
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import earth.terrarium.athena.api.client.models.AthenaBlockModel;
import earth.terrarium.athena.api.client.models.AthenaQuad;
import earth.terrarium.athena.api.client.utils.AthenaUtils;
import earth.terrarium.athena.api.client.utils.forge.NullableEnumMap;
import earth.terrarium.athena.api.client.utils.NullableEnumMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package earth.terrarium.athena.api.client.models.forge;

import earth.terrarium.athena.api.client.forge.AthenaUnbakedModelLoader;
import earth.terrarium.athena.api.client.forge.AthenaUnbakedModel;
import earth.terrarium.athena.api.client.utils.AthenaUnbakedModelLoader;
import earth.terrarium.athena.api.client.models.AthenaModelFactory;
import net.minecraft.resources.ResourceLocation;

Expand All @@ -16,7 +17,7 @@ public static void register(ResourceLocation type, AthenaModelFactory factory) {
if (FACTORIES.containsKey(type)) {
throw new IllegalArgumentException("Factory already registered for type: " + type);
}
FACTORIES.put(type, new AthenaUnbakedModelLoader(type, factory));
FACTORIES.put(type, new AthenaUnbakedModelLoader(type, factory, AthenaUnbakedModel::new));
}

public static AthenaUnbakedModelLoader get(ResourceLocation type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import earth.terrarium.athena.api.client.forge.AthenaUnbakedModelLoader;
import earth.terrarium.athena.api.client.utils.AthenaUnbakedModelLoader;
import earth.terrarium.athena.api.client.models.forge.FactoryManagerImpl;
import earth.terrarium.athena.impl.client.DefaultModels;
import net.minecraft.client.renderer.block.model.ItemOverrides;
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 @@ -7,7 +7,7 @@ issueTrackerURL = "https://github.com/terrarium-earth/athena/issues"
modId = "athena"
version = "${version}"
displayName = "Athena"
displayURL = "https://www.curseforge.com/minecraft/mc-mods/athena"
displayURL = "https://modrinth.com/mod/athena-ctm"
logoFile = "icon.png"
authors = "ThatGravyBoat"
credits = ""
Expand All @@ -23,6 +23,6 @@ issueTrackerURL = "https://github.com/terrarium-earth/athena/issues"
[[dependencies.athena]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20,)"
versionRange = "[1.20.2,)"
ordering = "NONE"
side = "BOTH"
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
org.gradle.jvmargs=-Xmx3G

minecraftVersion=1.20.1
enabledPlatforms=fabric,forge
minecraftVersion=1.20.2
enabledPlatforms=fabric,forge,neoforge

version=3.1.1
version=3.2.0
group=earth.terrarium.athena

fabricLoaderVersion=0.14.21
fabricLoaderVersion=0.14.24
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
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-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
22 changes: 22 additions & 0 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
architectury {
neoForge()
}

val common: Configuration by configurations.creating {
configurations.compileClasspath.get().extendsFrom(this)
configurations.runtimeClasspath.get().extendsFrom(this)
configurations["developmentNeoForge"].extendsFrom(this)
}

dependencies {
val neoforgeVersion: String by project

neoForge(group = "net.neoforged", name = "neoforge", version = neoforgeVersion)

common(project(":common", configuration = "namedElements")) {
isTransitive = false
}
shadowCommon(project(path = ":common", configuration = "transformProductionNeoForge")) {
isTransitive = false
}
}
3 changes: 3 additions & 0 deletions neoforge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
loom.platform=neoforge

neoforgeVersion=20.2.59-beta
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package earth.terrarium.athena.api.client.models.neoforge;

import earth.terrarium.athena.api.client.models.AthenaModelFactory;
import earth.terrarium.athena.api.client.neoforge.AthenaUnbakedModel;
import earth.terrarium.athena.api.client.utils.AthenaUnbakedModelLoader;
import net.minecraft.resources.ResourceLocation;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class FactoryManagerImpl {

private static final Map<ResourceLocation, AthenaUnbakedModelLoader> FACTORIES = new HashMap<>();

public static void register(ResourceLocation type, AthenaModelFactory factory) {
if (FACTORIES.containsKey(type)) {
throw new IllegalArgumentException("Factory already registered for type: " + type);
}
FACTORIES.put(type, new AthenaUnbakedModelLoader(type, factory, AthenaUnbakedModel::new));
}

public static AthenaUnbakedModelLoader get(ResourceLocation type) {
return FACTORIES.get(type);
}

public static Collection<ResourceLocation> getTypes() {
return FACTORIES.keySet();
}
}
Loading

0 comments on commit fa18489

Please sign in to comment.