leonjonny1234

Project: OceanScreen Client Mod (Fabric, Plugin Compatible)

Hello,

OceanScreen is a Minecraft client mod designed to work with a server-side plugin to create a block-based screen system similar to WebDisplays.

The mod connects to servers running the OceanScreen plugin and automatically detects compatibility via a handshake or plugin messaging system. If the plugin is present, the mod activates its rendering system. If not, it stays inactive.

The server plugin sends screen data such as screen IDs, coordinates, URLs, and content updates. The mod renders this data directly in the Minecraft world.

Screens are represented using black concrete blocks placed in the world. These blocks act as physical display surfaces where the mod overlays rendered content like web pages, UI elements, or dynamic updates.

The mod is fully client-side and focuses only on rendering and communication. All logic, screen placement, and management are handled by the server plugin.

Communication between mod and plugin is done through Plugin Messaging Channel or a custom packet system. The mod receives instructions such as create screen, update content, or remove screen, and updates the display in real time.

Key features: • Automatic plugin detection on join • Handshake system for compatibility check • Real-time screen rendering in-world • Black concrete based screen blocks • Live content updates from server • Lightweight and performance optimized

Version compatibility:

Designed for Minecraft 1.21 and newer versions (1.21.x → latest). The mod aims to stay version-flexible to support future updates without major rewrites.

Goal:

To create a unified system where the server plugin controls screen placement and content, while the client mod renders everything in real time inside the game world.

Kodari AI
KodariMar 31 at 12:10 pm 37,398 (v2)

Let me read the necessary documentation before writing any code.

OceanScreen
A client-side Fabric mod that connects to servers running the OceanScreen plugin to render block-based in-world screens. Automatically detects plugin compatibility via a handshake system on server join. Receives real-time screen data (create, update, remove) from the server plugin through custom payload channels and renders translucent overlays on black concrete screen surfaces. Includes in-world colored quad rendering and HUD proximity info display. Lightweight with no server-side code.
  • Register all 5 custom payloads (handshake C2S/S2C, create/update/remove screen) in the common initializer, receive them client-side

  • ScreenManager holds all active screen states; ScreenRenderer draws translucent quads on block faces via WorldRenderEvents.AFTER_ENTITIES plus a HUD proximity panel

  • Connection events drive handshake send on join and full cleanup on disconnect

Good. Now I have everything needed. Let me write all files.

OceanScreen
A client-side Fabric 1.21.4 mod that connects to servers running the OceanScreen plugin to render block-based in-world screens. Detects plugin compatibility via a handshake on server join. Receives real-time screen data through custom payload channels and renders translucent overlays on screen surfaces in the world. Includes HUD proximity display for screen info. Lightweight with no server-side logic.

Here’s a summary of every file and how they connect:

Build & Config

  • gradle.properties / build.gradle / settings.gradle — standard Fabric 1.21.4 split-source project with Loom 1.9.2

  • fabric.mod.json — environment: "*" so payload types register before client receivers

  • oceanscreen.mixins.json — empty mixin config (no mixins needed)

Common (src/main)

  • OceanScreenMod — registers all 5 CustomPayload types via PayloadTypeRegistry (must happen before any receiver registration, in the common initializer)

  • HandshakeC2SPayload — client → server, sends PROTOCOL_VERSION = 1

  • HandshakeS2CPayload — server → client, returns pluginVersion, compatible, message

  • CreateScreenPayload — server sends screen id, BlockPos, width, height, Direction (ordinal-mapped), content string

  • UpdateScreenPayload — server sends updated content string + ARGB color int

  • RemoveScreenPayload — server sends screen id to remove

Client (src/client)

  • OceanScreenClient — registers all S2C receivers, sends handshake on JOIN, clears all screens on DISCONNECT

  • ScreenData — immutable structural fields + mutable content/color; provides getCenter() for proximity checks

  • ScreenManager — ConcurrentHashMap-backed store; tracks plugin active state and version

  • ScreenRenderer — registers a NativeImageBackedTexture (1×1 white pixel) on init; renders translucent quads per screen via WorldRenderEvents.AFTER_ENTITIES using RenderLayer.getEntityTranslucentCull; white border quads around each edge; HudRenderCallback shows a proximity panel (within 12 blocks) with screen ID, content, and size, plus a top-right screen count indicator

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
16 714
src/main/java/com/oceanscreen/OceanScreenMod.java
package com.oceanscreen;

import com.oceanscreen.network.CreateScreenPayload;
import com.oceanscreen.network.HandshakeC2SPayload;
import com.oceanscreen.network.HandshakeS2CPayload;
import com.oceanscreen.network.RemoveScreenPayload;
import com.oceanscreen.network.UpdateScreenPayload;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OceanScreenMod implements ModInitializer {

    public static final String MOD_ID = "oceanscreen";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
    public static final int PROTOCOL_VERSION = 1;

    @Override
    public void onInitialize() {
        PayloadTypeRegistry.playC2S().register(HandshakeC2SPayload.ID, HandshakeC2SPayload.CODEC);
        PayloadTypeRegistry.playS2C().register(HandshakeS2CPayload.ID, HandshakeS2CPayload.CODEC);
        PayloadTypeRegistry.playS2C().register(CreateScreenPayload.ID, CreateScreenPayload.CODEC);
        PayloadTypeRegistry.playS2C().register(UpdateScreenPayload.ID, UpdateScreenPayload.CODEC);
        PayloadTypeRegistry.playS2C().register(RemoveScreenPayload.ID, RemoveScreenPayload.CODEC);
        LOGGER.info("OceanScreen payload types registered.");
    }
}