[BUG] Fix 1.19.4/1.20 patches and compile errors
This commit is contained in:
@@ -4,16 +4,20 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent;
|
|||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||||
import com.hypherionmc.craterlib.utils.ChatUtils;
|
import com.hypherionmc.craterlib.utils.ChatUtils;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
import net.minecraft.network.chat.PlayerChatMessage;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.FilteredText;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
||||||
public class ServerGamePacketListenerImplMixin {
|
public class ServerGamePacketListenerImplMixin {
|
||||||
@@ -22,16 +26,17 @@ public class ServerGamePacketListenerImplMixin {
|
|||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "lambda$handleChat$8",
|
method = "lambda$handleChat$9",
|
||||||
at = @At("HEAD"),
|
at = @At("HEAD"),
|
||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
private void injectChatEvent(CompletableFuture<FilteredText> completableFuture, CompletableFuture<Component> completableFuture2, PlayerChatMessage arg, Executor executor, CallbackInfoReturnable<CompletableFuture> cir) {
|
||||||
private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) {
|
Component comp2 = completableFuture2.join();
|
||||||
|
Component finalArg = comp2 == null ? arg.decoratedContent() : comp2;
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
ci.cancel();
|
cir.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent;
|
|||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||||
import com.hypherionmc.craterlib.utils.ChatUtils;
|
import com.hypherionmc.craterlib.utils.ChatUtils;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
import net.minecraft.network.chat.PlayerChatMessage;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.FilteredText;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin {
|
|||||||
at = @At("HEAD"),
|
at = @At("HEAD"),
|
||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
Component finalArg = component == null ? arg.decoratedContent() : component;
|
private void injectChatEvent(CompletableFuture<Component> completablefuture1, PlayerChatMessage arg, CompletableFuture<FilteredText> completablefuture, Void p_248218_, CallbackInfo ci) {
|
||||||
private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture 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));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
|
@@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent;
|
|||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||||
import com.hypherionmc.craterlib.utils.ChatUtils;
|
import com.hypherionmc.craterlib.utils.ChatUtils;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
import net.minecraft.network.chat.PlayerChatMessage;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.FilteredText;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin {
|
|||||||
at = @At("HEAD"),
|
at = @At("HEAD"),
|
||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
|
private void injectChatEvent(PlayerChatMessage arg, CompletableFuture<FilteredText> completableFuture, CompletableFuture<Component> completableFuture2, Void void_, CallbackInfo ci) {
|
||||||
|
Component arg2 = completableFuture2.join();
|
||||||
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
||||||
private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) {
|
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
|
@@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent;
|
|||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||||
import com.hypherionmc.craterlib.utils.ChatUtils;
|
import com.hypherionmc.craterlib.utils.ChatUtils;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
import net.minecraft.network.chat.PlayerChatMessage;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.FilteredText;
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin {
|
|||||||
at = @At("HEAD"),
|
at = @At("HEAD"),
|
||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
|
private void injectChatEvent(CompletableFuture<Component> completablefuture1, PlayerChatMessage arg, CompletableFuture<FilteredText> completablefuture, Void p_248218_, CallbackInfo ci) {
|
||||||
|
Component component = completablefuture1.join();
|
||||||
Component finalArg = component == null ? arg.decoratedContent() : component;
|
Component finalArg = component == null ? arg.decoratedContent() : component;
|
||||||
private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) {
|
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
|
@@ -1,37 +1,35 @@
|
|||||||
--- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
--- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
+++ b/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
+++ b/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
@@ -4,10 +4,8 @@
|
@@ -14,6 +14,10 @@
|
||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
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;
|
|
||||||
@@ -15,6 +13,8 @@
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
+import java.util.concurrent.CompletableFuture;
|
|
||||||
+
|
+
|
||||||
|
+import java.util.concurrent.CompletableFuture;
|
||||||
|
+import java.util.concurrent.Executor;
|
||||||
|
|
||||||
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
||||||
public class ServerGamePacketListenerImplMixin {
|
public class ServerGamePacketListenerImplMixin {
|
||||||
|
@@ -22,16 +26,17 @@
|
||||||
@@ -22,12 +22,12 @@
|
|
||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
- method = "lambda$handleChat$5",
|
- method = "lambda$handleChat$5",
|
||||||
+ method = "lambda$handleChat$8",
|
+ method = "lambda$handleChat$9",
|
||||||
at = @At("HEAD"),
|
at = @At("HEAD"),
|
||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
- private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
|
- private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
|
||||||
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
- Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
||||||
+ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) {
|
+ private void injectChatEvent(CompletableFuture<FilteredText> completableFuture, CompletableFuture<Component> completableFuture2, PlayerChatMessage arg, Executor executor, CallbackInfoReturnable<CompletableFuture> cir) {
|
||||||
|
+ Component comp2 = completableFuture2.join();
|
||||||
|
+ Component finalArg = comp2 == null ? arg.decoratedContent() : comp2;
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
|
- ci.cancel();
|
||||||
|
+ cir.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -1,17 +1,6 @@
|
|||||||
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
@@ -4,10 +4,8 @@
|
@@ -15,6 +15,8 @@
|
||||||
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;
|
|
||||||
@@ -15,6 +13,8 @@
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@@ -20,7 +9,7 @@
|
|||||||
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
||||||
public class ServerGamePacketListenerImplMixin {
|
public class ServerGamePacketListenerImplMixin {
|
||||||
|
|
||||||
@@ -22,12 +22,12 @@
|
@@ -22,12 +24,13 @@
|
||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@@ -30,8 +19,10 @@
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
- private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
|
- private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
|
||||||
Component finalArg = component == null ? arg.decoratedContent() : component;
|
- 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));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
|
@@ -1,17 +1,6 @@
|
|||||||
--- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
--- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
+++ b/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
+++ b/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
@@ -4,10 +4,8 @@
|
@@ -15,6 +15,8 @@
|
||||||
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;
|
|
||||||
@@ -15,6 +13,8 @@
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@@ -20,7 +9,7 @@
|
|||||||
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
||||||
public class ServerGamePacketListenerImplMixin {
|
public class ServerGamePacketListenerImplMixin {
|
||||||
|
|
||||||
@@ -22,12 +22,12 @@
|
@@ -22,11 +24,12 @@
|
||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@@ -30,8 +19,8 @@
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
- private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
|
- private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
|
||||||
|
+ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture<FilteredText> completableFuture, CompletableFuture<Component> completableFuture2, Void void_, CallbackInfo ci) {
|
||||||
|
+ Component arg2 = completableFuture2.join();
|
||||||
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
|
||||||
+ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) {
|
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
|
||||||
|
@@ -1,17 +1,6 @@
|
|||||||
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java
|
||||||
@@ -4,10 +4,8 @@
|
@@ -15,6 +15,8 @@
|
||||||
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;
|
|
||||||
@@ -15,6 +13,8 @@
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@@ -20,7 +9,7 @@
|
|||||||
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
||||||
public class ServerGamePacketListenerImplMixin {
|
public class ServerGamePacketListenerImplMixin {
|
||||||
|
|
||||||
@@ -22,12 +22,12 @@
|
@@ -22,11 +24,12 @@
|
||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@@ -30,8 +19,8 @@
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
- private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
|
- private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
|
||||||
|
+ private void injectChatEvent(CompletableFuture<Component> completablefuture1, PlayerChatMessage arg, CompletableFuture<FilteredText> completablefuture, Void p_248218_, CallbackInfo ci) {
|
||||||
|
+ Component component = completablefuture1.join();
|
||||||
Component finalArg = component == null ? arg.decoratedContent() : component;
|
Component finalArg = component == null ? arg.decoratedContent() : component;
|
||||||
+ private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) {
|
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
|
||||||
|
Reference in New Issue
Block a user