[FEAT] Paper Support

This commit is contained in:
2024-10-22 20:13:32 +02:00
parent 86149ace11
commit e0e37685e2
352 changed files with 5772 additions and 1588 deletions

View File

@@ -1,3 +1,4 @@
// @excludeplugin
package com.hypherionmc.craterlib.compat;
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;

View File

@@ -9,7 +9,6 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.json.JSONOptions;
import net.minecraft.ChatFormatting;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
@@ -100,7 +99,15 @@ public class ChatUtils {
public static net.kyori.adventure.text.Component format(String value) {
value = convertFormattingCodes(value);
return miniMessage.deserializeOr(value, net.kyori.adventure.text.Component.translatable(value));
try {
return miniMessage.deserializeOr(value, net.kyori.adventure.text.Component.translatable(value));
} catch (Exception ignored) {
// Mini message fails to format text that contain legacy formatting. Since we support both, that's bad.
// We just ignore the exception here so that the whole format doesn't fail
}
return net.kyori.adventure.text.Component.translatable(value);
}
private static String convertFormattingCodes(String input) {

View File

@@ -10,6 +10,8 @@ import java.util.ServiceLoader;
*/
public class InternalServiceUtil {
public static ClassLoader loader = Thread.currentThread().getContextClassLoader();
/**
* Try to load a service
*
@@ -17,7 +19,7 @@ public class InternalServiceUtil {
* @return The loaded class
*/
public static <T> T load(Class<T> clazz) {
final T loadedService = ServiceLoader.load(clazz)
final T loadedService = ServiceLoader.load(clazz, loader)
.findFirst()
.orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName()));
CraterConstants.LOG.debug("Loaded {} for service {}", loadedService, clazz);

View File

@@ -111,7 +111,7 @@ publisher {
setModrinthID(modrinth_id)
setNightbloomID("craterlib")
setVersionType("release")
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-fabric.md")
setChangelog(rootProject.file("changelog.md"))
setProjectVersion("${minecraft_version}-${project.version}")
setDisplayName("[FABRIC/QUILT 1.18.2] CraterLib - ${project.version}")
setGameVersions("1.18.2")

View File

@@ -13,7 +13,7 @@ public class FabricCompatHelper implements CompatUtils {
if (!ModloaderEnvironment.INSTANCE.isModLoaded("melius-vanish"))
return true;
return Vanish.isPlayerVanished(player.toMojangServerPlayer());
return !Vanish.isPlayerVanished(player.toMojangServerPlayer());
}
@Override

View File

@@ -105,7 +105,7 @@ publisher {
setModrinthID(modrinth_id)
setNightbloomID("craterlib")
setVersionType("release")
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md")
setChangelog(rootProject.file("changelog.md"))
setProjectVersion("${minecraft_version}-${project.version}")
setDisplayName("[Forge 1.18.2] CraterLib - ${project.version}")
setGameVersions("1.18.2")

View File

@@ -12,7 +12,7 @@ public class ForgeCompatHelper implements CompatUtils {
if (!ModloaderEnvironment.INSTANCE.isModLoaded("vmod"))
return true;
return VanishUtil.isVanished(player.toMojangServerPlayer());
return !VanishUtil.isVanished(player.toMojangServerPlayer());
}
@Override

View File

@@ -3,7 +3,8 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id "xyz.wagyourtail.unimined" version "1.3.9" apply false
id "com.hypherionmc.modutils.modpublisher" version "2.1.6"
id "com.hypherionmc.modutils.orion" version "1.0.+"
id "com.hypherionmc.modutils.orion" version "1.0.24"
id "com.hypherionmc.modutils.orion.origami" version "1.0.24" apply false
id 'maven-publish'
}
@@ -29,6 +30,10 @@ subprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.hypherionmc.modutils.modpublisher'
if (project.name === "Paper") {
apply plugin: 'com.hypherionmc.modutils.orion.origami'
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
@@ -95,17 +100,19 @@ subprojects {
* = DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING =
* ===============================================================================
*/
unimined.minecraft(sourceSets.main, true) {
version minecraft_version
if (project.name !== "Paper") {
unimined.minecraft(sourceSets.main, true) {
version minecraft_version
mappings {
mojmap()
devNamespace "mojmap"
}
mappings {
mojmap()
devNamespace "mojmap"
}
mods {
remap(configurations.stupidRemapArch) {
catchAWNamespaceAssertion()
mods {
remap(configurations.stupidRemapArch) {
catchAWNamespaceAssertion()
}
}
}
}

11
1.18.2/changelog.md Normal file
View File

@@ -0,0 +1,11 @@
**New Features**:
- Paper Support. Currently only available on Modrinth and NightBloom
**Bug Fixes**:
- Fixed Vanish compact API being swapped
**Changes**:
- Config library now logs which line of the config the error is on

View File

@@ -1,7 +1,7 @@
#Project
version_major=2
version_minor=1
version_patch=1
version_patch=2
version_build=0
#Mod