mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Fix handling CUI on Forge server.
Probably.
This commit is contained in:
parent
508ece9e0f
commit
f0c0eedde7
@ -22,13 +22,8 @@ package com.sk89q.worldedit.forge.net.handler;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.forge.ForgePlayer;
|
||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.network.ThreadQuickExitException;
|
||||
import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.network.NetworkEvent.ClientCustomPayloadEvent;
|
||||
import net.minecraftforge.fml.network.NetworkEvent.ServerCustomPayloadEvent;
|
||||
import net.minecraftforge.fml.network.event.EventNetworkChannel;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@ -47,10 +42,9 @@ public final class WECUIPacketHandler {
|
||||
|
||||
public static void init() {
|
||||
HANDLER.addListener(WECUIPacketHandler::onPacketData);
|
||||
HANDLER.addListener(WECUIPacketHandler::callProcessPacket);
|
||||
}
|
||||
|
||||
public static void onPacketData(ServerCustomPayloadEvent event) {
|
||||
public static void onPacketData(ClientCustomPayloadEvent event) {
|
||||
ServerPlayerEntity player = event.getSource().get().getSender();
|
||||
LocalSession session = ForgeWorldEdit.inst.getSession(player);
|
||||
|
||||
@ -63,15 +57,5 @@ public final class WECUIPacketHandler {
|
||||
session.handleCUIInitializationMessage(text, actor);
|
||||
session.describeCUI(actor);
|
||||
}
|
||||
|
||||
public static void callProcessPacket(ClientCustomPayloadEvent event) {
|
||||
try {
|
||||
new SCustomPayloadPlayPacket(
|
||||
new ResourceLocation(ForgeWorldEdit.MOD_ID, ForgeWorldEdit.CUI_PLUGIN_CHANNEL),
|
||||
event.getPayload()
|
||||
).processPacket(Minecraft.getInstance().player.connection);
|
||||
} catch (ThreadQuickExitException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user