How frozenlabs/neocinema works
Project Type and Purpose
• NeoCinema is a hybrid Minecraft mod/plugin project. It consists of:
a. A Fabric-based client mod (“fabric” sub-project) that runs in players’ game clients.
b. A Bukkit/Spigot plugin (“bukkit” sub-project) that runs on the game server.
• Purpose: Enable synchronized video playback (YouTube, Twitch, files) inside Minecraft, with queue/history, custom cinema blocks, and configurations.
Core Components
2.1 Fabric (Client)
• Mixins & Core Classes
– NeoCinema.java, NeoCinemaClient.java
– MixinMinecraftClient, MixinInGameHud, MixinClientPlayerEntity
• GUI & Screens
– VideoQueueScreen, VideoHistoryScreen, VideoSettingsScreen
– Widget classes (VideoListWidget, VideoQueueWidget, etc.)
• Network Layer
– Codecs (IdCodec), Payloads (inbound/outbound) under fabric/network
• Rendering & Blocks
– PreviewScreenBlock, ScreenBlock & corresponding EntityRenderers
• Utilities & Playback
– DependencyDownloader, NetworkUtil, PlaybackStatusHudUtil, etc.
– VideoLanPlayback for LAN streaming
• Settings & Data Managers
– NeoCinemaSettings, VideoListManager, VideoQueue
2.2 Bukkit (Server)
• Plugin Core
– NeoCinemaPlugin.java, NeoCinemaConfig.java
• Command Handlers & Executors
– VolumeCommand, HistoryCommand, RequestCommand, TheaterCommandExecutor, etc.
• Event Framework
– Custom events (PlayerEnterTheaterEvent, TheaterStartVideoEvent, etc.)
– Queue events under event/queue
• Theater & Queue Management
– TheaterManager, Theater classes (Public, Private, Static)
– VideoQueue, VideoRequest, VideoInfo, QueueVoteType
• Storage Layer
– Abstracted via SQLDriver, MySQLDriver, SQLiteDriver
– VideoStorage, TheaterStorage, RelationalVideoInfo, RelationalVideoRequest
• Service & Info Fetchers
– VideoURLParser, VideoInfoFetcher implementations (YouTube, Twitch, HLS, File)
• Buffer & Serialization
– PacketByteBufReimpl, PacketByteBufSerializable (for custom packet content)
• Tasks & Utilities
– PlayerListUpdateTask, ChatUtil, NetworkUtil, ProtocolLibUtil, VaultUtil
2.3 External Systems
• LibVLC / VLC media player (native library)
• External Video Services (YouTube API, Twitch API, HLS endpoints, HTTP file hosts)
• SQL Database (MySQL or SQLite)
Interactions & Data Flow
• Client → Server:
• Network payloads over Minecraft’s custom channels (outbound request: ChannelVideoRequestPayload)
• Command inputs from players trigger plugin commands via chat or GUI actions.
• Server:
1. Command/Event handling → TheaterManager & VideoService
2. VideoInfoFetcher fetches metadata from external video sources
3. Storage layer persists/retrieves queue & history in DB
4. LibVLC invoked (JNI or external process) to stream video data or metadata
5. Server broadcasts playback state updates (ChannelVideoQueueStatePayload, UpdatePreviewScreenPayload)
• Server → Client:
• Video frame updates or timeline commands via playback HUD utilities
• Client:
• Mixins alter HUD & input handling
• GUI screens render video queue/history and capture user actions
• VideoLanPlayback handles local playback streams
Architectural Patterns & Principles
• Modular separation: client vs. server codebases under separate Gradle subprojects
• Event-driven design on server (custom event classes & listeners)
• Command pattern for user-triggered actions
• Strategy/Factory for VideoInfoFetcher implementations
• Adapter pattern for SQL drivers (MySQL vs SQLite)
• Custom serialization layer for network packets