Inter-Plugin Communication (IPC)
Pisual exposes a message-based IPC protocol on Pumpkin MC. Other plugins running on the server can dispatch JSON messages to spawn, update, relocate, or remove holograms programmatically at runtime.
Protocol Basics
Pisual handles IPC calls through Pumpkin's native pumpkin_plugin_api::ipc subsystem. When sending an IPC message, serialize the request struct to a JSON byte vector (Vec<u8>) and target plugin identifier "Pisual".
- Transport: Native WebAssembly component model IPC channel.
- Data Encoding: UTF-8 JSON payloads.
- Target Identifier:
"Pisual"(case-sensitive). - Response: Serialized JSON object implementing the standard
IpcResponsewrapper.
Integration Guide
Add the dependencies below to your calling plugin's Cargo.toml:
[dependencies]
pumpkin-plugin-api = "0.1.0-dev"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Dispatching a message to Pisual from Rust:
use pumpkin_plugin_api::ipc;
pub fn spawn_hologram() -> Result<(), String> {
// 1. Build JSON request payload
let payload = serde_json::to_vec(&serde_json::json!({
"action": "create",
"id": "welcome_board",
"world": "world",
"position": [0.0, 65.0, 0.0],
"lines": ["&6&lSERVER SPAWN", "&7Welcome to Pumpkin MC!"]
})).map_err(|e| e.to_string())?;
// 2. Send message to Pisual
let response_bytes = ipc::send_ipc_message("Pisual".to_string(), payload)
.map_err(|e| format!("IPC transport failed: {e}"))?;
// 3. Parse JSON response
let response: serde_json::Value = serde_json::from_slice(&response_bytes)
.map_err(|e| format!("Malformed response: {e}"))?;
if response["success"].as_bool().unwrap_or(false) {
Ok(())
} else {
let err = response["error"].as_str().unwrap_or("Unknown error");
Err(err.to_string())
}
}
Interactive Request Builder
Select an action and configure fields to generate formatted JSON payloads and caller Rust snippets.
Action Reference
Creates a persistent hologram. Saved automatically to disk in plugins/Pisual/holograms.json and restored upon server reload.
| Field | Type | Status | Description |
|---|---|---|---|
| action | "create" | required | Action identifier string |
| id | string | required | Unique hologram identifier |
| world | string | required | Target world name |
| position | [f64, f64, f64] | required | Coordinates [X, Y, Z] |
| lines | string[] | required | List of text lines (supports Minecraft color codes) |
| ram | boolean | optional | If true, excludes hologram from disk persistence |
| billboard | BillboardType | optional | "center", "vertical", "horizontal", "fixed" |
| shadow | boolean | optional | Default true. Renders text drop shadow |
| see_through | boolean | optional | Default false. Visible through obstacles |
| scale | [f32, f32, f32] | optional | Default [1.0, 1.0, 1.0] |
{
"action": "create",
"id": "rules_board",
"world": "world",
"position": [10.0, 65.0, 0.0],
"lines": ["&c&lSERVER RULES", "&f1. Respect players"],
"billboard": "vertical"
}
Creates an ephemeral in-memory hologram. It performs zero disk I/O, making it suitable for fast-updating counters, timers, and temporary display text. It will not be restored upon server restart.
{
"action": "create_ram",
"id": "timer_arena_1",
"world": "arena",
"position": [50.0, 70.0, 50.0],
"lines": ["&eMatch begins in: &a10s"]
}
Updates lines or visual parameters of an existing hologram. If lines are added or removed, text display entities are spawned or despawned accordingly.
{
"action": "edit",
"id": "rules_board",
"lines": ["&c&lNEW RULES", "&aHave fun!"],
"shadow": false
}
Teleports a hologram to a new coordinate position. Supplying the optional world field relocates the hologram to a different loaded world.
{
"action": "move",
"id": "rules_board",
"world": "world_nether",
"position": [0.0, 80.0, 0.0]
}
Despawns text display entities from the world and deletes the hologram from memory and disk.
{
"action": "delete",
"id": "rules_board"
}
Retrieves the full data structure for a single hologram by ID.
{
"success": true,
"data": {
"id": "rules_board",
"world_name": "world",
"position": [10.0, 65.0, 0.0],
"lines": ["&c&lSERVER RULES", "&f1. Respect players"],
"billboard": "vertical",
"shadow": true,
"see_through": false,
"scale": [1.0, 1.0, 1.0]
}
}
Returns an array containing all active holograms currently loaded in memory.
{
"action": "list"
}
Billboard Types
Determines how the hologram rotates relative to players in Minecraft:
| Mode | Behavior |
|---|---|
"center" |
Default. Rotates both yaw and pitch directly toward observing player. |
"vertical" |
Standard upright billboard. Rotates around Y-axis only without tilting up or down. |
"horizontal" |
Faces upward or flat against horizontal surfaces. |
"fixed" |
Fixed angle in the world, does not rotate toward players. |
Response Schema
Every IPC request receives an IpcResponse JSON structure:
pub struct IpcResponse {
pub success: bool,
pub message: Option<String>,
pub error: Option<String>,
pub data: Option<serde_json::Value>,
}
Error Handling
When success is false, the error field contains a descriptive failure string.
| Error Condition | Returned Message |
|---|---|
| Duplicate ID | Hologram with ID '...' already exists! |
| World Not Loaded | World '...' is not loaded |
| Hologram Not Found | Hologram '...' not found |
| Malformed JSON | Invalid request payload: <details> |