HomeJavaModsHTTP Block
HTTP Block
ModsJava

HTTP Block

by essh · on Modrinth

HTTP Block adds two redstone-powered blocks that connect Minecraft to HTTP services. Send HTTP POST requests from redstone circuits and receive HTTP…

⬇ Download on Modrinth

HTTP Block

HTTP Block adds two configurable redstone blocks that allow Minecraft to communicate with external HTTP services. The HTTP Sender can send JSON POST requests when powered by redstone, while the HTTP Receiver continuously polls an HTTP endpoint and emits a redstone pulse whenever it detects a new event. This makes it easy to exchange data between Minecraft and any application capable of sending or receiving HTTP requests, regardless of the programming language or framework used.


HTTP Sender

Right-click the block to configure it.

URL

The HTTP endpoint that will receive the request.

Example:

http://localhost:8000/event

Payload

The raw JSON body that will be sent with the request.

Example:

{ "message": "Hello" }

Behavior


HTTP Receiver

Right-click the block to configure it.

URL

The endpoint to poll for events.

Example:

http://localhost:8000/event

Note: The endpoint must return JSON matching the Event Format described below. The receiver expects that structure to detect new events correctly.

Last Message

Displays the message from the most recently received event.

Behavior


Event Format

The receiver expects the endpoint to return JSON in the following format:

{
    "timestamp": 1750412345,
    "message": "Hello",
    "hash": "6a8f6c5d..."
}
Field Description
timestamp Unix timestamp of the event.
message Text shown in the receiver GUI.
hash Unique identifier for the event. A new hash triggers a pulse.

Only the hash is used to detect new events. A simple Python Example is shown below.

Example Relay (FastAPI)

The HTTP Receiver expects an endpoint that returns events in the format shown above. Below is a minimal FastAPI relay implementation that satisfies the required API.

from fastapi import FastAPI
from pydantic import BaseModel
import hashlib
import time
import uvicorn

app = FastAPI()

latest_event = {
    "timestamp": 0,
    "message": "",
    "hash": "",
}


class EventIn(BaseModel):
    message: str


@app.post("/send_event")
async def create_event(data: EventIn):
    global latest_event
    message = str(data.message)
    timestamp = int(time.time())
    event_hash = hashlib.sha256(f"{timestamp}:{message}".encode()).hexdigest()
    latest_event = {
        "timestamp": timestamp,
        "message": message,
        "hash": event_hash,
    }
    return {"success": True}


@app.get("/get_event")
async def get_event():
    return latest_event


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=9000)

Install the required packages:

pip install fastapi uvicorn

Run the relay:

python relay.py

Then configure your blocks:

Commands

/http pollrate <ticks>

Sets how often receivers poll their configured URL.

/http pulselength <ticks>

Sets how long receiver pulses last.

/http status

Shows the current configuration and registered sender/receiver counts.

/http reload

Reloads the configuration from disk.


Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more