Skip to content

Instantly share code, notes, and snippets.

View vearen1's full-sized avatar
🍪
epic

vearen vearen1

🍪
epic
View GitHub Profile
@cosrnic
cosrnic / custom-player-nametags-minestom.md
Last active September 28, 2024 18:12
Minestom Custom Entity Names

Minestom Custom Nametags


Credits to Owen1212055 for their NMS guide, please read it as this is just a simple port!

The NameTagEntity Class

public class NametagEntity extends Entity {

    public static final Tag<NametagEntity> NAMETAG_TAG = Tag.Transient("nametag"); // for deleting the entity on leave
@Minikloon
Minikloon / Instructions.md
Created July 7, 2024 11:03
Minecraft Player Nametags with Custom RGB.

Preview

-Naive solution:
  1. Create a team, set its prefix or suffix to the component you want.
  2. In the PlayerInfoUpdatePacket, set the Username to ""
  3. Add "" to the team.

The player entity on the client stores the username from the player list entry with a matching UUID.

package net.hollowcube.mapmaker.map.entity.impl;
import net.hollowcube.mapmaker.map.entity.MapEntity;
import net.hollowcube.mapmaker.map.util.NbtUtil;
import net.kyori.adventure.nbt.*;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.minestom.server.coordinate.Vec;
import net.minestom.server.entity.EntityType;
import net.minestom.server.entity.metadata.display.AbstractDisplayMeta;
import net.minestom.server.entity.metadata.display.BlockDisplayMeta;
package net.minestom.server.instance;
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.IntIntImmutablePair;
import net.minestom.server.MinecraftServer;
import net.minestom.server.instance.block.Block;
import net.minestom.server.instance.block.BlockHandler;
import net.minestom.server.instance.palette.Palette;
import net.minestom.server.utils.NamespaceID;
@HSGamer
HSGamer / PerInstanceInstanceViewHook.java
Last active August 20, 2024 20:23
Minestom - Per-Instance Tablist
import net.minestom.server.MinecraftServer;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.PlayerSkin;
import net.minestom.server.event.Event;
import net.minestom.server.event.EventNode;
import net.minestom.server.event.instance.RemoveEntityFromInstanceEvent;
import net.minestom.server.event.player.PlayerSpawnEvent;
import net.minestom.server.instance.Instance;
import net.minestom.server.network.packet.server.play.PlayerInfoPacket;
import net.minestom.server.tag.Tag;