[BUG] Fix 1.19.4/1.20 patches and compile errors

This commit is contained in:
2024-08-08 22:27:25 +02:00
parent c8bebdc8eb
commit e14ac2a136
8 changed files with 53 additions and 72 deletions

View File

@@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
import com.hypherionmc.craterlib.utils.ChatUtils;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.FilteredText;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin {
at = @At("HEAD"),
cancellable = true
)
Component finalArg = component == null ? arg.decoratedContent() : component;
private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) {
private void injectChatEvent(CompletableFuture<Component> completablefuture1, PlayerChatMessage arg, CompletableFuture<FilteredText> completablefuture, Void p_248218_, CallbackInfo ci) {
Component comp2 = completablefuture1.join();
Component finalArg = comp2 == null ? arg.decoratedContent() : comp2;
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event);
if (event.wasCancelled())