[FEAT] Paper Support
This commit is contained in:
@@ -2,7 +2,7 @@ def projectName = "CraterLib";
|
||||
def projectIcon = "https://cdn.modrinth.com/data/Nn8Wasaq/a172c634683a11a2e9ae593e56eba7885743bb44.png";
|
||||
def JDK = "17";
|
||||
def majorMc = "1.19.2";
|
||||
def modLoaders = "forge|fabric|quilt";
|
||||
def modLoaders = "forge|fabric|quilt|paper";
|
||||
def supportedMc = "1.19.2";
|
||||
def reltype = "snapshot";
|
||||
|
||||
|
@@ -14,8 +14,14 @@ public class CraterPlayerDeathEvent extends CraterEvent {
|
||||
|
||||
private final BridgedPlayer player;
|
||||
private final DamageSource damageSource;
|
||||
private Component deathMessage;
|
||||
|
||||
public CraterPlayerDeathEvent(BridgedPlayer player, DamageSource source, Component deathMessage) {
|
||||
this(player, source);
|
||||
this.deathMessage = deathMessage;
|
||||
}
|
||||
|
||||
public Component getDeathMessage() {
|
||||
return ChatUtils.mojangToAdventure(damageSource.getLocalizedDeathMessage(player.toMojang()));
|
||||
return deathMessage != null ? deathMessage : ChatUtils.mojangToAdventure(damageSource.getLocalizedDeathMessage(player.toMojang()));
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// @excludeplugin
|
||||
package com.hypherionmc.craterlib.compat;
|
||||
|
||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||
|
@@ -12,6 +12,7 @@ import net.minecraft.SharedConstants;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
|
||||
public class ChatUtils {
|
||||
|
||||
private static final GsonComponentSerializer adventureSerializer = GsonComponentSerializer.builder().options(
|
||||
@@ -97,7 +98,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) {
|
||||
|
@@ -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);
|
||||
|
@@ -112,7 +112,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.19.2] CraterLib - ${project.version}")
|
||||
setGameVersions("1.19.2")
|
||||
|
@@ -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
|
||||
|
@@ -106,7 +106,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.19.2] CraterLib - ${project.version}")
|
||||
setGameVersions("1.19.2")
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
@@ -93,17 +98,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.19.2/changelog.md
Normal file
11
1.19.2/changelog.md
Normal 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
|
@@ -1,7 +1,7 @@
|
||||
#Project
|
||||
version_major=2
|
||||
version_minor=1
|
||||
version_patch=1
|
||||
version_patch=2
|
||||
version_build=0
|
||||
|
||||
#Mod
|
||||
|
Reference in New Issue
Block a user