mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-20 00:13:21 +02:00
25 lines
909 B
Java
25 lines
909 B
Java
![]() |
package one.oth3r.sit;
|
||
|
|
||
|
import com.google.gson.Gson;
|
||
|
import com.google.gson.GsonBuilder;
|
||
|
import net.fabricmc.api.ClientModInitializer;
|
||
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||
|
|
||
|
public class SitClient implements ClientModInitializer {
|
||
|
public static boolean inGame = false;
|
||
|
@Override
|
||
|
public void onInitializeClient() {
|
||
|
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
|
||
|
inGame = true;
|
||
|
// send a data packet whenever joining a server
|
||
|
client.execute(SitClient::sendPackets);
|
||
|
});
|
||
|
// reset inGame
|
||
|
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> inGame = false);
|
||
|
}
|
||
|
public static void sendPackets() {
|
||
|
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||
|
new PacketBuilder(gson.toJson(Utl.getHandSettings())).send();
|
||
|
}
|
||
|
}
|