- All Supermod computers are run completely client sided
- Run
uploadto sync back changes made to the local file system - You can add files to the filesystem either by running
tac [filename] [contents]or by dragging and dropping the file onto the computer.- Remember to sync the fs afterward
- Computers are not run on a separate threat. This means that all blocking code will freeze the game.
- To combat infinite loops computers have a maximum amount of instructions set
init.luawill get run when a screen controller block is loaded or a computer is clicked
Most of the default lua library is usable as is, but supermod also provides additional features:
- Note: Reading from
System.inwill completely freeze your game. Don't do that! - Note: All fs operations are executed on the virtual file system. This includes spawning other processes
puter.on(string event, fn listener)Allows you to listen for available events:tickrenderfloat tickDeltaon_key_pressedint key, int scancode, int modifieron_char_typedchar characterscreen_interact_nearbyPosition interactPos, Position interactBlockPos, Position computerPos
puter.stop()Stops the currently running lua programputer.run(string name, List args)Runs a lua programList<string> puter.list_files()Lists all files on the fs{int x, int y} puter.get_screen_size()Returns the screen size in blocksputer.make_sound(string sound, float volume, float pitch)Make a soundPosition puter.get_pos()Returns the position of the computer blockputer.upload()Syncs the fs with the server. Requires op
Player minecraft.get_local_player()Objective minecraft.get_scoreboard(string objective)Note that only synced objectives are visible to computers.
double supermod.get_speed()supermod.request_session(string profile, fn callback)Request a super session to start for the playersupermod.mc_fn(string function_name)Run a minecraft function in thesuper_modnamespace [NOTE: This is a post fest addition]
Positiondouble|int xdouble|int ydouble|int z
Playerstring name
Position positionbool is_shift_key_downProfilestring areadouble itemUsageInfluencedouble jumpingInfluencedouble offsetdouble rotInfluencedouble speedInfluence
ObjectiveList scoresstring ownerint value
string namestring render_typestring criteria