use of net.modificationstation.stationapi.api.network.ModdedPacketHandler in project StationAPI by ModificationStation.
the class ServerRegistrySender method sendLevelRegistry.
@EventListener(priority = ListenerPriority.HIGH)
private static void sendLevelRegistry(PlayerPacketHandlerSetEvent event) {
if (((ModdedPacketHandler) event.player.packetHandler).isModded()) {
LOGGER.info("Sending level registries to \"" + event.player.name + "\"...");
CompoundTag registries = new CompoundTag();
LevelSerialRegistry.saveAll(registries);
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
NBTIO.writeGzipped(registries, byteOutputStream);
Message message = new Message(of(MODID, "server_registry_sync"));
message.bytes = byteOutputStream.toByteArray();
PacketHelper.sendTo(event.player, message);
}
}
Aggregations