TESSERA

systems 03

API

com.prisma.tessera.api.Tessera is a static utility class. There is no service registration and no event API in 2.0.0; call the static methods directly.

Add Tessera to your plugin.yml as a depend or softdepend so it loads first, and guard your calls with Tessera.isLoaded().

Items

import com.prisma.tessera.api.Tessera;

ItemStack stack = Tessera.getItem("ruby_sword");   // null when unknown
ItemTemplate tpl = Tessera.getTemplate("ruby_sword");
boolean exists   = Tessera.exists("ruby_sword");
Set<String> ids  = Tessera.getAllIds();

boolean custom   = Tessera.isCustomItem(stack);
String id        = Tessera.getCustomItemId(stack);  // null when not a Tessera item

getItem builds a fresh stack from the template every call, so you can change it freely.

Blocks

boolean isCustom = Tessera.isCustomBlock(block);
String blockId   = Tessera.getCustomBlockId(block);
BlockTemplate t  = Tessera.getBlockTemplate("ruby_block");

Tessera.placeBlock(location, "ruby_block");
Tessera.removeBlock(location);

placeBlock writes the id into the chunk container and sets the base material, the same way a player placement does.

Furniture

boolean isFurniture = Tessera.isFurniture(entity);
String furnitureId  = Tessera.getFurnitureId(entity);
FurnitureType type  = Tessera.getFurnitureType("oak_chair");

Entity spawned = Tessera.spawnFurniture(location, "oak_chair", yaw);

Text and HUD

String withChars = Tessera.replaceGlyphs("<white>:ruby:</white> Ruby");
Component comp   = Tessera.format("<gray>Hello :heart:</gray>");  // glyphs, then MiniMessage

Tessera.toggleHud(player);   // returns the new state
Tessera.openMenu(player);    // opens the item browser

Signature summary

MethodReturns
isLoaded()boolean
getItem(String id)ItemStack or null
getTemplate(String id)ItemTemplate or null
exists(String id)boolean
getAllIds()Set<String>
isCustomItem(ItemStack)boolean
getCustomItemId(ItemStack)String or null
isCustomBlock(Block)boolean
getCustomBlockId(Block)String or null
getBlockTemplate(String id)BlockTemplate or null
placeBlock(Location, String id)void
removeBlock(Location)void
isFurniture(Entity)boolean
getFurnitureId(Entity)String or null
getFurnitureType(String id)FurnitureType or null
spawnFurniture(Location, String id, float yaw)Entity or null
openMenu(Player)void
replaceGlyphs(String)String
format(String miniMessage)Component
toggleHud(Player)boolean

The config comments show getAllIds() returning a List<String>. It returns a Set<String>.

Identifying items yourself

Tessera ids are stored in the item's PersistentDataContainer, so you can also read them without the API if you prefer. Use isCustomItem and getCustomItemId rather than comparing display names.