Cleanup model stuff and build script
This commit is contained in:
parent
a31af2bd7c
commit
f9017f2475
4 changed files with 26 additions and 58 deletions
|
@ -28,8 +28,8 @@
|
|||
}
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.21",
|
||||
"fabric-api": ">=0.82.1",
|
||||
"fabricloader": ">=0.14.22",
|
||||
"fabric-api": ">=0.86.1",
|
||||
"team_reborn_energy": ">=3.0.0",
|
||||
"fabric-biome-api-v1": ">=3.0.0",
|
||||
"minecraft": ">=1.20.1- <1.20.2-"
|
||||
|
|
55
build.gradle
55
build.gradle
|
@ -1,9 +1,3 @@
|
|||
buildscript {
|
||||
dependencies {
|
||||
classpath 'org.kohsuke:github-api:1.135'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'groovy'
|
||||
|
@ -13,7 +7,7 @@ plugins {
|
|||
id 'maven-publish'
|
||||
id 'com.diffplug.spotless' version '6.19.0'
|
||||
id 'fabric-loom' version '1.3-SNAPSHOT'
|
||||
id 'me.modmuss50.mod-publish-plugin' version '0.0.3'
|
||||
id 'me.modmuss50.mod-publish-plugin' version '0.3.3'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -83,7 +77,7 @@ allprojects {
|
|||
publications {
|
||||
register("maven", MavenPublication) {
|
||||
groupId project.name
|
||||
artifactId project.archivesBaseName + "-" + getBranch()
|
||||
artifactId project.archivesBaseName + "-" + (ENV.GITHUB_REF_NAME ?: "local")
|
||||
version project.version
|
||||
|
||||
from components.java
|
||||
|
@ -340,11 +334,11 @@ tasks.register('copyTranslationsToGenerated', Copy) {
|
|||
}
|
||||
|
||||
publishMods {
|
||||
changelog = ENV.CHANGELOG ?: "No changelog provided"
|
||||
changelog = providers.environmentVariable("CHANGELOG").orElse("No changelog provided")
|
||||
version = project.version
|
||||
type = ENV.RELEASE_CHANNEL == "release" ? STABLE : BETA
|
||||
type = providers.environmentVariable("RELEASE_CHANNEL").orElse("release").map {it == "release" ? STABLE : BETA }
|
||||
modLoaders.add("fabric")
|
||||
dryRun = ENV.CURSEFORGE_API_KEY == null
|
||||
dryRun = providers.environmentVariable("CURSEFORGE_API_KEY").getOrNull() == null
|
||||
|
||||
def options = curseforgeOptions {
|
||||
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
|
||||
|
@ -373,39 +367,12 @@ publishMods {
|
|||
projectId = "237903"
|
||||
file = project(":RebornCore").tasks.remapJar.archiveFile
|
||||
}
|
||||
}
|
||||
|
||||
static def getBranch() {
|
||||
def ENV = System.getenv()
|
||||
if (ENV.GITHUB_REF) {
|
||||
def branch = ENV.GITHUB_REF
|
||||
return branch.substring(branch.lastIndexOf("/") + 1)
|
||||
}
|
||||
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
import org.kohsuke.github.GHReleaseBuilder
|
||||
import org.kohsuke.github.GitHub
|
||||
|
||||
tasks.register('github') {
|
||||
dependsOn remapJar
|
||||
onlyIf {
|
||||
ENV.GITHUB_TOKEN
|
||||
}
|
||||
|
||||
doLast {
|
||||
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String)
|
||||
def repository = github.getRepository(ENV.GITHUB_REPOSITORY)
|
||||
|
||||
def releaseBuilder = new GHReleaseBuilder(repository, version as String)
|
||||
releaseBuilder.name("${archivesBaseName}-${version}")
|
||||
releaseBuilder.body(ENV.CHANGELOG)
|
||||
releaseBuilder.commitish(getBranch())
|
||||
|
||||
def ghRelease = releaseBuilder.create()
|
||||
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"), "application/java-archive")
|
||||
ghRelease.uploadAsset(file("RebornCore/build/libs/RebornCore-${version}.jar"), "application/java-archive")
|
||||
github {
|
||||
file = remapJar.archiveFile
|
||||
additionalFiles.from project(":RebornCore").tasks.remapJar.archiveFile
|
||||
repository = providers.environmentVariable("GITHUB_REPOSITORY").orElse("dryrun")
|
||||
accessToken = providers.environmentVariable("GITHUB_TOKEN")
|
||||
commitish = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryrun")
|
||||
}
|
||||
}
|
||||
github.dependsOn(project(":RebornCore").getTasks().named("remapJar"))
|
||||
|
|
|
@ -26,7 +26,7 @@ package techreborn;
|
|||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.model.loading.v1.PreparableModelLoadingPlugin;
|
||||
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.minecraft.client.item.ClampedModelPredicateProvider;
|
||||
|
@ -80,7 +80,6 @@ import techreborn.items.tool.industrial.NanosaberItem;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -88,7 +87,7 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
PreparableModelLoadingPlugin.register((resourceManager, executor) -> CompletableFuture.completedFuture(null), (data, pluginContext) -> {
|
||||
ModelLoadingPlugin.register((pluginContext) -> {
|
||||
pluginContext.addModels(
|
||||
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_base"), "inventory"),
|
||||
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_fluid"), "inventory"),
|
||||
|
@ -99,14 +98,16 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "bucket_background"), "inventory")
|
||||
);
|
||||
|
||||
pluginContext.modifyModelBeforeBake().register((model, context) -> {
|
||||
pluginContext.resolveModel().register((context) -> {
|
||||
final Identifier id = context.id();
|
||||
|
||||
if (!id.getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
return model;
|
||||
if (!id.getNamespace().equals(TechReborn.MOD_ID) || !id.getPath().startsWith("item/")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (id.getPath().equals("cell")) {
|
||||
String path = id.getPath().replace("item/", "");
|
||||
|
||||
if (path.equals("cell")) {
|
||||
if (!RendererAccess.INSTANCE.hasRenderer()) {
|
||||
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}");
|
||||
}
|
||||
|
@ -114,8 +115,8 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
return new UnbakedDynamicModel(DynamicCellBakedModel::new);
|
||||
}
|
||||
|
||||
Fluid fluid = Registries.FLUID.get(new Identifier(TechReborn.MOD_ID, id.getPath().split("_bucket")[0]));
|
||||
if (id.getPath().endsWith("_bucket") && fluid != Fluids.EMPTY) {
|
||||
Fluid fluid = Registries.FLUID.get(new Identifier(TechReborn.MOD_ID, path.split("_bucket")[0]));
|
||||
if (path.endsWith("_bucket") && fluid != Fluids.EMPTY) {
|
||||
if (!RendererAccess.INSTANCE.hasRenderer()) {
|
||||
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}");
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
return new UnbakedDynamicModel(DynamicBucketBakedModel::new);
|
||||
}
|
||||
|
||||
return model;
|
||||
return null;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.21",
|
||||
"fabric-api": ">=0.82.1",
|
||||
"fabricloader": ">=0.14.22",
|
||||
"fabric-api": ">=0.86.1",
|
||||
"reborncore": "*",
|
||||
"team_reborn_energy": ">=3.0.0",
|
||||
"fabric-biome-api-v1": ">=3.0.0",
|
||||
|
|
Loading…
Reference in a new issue