[BUG] Fix NeoForge/Forge issue with adventure

This commit is contained in:
2024-08-08 21:51:15 +02:00
parent 04d4ea6520
commit 029bde932d
79 changed files with 176 additions and 88 deletions

View File

@@ -29,6 +29,7 @@ shadowJar {
}
setArchiveClassifier('dev-shadow')
mergeServiceFiles()
}
/**

View File

@@ -27,7 +27,8 @@ public class ServerGamePacketListenerImplMixin {
cancellable = true
)
private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), arg.decoratedContent().getString(), ChatUtils.mojangToAdventure(arg.decoratedContent()));
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event);
if (event.wasCancelled())
ci.cancel();

View File

@@ -22,6 +22,7 @@ shadowJar {
}
setArchiveClassifier('dev-shadow')
mergeServiceFiles()
}
/**

View File

@@ -1,13 +1,18 @@
package com.hypherionmc.craterlib.common;
import com.hypherionmc.craterlib.core.platform.CompatUtils;
import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
import redstonedubstep.mods.vanishmod.VanishUtil;
public class ForgeCompatHelper implements CompatUtils {
@Override
public boolean isPlayerActive(BridgedPlayer player) {
return true;
if (!ModloaderEnvironment.INSTANCE.isModLoaded("vmod"))
return true;
return VanishUtil.isVanished(player.toMojangServerPlayer());
}
@Override

View File

@@ -27,7 +27,8 @@ public class ServerGamePacketListenerImplMixin {
cancellable = true
)
private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), arg.decoratedContent().getString(), ChatUtils.mojangToAdventure(arg.decoratedContent()));
Component finalArg = component == null ? arg.decoratedContent() : component;
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event);
if (event.wasCancelled())
ci.cancel();

View File

@@ -21,6 +21,7 @@ shadowJar {
}
setArchiveClassifier('dev-shadow')
mergeServiceFiles()
}
/**

View File

@@ -27,7 +27,8 @@ public class ServerGamePacketListenerImplMixin {
cancellable = true
)
private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), arg.decoratedContent().getString(), ChatUtils.mojangToAdventure(arg.decoratedContent()));
Component finalArg = component == null ? arg.decoratedContent() : component;
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event);
if (event.wasCancelled())
ci.cancel();

View File

@@ -1,8 +1,8 @@
#Project
version_major=2
version_minor=0
version_patch=2
version_build=1
version_patch=3
version_build=0
#Mod
mod_author=HypherionSA