Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 11:00:04 +01:00
Fix handling CUI on Forge server.
Probably.
Dieser Commit ist enthalten in:
Ursprung
508ece9e0f
Commit
f0c0eedde7
@ -22,13 +22,8 @@ package com.sk89q.worldedit.forge.net.handler;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.forge.ForgePlayer;
|
import com.sk89q.worldedit.forge.ForgePlayer;
|
||||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
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.ClientCustomPayloadEvent;
|
||||||
import net.minecraftforge.fml.network.NetworkEvent.ServerCustomPayloadEvent;
|
|
||||||
import net.minecraftforge.fml.network.event.EventNetworkChannel;
|
import net.minecraftforge.fml.network.event.EventNetworkChannel;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
@ -47,10 +42,9 @@ public final class WECUIPacketHandler {
|
|||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
HANDLER.addListener(WECUIPacketHandler::onPacketData);
|
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();
|
ServerPlayerEntity player = event.getSource().get().getSender();
|
||||||
LocalSession session = ForgeWorldEdit.inst.getSession(player);
|
LocalSession session = ForgeWorldEdit.inst.getSession(player);
|
||||||
|
|
||||||
@ -64,14 +58,4 @@ public final class WECUIPacketHandler {
|
|||||||
session.describeCUI(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) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren