修复些问题, 优化了下配置
This commit is contained in:
parent
600d628dec
commit
b3a7f94133
27
build.gradle
27
build.gradle
|
|
@ -29,11 +29,17 @@ subprojects {
|
||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
|
maven { url = 'https://maven.parchmentmc.org' }
|
||||||
|
}
|
||||||
|
loom {
|
||||||
|
silentMojangMappingsLicense()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
|
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
|
||||||
mappings loom.officialMojangMappings()
|
mappings loom.layered() {
|
||||||
|
officialMojangMappings()
|
||||||
|
parchment ("org.parchmentmc.data:parchment-1.20.1:2023.09.03@zip")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|
@ -50,7 +56,22 @@ subprojects {
|
||||||
it.options.encoding = "UTF-8"
|
it.options.encoding = "UTF-8"
|
||||||
it.options.release = 17
|
it.options.release = 17
|
||||||
}
|
}
|
||||||
|
def resourceTargets=["fabric.mod.json",'META-INF/mods.toml'];
|
||||||
|
def replaceProperties = [
|
||||||
|
mod_name: mod_name,
|
||||||
|
mod_version: mod_version,
|
||||||
|
mod_source:mod_source,
|
||||||
|
mod_credits:mod_credits,
|
||||||
|
mod_authors: mod_authors,
|
||||||
|
mod_description: mod_description,
|
||||||
|
mod_licence:mod_licence,
|
||||||
|
group:maven_group]
|
||||||
|
processResources{
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
filesMatching(resourceTargets) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
}
|
||||||
// Configure Maven publishing.
|
// Configure Maven publishing.
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.leisuretimedock.jsonem.platform;
|
package com.leisuretimedock.jsonem.platform;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public interface IPlatFormHelper {
|
public interface IPlatFormHelper {
|
||||||
boolean shouldDumpModels();
|
boolean shouldDumpModels();
|
||||||
|
Path getDumpModelsPath();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.leisuretimedock.jsonem.JsonEm;
|
import com.leisuretimedock.jsonem.JsonEm;
|
||||||
|
import com.leisuretimedock.jsonem.platform.Services;
|
||||||
import com.leisuretimedock.jsonem.serialization.JsonEMCodecs;
|
import com.leisuretimedock.jsonem.serialization.JsonEMCodecs;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import com.mojang.serialization.JsonOps;
|
import com.mojang.serialization.JsonOps;
|
||||||
|
|
@ -12,7 +13,6 @@ import net.minecraft.client.model.geom.ModelLayers;
|
||||||
import net.minecraft.client.model.geom.builders.LayerDefinition;
|
import net.minecraft.client.model.geom.builders.LayerDefinition;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
@ -23,7 +23,7 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class JsonEntityModelUtil {
|
public class JsonEntityModelUtil {
|
||||||
public static Path DUMP_DIR;
|
|
||||||
public static final Gson GSON = new Gson();
|
public static final Gson GSON = new Gson();
|
||||||
|
|
||||||
public static Optional<LayerDefinition> readJson(InputStream data) {
|
public static Optional<LayerDefinition> readJson(InputStream data) {
|
||||||
|
|
@ -52,12 +52,13 @@ public class JsonEntityModelUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dump(ModelLayerLocation layer, LayerDefinition data) throws IOException {
|
public static void dump(ModelLayerLocation layer, LayerDefinition data) throws IOException {
|
||||||
if (!Files.exists(DUMP_DIR)) {
|
Path dumpModelsPath = Services.PLATFORM.getDumpModelsPath();
|
||||||
Files.createDirectories(DUMP_DIR);
|
if (!Files.exists(dumpModelsPath)) {
|
||||||
|
Files.createDirectories(dumpModelsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
var modelResult = JsonEMCodecs.TEXTURED_MODEL_DATA.encode(data, JsonOps.INSTANCE, new JsonObject());
|
var modelResult = JsonEMCodecs.TEXTURED_MODEL_DATA.encode(data, JsonOps.INSTANCE, new JsonObject());
|
||||||
var modelFolder = DUMP_DIR.resolve("assets").resolve(layer.getModel().getNamespace()).resolve("models").resolve("entity").resolve(layer.getModel().getPath());
|
var modelFolder = dumpModelsPath.resolve("assets").resolve(layer.getModel().getNamespace()).resolve("models").resolve("entity").resolve(layer.getModel().getPath());
|
||||||
var modelFile = modelFolder.resolve(layer.getLayer()+".json");
|
var modelFile = modelFolder.resolve(layer.getLayer()+".json");
|
||||||
|
|
||||||
if (!Files.exists(modelFolder)) {
|
if (!Files.exists(modelFolder)) {
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,18 @@ package com.leisuretimedock.jsonem.fabric.platform;
|
||||||
|
|
||||||
import com.leisuretimedock.jsonem.fabric.JsonEmFabric;
|
import com.leisuretimedock.jsonem.fabric.JsonEmFabric;
|
||||||
import com.leisuretimedock.jsonem.platform.IPlatFormHelper;
|
import com.leisuretimedock.jsonem.platform.IPlatFormHelper;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public class FabricPlatformHelper implements IPlatFormHelper {
|
public class FabricPlatformHelper implements IPlatFormHelper {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldDumpModels() {
|
public boolean shouldDumpModels() {
|
||||||
return "true".equals(JsonEmFabric.CONFIG.values.getProperty("dump_models"));
|
return "true".equals(JsonEmFabric.CONFIG.values.getProperty("dump_models"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path getDumpModelsPath() {
|
||||||
|
return FabricLoader.getInstance().getGameDir().resolve("jsonem_dump");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "jsonem",
|
"id": "jsonem",
|
||||||
"version": "${version}",
|
"version": "${mod_version}",
|
||||||
"name": "JsonEM_Neo_Forge_1_20_1",
|
"name": "${mod_name}",
|
||||||
"description": "Migrate from Fabric 1.20.1",
|
"description": "${mod_description}",
|
||||||
"authors": [
|
"authors": [
|
||||||
"FoundationGames",
|
"${mod_authors}"
|
||||||
"R3944Realms"
|
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": ""
|
"homepage": "",
|
||||||
|
"sources": "${mod_source}"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "${mod_licence}",
|
||||||
"icon": "assets/jsonem/icon.png",
|
"icon": "assets/jsonem/icon.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
|
|
|
||||||
6
fabric/src/main/resources/pack.mcmeta
Normal file
6
fabric/src/main/resources/pack.mcmeta
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"description": "jsonem resources",
|
||||||
|
"pack_format": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,10 +2,18 @@ package com.leisuretimedock.jsonem.forge.platform;
|
||||||
|
|
||||||
import com.leisuretimedock.jsonem.forge.config.JsonEmConfig;
|
import com.leisuretimedock.jsonem.forge.config.JsonEmConfig;
|
||||||
import com.leisuretimedock.jsonem.platform.IPlatFormHelper;
|
import com.leisuretimedock.jsonem.platform.IPlatFormHelper;
|
||||||
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public class ForgePlatformHelper implements IPlatFormHelper {
|
public class ForgePlatformHelper implements IPlatFormHelper {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldDumpModels() {
|
public boolean shouldDumpModels() {
|
||||||
return JsonEmConfig.INSTANCE.DUMP_MODELS.get();
|
return JsonEmConfig.INSTANCE.DUMP_MODELS.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path getDumpModelsPath() {
|
||||||
|
return FMLPaths.GAMEDIR.get().resolve("jsonem_dump");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
modLoader = "javafml"
|
modLoader = "javafml"
|
||||||
loaderVersion = "[47,)"
|
loaderVersion = "[47,)"
|
||||||
#issueTrackerURL = ""
|
#issueTrackerURL = ""
|
||||||
license = "MIT"
|
license = "${mod_licence}"
|
||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId = "jsonem"
|
modId = "jsonem"
|
||||||
version = "${version}"
|
version = "${mod_version}"
|
||||||
displayName = "JsonEM_Neo_Forge_1_20_1"
|
displayName = "${mod_name}"
|
||||||
authors = "FoundationGames, R3944Realms"
|
credits = "${mod_credits}"
|
||||||
|
authors = "${mod_authors}"
|
||||||
description = '''
|
description = '''
|
||||||
Migrate from Fabric 1.20.1
|
${mod_description}
|
||||||
'''
|
'''
|
||||||
logoFile = "assets/jsonem/icon.png"
|
logoFile = "assets/jsonem/icon.png"
|
||||||
|
|
||||||
[[dependencies.jsonem]]
|
[[dependencies.jsonem]]
|
||||||
|
|
|
||||||
6
forge/src/main/resources/pack.mcmeta
Normal file
6
forge/src/main/resources/pack.mcmeta
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"description": "jsonem resources",
|
||||||
|
"pack_format": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,14 @@
|
||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
# Mod properties
|
# Mod properties
|
||||||
|
mod_id=jsonem
|
||||||
|
mod_name=jsonEM
|
||||||
mod_version=1.0-SNAPSHOT
|
mod_version=1.0-SNAPSHOT
|
||||||
|
mod_source=https://github.com/LeisureTimeDock/JsonEM_Neo_Forge
|
||||||
|
mod_credits=
|
||||||
|
mod_authors= FoundationGames, R3944Realms
|
||||||
|
mod_description=Migrate from Fabric 1.20.1
|
||||||
|
mod_licence=MIT
|
||||||
maven_group=com.leisuretimedock
|
maven_group=com.leisuretimedock
|
||||||
archives_name=jsonem_neo_forge_1_20_1
|
archives_name=jsonem_neo_forge_1_20_1
|
||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://maven.fabricmc.net/" }
|
maven { url "https://maven.fabricmc.net/" }
|
||||||
maven { url "https://maven.architectury.dev/" }
|
maven { url "https://maven.architectury.dev/" }
|
||||||
|
maven { url "https://maven.minecraftforge.net/" }
|
||||||
maven { url "https://files.minecraftforge.net/maven/" }
|
maven { url "https://files.minecraftforge.net/maven/" }
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
|
|
@ -13,6 +14,3 @@ include 'common'
|
||||||
include 'fabric'
|
include 'fabric'
|
||||||
include 'forge'
|
include 'forge'
|
||||||
|
|
||||||
project(':common').projectDir = file('common')
|
|
||||||
project(':forge').projectDir = file('forge')
|
|
||||||
project(':fabric').projectDir = file('fabric')
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user