Repository navigation
For mod authors
Depend on billboard_api and register your block entity type once:
BillboardApi.CLIENTS.registerForBlockEntity((typewriter, side) -> new TypewriterClient(typewriter), TYPEWRITER);
final class TypewriterClient implements LuaClient {
private final TypewriterBlockEntity typewriter;
TypewriterClient(TypewriterBlockEntity typewriter) { this.typewriter = typewriter; }
public String type() { return "typestones:typewriter"; }
public void methods(LuaMethods m) {
m.add("getStatus", args -> typewriter.status().name().toLowerCase())
.add("type", args -> { typewriter.type(args.string(1), args.optInteger(2, 1)); return null; });
}
}BillboardApi.CLIENTS is a Fabric block API lookup. Only block entities can be machines, because the library stores each
machine's name (and who placed it) on its block entity.
- Methods run on the server thread inside the box's time slice, so take the order and do the work in your own tick.
- Arguments and results are plain Java values:
null,Boolean,Number,String,byte[],List,Map. AnObject[]returns several values (false, "reason"). ACompletableFuturemakes the program wait until it is done. - Throw
LuaExceptionfor a Lua error.LuaArgshas getters (string,integer,optNumber,list, ...) that throw the right message for a wrong argument. - The library adds
getName,setNameandgetTypeto every machine. A machine that defines one of them gets an error in the log, and its own method is ignored.
args.caller() is a LuaCaller: the same object for one run of one box, isActive() false after the program ends, is
stopped or its box is broken, describe() for messages, and file(name) for the box's files (for a machine that shows
an image the program names). Use it to let one program claim your machine: claim() returns true, or false plus
caller.describe() of the holder, and the claim is dropped when isActive() turns false.
Only the package de.knito.billboard.api is API; everything under impl may change in any release.
Billboard API by Claude and Konitor · MIT License · Source · Report a problem · Made with Claude AI.
Basics
Reference
Mod authors