World block displays
WorldBlockDisplay shows a block or item hovering at a world position, with client-frame-driven spin and bob animation defined by a BlockDisplaySpec. Useful for hub-pad indicators (“your target is X”), winner trophies, decorative props, and any “floating thing” you’d otherwise have to fake with armour stands.
When to use it
Section titled “When to use it”- You want a spinning yellow-wool indicator hovering above a hub pad.
- You want a per-player “your block this round is X” floater above the player’s head.
- You want a static trophy at the centre of the celebration platform.
package me.zlex.conduit.display;
public final class WorldBlockDisplay { public static void init(); // call once from your ModInitializer
// Per-player, auto-id (starts at 9000): public static int show(ServerPlayer p, Vec3 pos, Item item, BlockDisplaySpec spec); public static int show(ServerPlayer p, Vec3 pos, Block block, BlockDisplaySpec spec);
// Per-player, stable id: public static void showWithId(ServerPlayer p, int id, Vec3 pos, Item item, BlockDisplaySpec spec); public static void showWithId(ServerPlayer p, int id, Vec3 pos, Block block, BlockDisplaySpec spec); public static void showWithId(ServerPlayer p, int id, Vec3 pos, ItemStack stack, BlockDisplaySpec spec);
public static void hide(ServerPlayer p, int id);
// World-wide (re-sent on join): public static void worldShow(MinecraftServer server, ResourceKey<Level> dim, int id, Vec3 pos, Block block, BlockDisplaySpec spec); public static void worldShow(MinecraftServer server, ResourceKey<Level> dim, int id, Vec3 pos, Item item, BlockDisplaySpec spec); public static void worldHide(MinecraftServer server, int id);}
public record BlockDisplaySpec( float rotationDegreesPerSecond, float bobAmplitude, float bobPeriodSeconds, float scale) {
public static final BlockDisplaySpec HOVER; // slow spin + gentle bob public static final BlockDisplaySpec FAST; // fast spin, larger bob, slightly bigger public static final BlockDisplaySpec STILL; // no animation}Example
Section titled “Example”import me.zlex.conduit.display.BlockDisplaySpec;import me.zlex.conduit.display.WorldBlockDisplay;import net.minecraft.server.MinecraftServer;import net.minecraft.world.item.Items;import net.minecraft.world.phys.Vec3;
public final class HubPadIndicator {
public static void paintPad(MinecraftServer server) { WorldBlockDisplay.worldShow(server, me.zlex.conduit.instance.HubManager.HUB, /* id */ 9500, new Vec3(4.5, 103.5, 0.5), Items.YELLOW_WOOL, BlockDisplaySpec.HOVER); }
public static void showRoundTarget(ServerPlayer p, Vec3 above, Items target) { WorldBlockDisplay.show(p, above, target, BlockDisplaySpec.FAST); }}- Animation is client-frame-driven — smooth at the player’s framerate, not tied to the server tick.
- Blocks without an item form (lava, fire, structure) fall back to
minecraft:barrier. Use theItemStack/Itemoverloads for explicit control. - Auto-id range starts at 9000. World-wide editor ids start at 10000. Pick stable ids outside both to avoid collisions.