Functions

Any arguments with <> around them are optional.
Hit the HOME key at any point to jump to the top of the page
Hit the END key at any point to jump to the bottom of the page

attack

attack( <Number: millis> )

Causes the player to rapidly click or hold the attack keybinding (lmb) when millis is…

ValueResult
nilInstantly press and release the attack kebind.
-1Hold the attack keybind continuously.
0Cancel’s the action
millis > 0Attack keybind is held for that many milliseconds.

back

back( Number: millis )

Causes the player hold the back keybinding (s) when millis is…

ValueResult
-1Hold the back keybind continuously.
0Cancel’s the action
millis > 0Back keybind is held for that many milliseconds.

connect

connect( String: serverIP )

Attempts to connect you to a server.

customizeSkin

customizeSkin( String: Part, Boolean: value )

Turns skin layers on or off for the player.

PartsAlias
hathelmet
jacketchest
left leg
right leg
left arm
right arm
cape

disconnect

disconnect()

Leaves the server you are connected too.

drop

drop( <Boolean: Drop All> )

Throw your currently held item. (like q) If true is given as an arg then it will drop the whole stack. If no arg is passed

entityRayTrace

entityRayTrace{ … }

everything is optional

ArgTypeAliasNote
yawNumberIf set, pitch defaults to player pitch
pitchNumberIf set, yaw defaults to player yaw
toTabletarget,dest,destinationAlternative to yaw & pitch, {x,y,z} end point of the vector
fromTablesrc, sourcedefaults to player eyePos
fluidsBooleanfluid, liquid, liquids, stopOnLiquid
reachNumberdist,distance,rangeif using to vector is scaled to reach length

Defaults player eye pos, player look direction, player reach amount, and fluids true

Returns

KeyTypeNote
entityIDNumber
getEntityInfoFunctionshortcut for getEntity( .entityID )
subHitNumberidk
vecTable{x,y,z} of the hit pos

forward

Causes the player hold the forward keybinding (w) when millis is…

ValueResult
-1Hold the forward keybind continuously.
0Cancel’s the action
millis > 0forward keybind is held for that many milliseconds.

getBiome

getBiome( <Number: BlockX, Number: BlockZ> )

Returns a table with details about the biome either at the players location or the given location.

Output:

keytype
canSnowBoolean
canRainBoolean
rainfallNumber
tempString
Tempatures
ocean
cold
medium
warm

getBlock

getBlock( Number: x, Number: y, Number: z )

Returns a table with information about a block at the given position. If the block requested is not loaded or is void air then it will return false.

KeyTypeDescription
idStringThe block id, such as “minecraft:stone”
nameStringThe block name, such as “Stone”
nbtTableNBT tag data about the block
This is limited to tile entites and client side info.
harvestToolStringThe best tool to break this block.
Not every block has a harvest tool and this may be omited
mapColorTableThe color this block would be on a map in {r,g,b,a} format

getBlockLight

getBlockLight(<Number: x, Number: y, Number: z>)

Returns the current block light level at a given position. If no position is given it will use the players position.

getBlockList

getBlockList()

A bit of a misnomer, this function returns a table of all blocks and items in the game (including mods). Each entry will be what it would look like if you had an item stack of 1 in an inventory and loged it. The table uses the item id (such as minecraft:birch_stairs) as the key, and the example item as the value.

You can check what creative tabs a block or item would belong to by scanning the results from this function

getBoundingBox

getBoundingBox( Number: blockX, Number: blockY, Number: blockZ )

getBoundingBox( {Number: blockX, Number: blockY, Number: blockZ} )

getBoundingBox( Number: EntityID )

Returns a table with functions relating to a bounding box of a block or entity.
For blocks, a second return value of true or false will be returned indicating if the block is solid.

function nameargsreturn value(s)description
containsNumber: x,
Number: y,
Number: z
BooleanChecks if a point exists inside the bounding box
contractNumber: x,
Number: y,
Number: z
Makes the bounding box smaller in a direction. Negative numbers reduce the side on the negative of that axis
expandNumber: x,
Number: y,
Number: z
Makes the bounding box bigger in a direction. Negative numbers effect the negative sides.
getCenterNumber: x,
Number: y,
Number: z
Returns the center point of this bounding box
getPointsNumber: xMin,
Number: yMin,
Number: zMin
Number: xMax,
Number: yMax,
Number: zMax
Returns the points defining this bounding box
growNumber: amountExpands a bounding box on all sides.
intersectsBoundingBoxBooleanReturns true if the two bounding boxes overlap
intersectBoundingBoxBoundingBoxCreates a new bounding box where the two bounding boxes overlap.
offsetNumber: x,
Number: y,
Number: z
Moves the bounding box by the given amount
shrinkNumber: amountContracts the bounding box on all sides
UnionBoundingBoxBoundingBoxCreates a new bounding box using the MIN of one and the MAX of another
findEntityOnPathNumber: x,
Number: y,
Number: z
or
{x, y, z}
Creates a line starting from the bounding box’s center to the center + the vector.
The first entity that is found to cross this region (including the box’s size) is returned.

getChunkUpdateCount

getChunkUpdateCount()

Returns the number of chunk updates as seen in the F3 debug menu.

getEntity

getEntity( Number:ID <,Boolean coerce> )

Returns a table with information about an entity much like getPlayer().
getEntityList() can be used to locate an entity’s ID number.

If coerce is true then a luajava version of the entity is returned instead.

KeyTypeNote
nameString
classStringRecommended for checking if a mob is the correct type.
(Name tags will affect ‘name’)
posTableEntity position as {x,y,z}
dimensionTable
pitchNumberThe Up/Down rotation of the entity’s head
yawNumberThe Left/Right rotation of the entity’s head
fallDistNumberHow far the entity has fallen.
0 if the entity is not falling.
heightNumber
widthNumber
hurtResTimeNumberHow long until the entity can take damage again.
isCollidedHorizBoolean
isCollidedVertBoolean
isNoClipBooleanIf the entity can pass through blocks like a spectator
onGroundBoolean
isInvulnerableBoolean
teamStringnone or the teams name
velocity{Number, Number, Number}{x, y, z} velocity of the entity
healthNumber
isOnLadderBoolean
potionEffectsTableEach entry describes another potion effect
airNumberAmount of air remaining until the entity starts drowning
isInWaterBoolean
isInLavaBoolean
immuneToFireBoolean
isImmuneToExplosionSomeone, give this to a creeper
isOnFireBoolean
isSprintingBoolean
entityRidingTableLists all the stuff in this table, but for the entity that is being ridden.
isInvisibleBoolean
nbtTable*In some cases nbt may show up as false if an error occured getting it
uuidString
lookingAt{Number, Number, Number}What block the entity is looking at

getEntityList

getEntityList()

Returns a list of entities loaded in your chunks.

Each entity will have…

nameEither the nametag name, player name, or entity type
idID number used to get more information about this entity
classExact type of entity

getEntityNBT

getEntityNBT( Number: ID )

Return a table with just the NBT data for an entity.
ID number is from the getEntityList() function.

getFps

getFps()

Returns the current FPS as seen in the F3 debug menu.

getHotbar

getHotbar()

Returns the currently selected hotbar index.
(1-9)

getInventory

getInventory( <String: name> )

Returns a table listing the players inventory contents.
If a name is given it will return the visible part of another players inventory (or false if no player is found).

When using on another player, you can expect to only see armor and held items.

getJarLibLoaders

….Looks like this returns a table where jars can be added so require can find them..?

getLight

getLight(<Number: x, Number: y, Number: z>)

Returns the current block and sky light level at a given position. If no position is given it will use the players position.

Return values:

light level, sky, block

getLoadedPlayers

getLoadedPlayers()

Returns a list of any players in your loaded chunks.

getPlayer

getPlayer( <String: name> )

Returns a hoard of information in a table about your player (no arg), or the target player (name arg).

KeyTypeNote
nameString
inventoryTableLists everything you’d see in getInventory()
posTableEntity position as {x,y,z}
mainHandTableItem held in mainHand or false
offHandTableItem held in offHand or false
invSlotintequivilant of getHotbar()
dimensionTable
pitchNumberThe Up/Down rotation of the entity’s head
yawNumberThe Left/Right rotation of the entity’s head
expNumberPlayers experience points in this level
expLevelNumberPlayer experience level
expTotalNumberTotal experience with prior levels
eyeHeightNumberHow far from the ground the players eyes are located. Changes when sneaking.
fallDistNumberHow far the entity has fallen.
0 if the entity is not falling.
heightNumber
widthNumber
swingProgressNumberPrecentage before swing motion is complete and ready to attack again.
maxHurtResTimeNumberHow long until the entity can take damage again.
isCollidedHoriBoolean
isCollidedVertBoolean
isNoClipBooleanIf the entity can pass through blocks like a spectator
onGroundBoolean
isInvulnerableBoolean
bedLocation{Number, Number, Number}May be omitted if unset or unavailable.
teamStringnone or the teams name
luckNumberCurrent luck amount
velocity{Number, Number, Number}{x, y, z} velocity of the entity
healthNumber
hungerNumber
isOnLadderBoolean
hasNoGravityBoolean
potionEffectsTableEach entry describes another potion effect
airNumberAmount of air remaining until the entity starts drowning
isInWaterBoolean
isInLavaBoolean
immuneToFireBoolean
isImmuneToExplosionBooleanSomeone, give this to a creeper
isOnFireBoolean
isSprintingBoolean
isSneakingBoolean
isEyltraFlyingBoolean
isSleepingBoolean
entityIDNumberUsed in entity highlighting
gamemodeStringspectator, creative, survival
Seems adventure mode may show up as survival. [BUG]
entityRidingTableLists all the stuff in this table, but for the entity that is being ridden.
isInvisibleBoolean
uuidString
lookingAt{Number, Number, Number}What block the entity is looking at

getPlayerBlockPos

getPlayerBlockPos( <String: name> )

Returns the block position of either yourself or a player by name.
If a player can not be found the function will return false

The position will always be whole numbers.
If you want the decimal part, use getPlayerPos()

getPlayerList

getPlayerList()

Returns a list of players on the server. This is not limited to loaded chunks like getLoadedPlayers().

getPlayerNBT

getPlayerNBT( <String: PlayerName> )

Returns the NBT data for a player or yourself.

getPlayerPos

getPlayerPos( <String: Player Name >)

Returns the exact players position of your player or the given player. If the player can’t be found then it will return false

local x, y, z = getPlayerPos()

getProfile

getProfile()

Returns the name of the current profile from the bindings menu.

getRecipes

getRecipes( <String: item> )

Returns a list of crafting recipes. If an item is specified, any recipes whos output item id contains item in the string will be added to the list.
For example: stone will add minecraft:stone’s recipe as well as minecraft:cobblestone_stairs because it has the word stone in it.

For

local recipes = getRecipes()

The output is formated as follows: recipes[recipeType][recipeNumber]['in'/'out']
For input items:

  • shaped recipes will list items as [x][y][options]
  • shapless recipes will list items as [x][options] For output items:
  • Will list the output item directly
Currently (9.0.2) there is no method to check if additional items are returned such as a bucket from cake.

getScreen

getScreen()

Returns a new image with controls with the pixel data being a screenshot of the game.

getSettings

getSettings()

Returns a table containing any mod settings and controls for Minecraft settings.

Some useful stuff: getSettings().editor.colors.textFill controls the background color in the editor. (Transparent colors are allowed) All of the mod’s colors are defined in the settings and can be changed to whatever you like.

getSettings().chat.maxLines Controls the number of lines the chat can store before it starts removing messages. By default Minecraft has this as 100. Changing this can be useful for looking at large tables in chat. A good number to use would be 1000.

Making the maxLines too large may cause lag after many messages accumulate.

getSettings().scriptBrowser.columns Controls how many columns are in the file browser. (Too many may cause them to overlap) getSettings().profiles This is the table where each binding profile is saved. You can edit them from here if you want to do so. getSettings().minecraft Returns a table with functions for changing Minecraft settings

Function NameArgsReturn Value(s)Description
getFovNumberCurrent FOV
setFovNumber:FOVSets FOV. Can be out of normal range.
getVolumeString:CategoryNumberGets the volume for a selected sound category.
[See table below]
setVolumeString:Category,
Number:volume
Sets the volume for some category.
[See table below]
setRenderDistanceNumberSets your render distance. Value is clamped to range of 2 to 32
getRenderDistanceNumberReturns the render distance setting.
setFullscreenArg defaults true. Sets the game to fullscreen or exits fullscreen with false.
isFullscreenBooleanIs the game full screen.
getSkinCustomizationTableReturns a table listing if a skin layer is on or off.
getSkinCustomizationStringBooleanReturns a boolean indicating if a skin layer is on or off.
getMaxFpsNumberReturns the FPS limit
setMaxFpsNumberSets the max FPS
setAdvancedItemTooltipsBooleanEnable or disable advanced tooltips. (shows durability and id on items)
isAdvancedItemTooltipsBooleanCheck if advanced tooltips are visible
getSmoothLightingStringLighting mode of off, min, or max
setSmoothLightingString:ModeSets smooth lighting mode. Modes are off, min, or max
setAutoJumpBoolean:autoJumpSets if the player uses auto jump.
isAutoJumpBooleanReturns if the player has auto jump enabled.
getChatOpacityNumberReturns current opacity of the chat
setChatOpacityNumber
getChatScaleNumber
setChatScaleNumber
getChatHeightFocusedNumber
setChatHeightFocusedNumber
getChatHeightUnfocusedNumber
setChatHeightUnfocusedNumber
setChatWidthNumber
getChatWidthNumber
setCloudsModeStringSets the mode for cloud rendering. Modes are off, fast, or fancy.(not case senstive)
getCloudsModeStringReturns render mode for clouds. Modes are off, fast, or fancy
setDifficultyStringSets the difficulty using the difficulty name. peaceful,easy,normal,hard
setDifficultyNumberSets the difficulty using:
0 forpeaceful
1 foreasy
2 fornormal
3 forhard
getDifficultyStringReturns the current difficulty as a string
setVsyncBooleanSets if the game should use vsync
isVsyncBooleanReturns true if render settings has vsync enabled
setEntityShadowsBooleanSet if the game should render shadows for entities
isEntityShadowsReturns true if the game currently renders entity shadows
setFancyGraphicsBooleanSets if the game should use fancy graphics
isFancyGraphicsBooleanReturns true if the game is currently using fancy graphics
setGuiScaleStringSets the GUI scale to one of the following modes:
auto, small, normal, large
getGuiScaleStringReturns the current GUI scale as a string.
setHeldItemTooltipsBooleanFor versions 9.0.2 and earlier, function acts the same as: setAdvancedItemTooltips
Sets if held item tooltips are enabled.
isHeldItemTooltipsBooleanReturns true if held item tooltips are enabled
setInvertMouseBooleanSets if the mouse should be inverted
isInvertMouseBooleanReturns true if the mouse is being inverted
getLanguageStringReturns the language code for the current language.
Example: en_us
getLanguagesTableReturns a table with all valid language codes.
setLanguageStringSets the current language used by the game
getLastServerStringReturns the ip of the last server the player was connected to.
getMainHandSideStringReturns which hand is used as the main hand.
Sides are left and right
setMainHandSideStringSet which hand is used as your main hand
getMipmapLevelsReturns the current mipmap level
setMipmapLevelsNumberSets the number of mimpap levels used.
getMouseSensitivityNumberReturns the current mouse sensitivity setting
setMouseSensitivityNumberSets the mouse sensitivity
setParticleLevelStringSets the particle level for rendering. Options are:
all
decreased
minimal
getParticleLevelStringReturns the current particle level as a string
setPauseOnLostFocusBooleanSets if the game should pause if you switch out of the game.
Equivilant of: F3+P
isPauseOnLostFocusCheck if the game will pause if no longer focused.
setSmoothCameraBooleanSet if smooth camera is enabled
isSmoothCameraCheck if smooth camera is enabled
setPerspectiveStringChanges the players camera view like F5. Options are:
first
front
back
getPerspectiveReturn the players perspective as a string
setTouchscreenModeBooleanSet if touchscreen mode should be used
isTouchscreenModeBooleanCheck if touchscreen mode is enabled
setViewBobbingBooleanSet if view bobbing should be used.
isViewBobbingCheck if view bobbing is enabled.
Sound Categories
master
music
record
weather
block
hostile
neutral
player
ambient
voice

getSettings().save() Saves all changes you made to settings. Be sure to call this after making changes.

getSkyLight

getSkyLight( <Number:x, Number:y, Number:z> )

Returns the light level provided from the sky at a given position or the players current block pos.

getSound

getSound( String:file ) Returns a table with controls for playing a sound. When a sound stops because it has finished playing or has been stopped with the stop function the resources are released and are not reuseable.

Unlike playSound, getSound follows the same file access rules the rest of the mod follows [Link needed].
With no prefix on the file this is the same folder as your script runs from

Controls:

Function NameArgsReturn Value(s)Description
isPlayingBooleanReturns true if this instance of the sound is currently playing.
stopStops this instance of a sound also causeing an resources used to be released.
loopNumberSets the number of times to play the sound.
-1 and nil will loop endlessly
pauseStops the audio without discarding resources. Playing will resume where the sound stopped.
playStarts or resumes playing of an audio clip.
setVolumeNumberSets the volume for the sound. Volume should be between 0 and 1.

getWorld

getWorld()

Returns a table containing information about the current world or false if you are not currently in a world.

KeyTypeNote
borderTableworld border
cleanWeatherTimeNumberseems to always be 0
difficultyString"peaceful","easy","normal","hard"
gameTypeString"creative","spectator","survival","adventure"
isDaytimeBoolean
isDifficultyLockedBoolean
isHardcoreBoolean
isRemoteBoolean…true even in single player?
moonPhaseNumber
nameString
rainTimeNumberalso always 0
seedNumberminecraft world seed, 0 if unavailable
spawnTable{x,y,z}
weatherStringclear,rain,thunder Never clear directly to thunder or back
worldTimeNumberin ticks

border

KeyTypeNote
centerXNumber
centerZNumber
dmgAmountNumber
radiusNumber
sizeNumberslightly smaller than radius
warningDistNumber

moonPhase

valuename
0Full moon
1Waning gibbous
2Last quarter
3Waning crescent
4New Moon
5Waxing crescent
6First quarter
7Waxing Gibbous

highlightEntity

highlightEntity( Number: entityID, String: action <,Boolean: active> )

Causes an entity to be rendered as glowing or rendered on top of everything else.

actions
glowGlowing effect
xrayRender on top

httpRequest

**httpRequest{ args… }

ArgTypeOptionalDefaultNote
urlstringNohttp: or https: is required in url
requestMethodstringYesGET
requestPropertiestableYesnil
timeoutnumberYes10value is in seconds
doOutputbooleanYesfalseset to true if you need to send data to the server
followRedirectsbooleanYes?

Returns

Table

ValueTypeNote
disconnectFunctiondisconnect from the server
errFunctionreturns error input stream
getContentEncodingFunction
getContentLengthFunctionreturns number of bytes
getFollowRedirectsFunction
getHeaderFieldsFunctionreturns table with headers
getResponseCodeFunctionreturns number
getURLFunctionreturns url used for this request
inputFunctionreturns input stream used to read from server

httpQuick

httpQuick( String:url )

Returns

Table

ValueTypeNote
.codeNumberhttp response code integer
.headersTableresponse headers from server
.lengthNumberlength of response in bytes
.responseStringstring returned by server
:parse()Booleanturns json response into table, returns success
.jsonTablewhen parsed, json as table
:save( String:file )saves as file in "~/downloads/"..file
:status()fancy print on chat
.timeNumbermilliseconds since request and full receive
.typeTable.response.headers['Content-Type']
.urlStringUrl from function call

Since

MCAM
1.12.27.11.0

isKeyDown

isKeyDown(String: keyName)

Returns a boolean if a key is held or mouse button is held. The key name will match the name used in the bindings menu.

Also works with mouse buttons
Please note the key names changed between MC versions

jump

jump() Makes the player jump

key

key( String:keyName <, Number:duration> )

Holds the key with the matching name down for duration seconds.
Default duration is 0,

When duration <= 0 the key is released

Duration is in milliseconds

left

left( <Number: duration>)

Holds the left strafe key (a) for the provided duration.
Default duration is 0,

When duration <= 0 the key is released

Duration is in milliseconds

listTextures

listTextures() returns a list of textures.

Try in REPL

tex = listTextures()
b = hud3D.newBlock()
b.changeTexture("block:"..tex[11])
b.enableDraw()

loader

?

log

log( … ) Writes text to the chat.

Only you can see text written by log

Basic usage

log"Hello world!"
log("Hello"," ","world!")
log("You're using AM v",_MOD_VERSION)

Coloring & Formatting

You can add & codes to color/format your text.
Formatting is applied up until the next color change or arg

log("&aHello World") --green
log("&aHello &BWorld") --green then green &bold
log("&BHello &aworld") --bold & white, then green and not bold
log("&aHello"," world") --world is written with wite text
You can escape your & by writing them as &&
log"This && That"
& CodeEffect
0Reset all formating, Color to BLACK
1Reset all formating, Color to DARK BLUE
2Reset all formating, Color to DARK GREEN
3Reset all formating, Color to DARK AQUA
4Reset all formating, Color to DARK RED
5Reset all formating, Color to DARK PURPLE
6Reset all formating, Color to GOLD
7Reset all formating, Color to GRAY
8Reset all formating, Color to DARK GRAY
9Reset all formating, Color to BLUE
aReset all formating, Color to GREEN
bReset all formating, Color to AQUA
cReset all formating, Color to RED
dReset all formating, Color to LIGHT PURPLE
eReset all formating, Color to YELLOW
fReset all formating, Color to WHITE
BBold
IItalics
OObfuscated
SStrikethru
UUnderlined
REPL history doesn't start empty, hit up until you find a colorful message

Click Events

When a click & code is added, the next argument after the string is consumed

log("&a&NHover here&f &b&U&FClickMe","A &atooltip&f!",function(formatted,unformatted) log"You clicked it!" end, " &d&U&FAnother clickable", {hover="Do it!", click=function(formatted,unformatted) log("&a&BIt worked!") end})
& CodeEffectConsumes
FFunction - Triggeres a function, receives args (formattedText, unformattedText)Function
RRun - Causes the player to say something, usually used for commandsString
TType - Suggest text, puts text into the chat input without pressing enterString
LLink - URLString URL or table {click=”url”, hover=”tooltip text”}
NNone - No click action, only tooltipString tooltip or table {hover=”tooltip text”}
*Open File - Like the link for a screenshotString file

look

look( Number:yaw, Number:pitch <, Number:millis> )

Make the player turn their head to some yaw and pitch.

If millis is not provided, head instantly snaps to the angle

If millis is provided, head smoothly turns over that many milliseconds.
(Non blocking)

lookAt

**lookAt( Number:x, Number:y, Number:z <, Number:millis>)

Make the player turn their head to some x,y,z.

If millis is not provided, head instantly snaps to the angle

If millis is provided, head smoothly turns over that many milliseconds.
(Non blocking)

If you want to look at the center of a block, add .5 to the x,y & z

narrate

narrate( String text <, Boolean:stopCurrentSpeach> )

Does text to speach for text
if the narrator is already saying somethign and stopCurrentSpeach is true, the narrator will be interrupted, else queued.
Default: false

newMutex

newMutex( String:name )

Creates a reference to a mutex used for thread saftey.
A mutex created with the same name as another both refer to the same lock.

Behavior

When a mutex is locked, no other threads will be able to lock until the thread that locked it unlocks it (or is cleaned up).

Example

Preventing spam
local function noSpam()
  local mutex = newMutex"theincgi_noSpam" --unique name
  if not mutex.tryLock() then 
    return
  end

  playSound("chimes.wav").play()
  sleep(2000) --cooldown for playing the sound

  mutex.unlock() --important!
end

for i=1,10 do
  noSpam()
  --try it without the mutex if you want to hear the difference
  --playSound("chimes.wav").play()
  waitTick()
end

Preventing race conditon

View here

openInventory

openInventory()

Returns a table containing controls for interacting with inventories

Returned table contains…

KeyValueNote
LMB0Constant used for left mouse button
MMB2Constant used for middle mouse button
RMB1Constant used for right mouse button
clickfunction
closefunction
closeAndDrop
dragClick
drop
getHeld
getMap
getSlot
getTotalSlots
getType
grabAll
hotSwap
mapping
quick
setRecipe
split
swap

Click

.click( Number:slot <,Number:button> ) As if you clicked on a slot using your mouse

Close

.close() Closes the gui without dropping items held by the mouse

CloseAndDrop

.closeAndDrop() Normal behavior of closing the inventory screen, items dropped to ground if held by mouse.

DragClick

.dragClick( Table:slots <,Number:button> ) Distribute items across slots in order

Drop

.drop( Number:slot <,Boolean:stack>) Drop the item in the provided inventory slot.
If stack is true, the whole stack is dropped instead of 1 item.
Default: false

GetHeld()

**.getHeld()** returns `false` or the item held by the mouse.

If coerce is true, a the ItemStack is returned as userdata

GetMap()

.getMap() returns the slot mappings for the current container/inventory.

Typical Usage
local inv = openInventory()
local map = inv.getMap()
inv.click( map.hotbar[3] ) --clicks 3rd slot in hotbar
Possible Sections
NameTypeNote
hotbarTablePlayers hotbar
mainTableThe first 3 rows of your inventory
bootsNumberEquipment slot
leggingsNumberEquipment slot
chestplateNumberEquipment slot
helmetNumberEquipment slot
offHandNumber
craftingInTablekeys are 1 to 4 or 1 to 9 depending on screen
craftingOutNumber
slotNumberThe only slot in a beacon
fuelNumberin brewing stand or furnace
inputNumberTop slot in brewing stand, anvil, villager or furnace
outputNumberIn brewing stand, anvil, villager or furnace
contentsTableWhen viewing a chest, dispenser, dropper or hopper
itemNumberLeft slot in anvil
materialNumberSecond slot in anvil
toolNumberEnchanting table
lapisNumberEnchanting table

GetSlot

**.getSlot( Number:slot <,Boolean:coerce> )

If coerce is true, a the ItemStack is returned as userdata

You can craft in the 2x2 even while you're not looking at your inventory screen
It's possible to stash items in your crafting slots.
These items will drop when you open and close your inventory next, and will likely drop if you log out

GetTotalSlots()

.getTotalSlots() returns the total number of slots for the current inventory

GetType()

.getType() returns the name of the current inventory

common ones with mappings are:

inventory
enchantment table
villager
anvil
beacon
brewing stand
chest
double chest
crafting table
dispenser
furnace
hopper
horse inventory
shulker box

GrabAll

.grabAll( Number:slot )

Like when you quickly double click an item to pick up all of the same type

HotSwap

**.hotSwap( Number:slot, Number:hotbarSlot ) Like when you hover an item in your inventory and hit a number key to switch items

hotbar slot is a mapped slot, not 1-9

Mapping

table This is used by .getMap() and contains all container mappings listed by inventory type .getMap() basically does this:

local map = inv.mapping[ inv.getType() ]

Quick

**.quick( Table:slots, <,Number: limit> ) ** **.quick( Table:slots ) **

For quickly transfering inventory contents into a container #CHECK_ME

SetRecipe

.setRecipe( Number:recipeID <,Boolean:makeAll> )

Emulates clicking on a recipe from the recipe book.
recipeID is from getRecipes

If makeAll is true then it acts like shift clicking the recipe pulling in as many ingredients as it can.

pRun

pRun( String:file ) pcall, but for run

pickBlock

pickBlock() Middle click action

Survival: select hotbar slot with item or move item from inventory to current hotbar slot

Creative: select hotbar slot with item orcopy item to hand

pickItem

**pickItem( String:name <, Number:slot )

Attempts to pick an item from your inventory If it exists it is picked from hotbar or moved to the prefered slot Slot number is returned or false if none found

Source can be found here

playSound

playSound( String:soundName )

Counterintuitively this returns controls for playing a sound.

Sounds are located in ~/sounds (AM Root dir)

If you’re planning to share your code, it’s instead recommended to use getSound.

ControlsReturnsNote
.isPlaying()Boolean
.stop()stopped, next play is from start
.loop()Loop times times, forever if <code>nil`
.pause()pause audio, can resume
.play()play/resume audio
.setVolume( Number:volume )volume is a %, so 0 to 1
.getClip()UserdataLuaJava of audio clip

print

print(…)

Puts text in the console.

This does not show up in the chat, it shows up in the Minecraft console.

rayTrace

**rayTrace(<,vector3d:from> <,Number:reachDistance <,Boolean stopOnLiquid>>)**

vector2d can be either yaw,pitch or {yaw,pitch}

vector3d can be either x,y,z or {x,y,z}

Returns false or a table containing info about the trace result

This does not show results for entity hits, see

If hit block:

KeyNote
blockTable containing dmg, id and name
pos{x,y,z} block pos
sideup down north east west south
subHitidk
vec{x,y,z} exact location of ray intersection

right( <Number: duration>)

Holds the right strafe key (d) for the provided duration.
Default duration is 0,

When duration <= 0 the key is released

Duration is in milliseconds

run

run( String:file, … )

Runs a script like a function returning any results.

Unlike require this does not save the returned results and instead runs it each time.

File access rules apply. File is local to the directory of the caller.

you can use filesystem.resolve("",2) to get the local directory of something earlier in the stack trace, 1 being the current scope and 2 being the previous caller

runThread

runThread( String file, … ) runThread( function:task, … )

Instantly starts the given file or function in a new thread with provided args.

Returns a table with thread controls for checking status and killing the thread if needed.

If you don’t wish to start the thread immediatly you can instead do

local myThread = thread.new( myFunction )
--or
local myThread = thread.new( function(...) run( "myScript.lua", ...)) end )
--then later
myThread.start()

say

say( String:msg ) Causes the player to speak into the chat. This can be used to run commands as well, just don’t forget the /!

setHotbar

setHotbar( Number:slot ) Selects the hotbar slot.

Slot numbers are 1 through 9

setProfile

setProfile( String:profileName ) Changes the active profile in the bindings menu

returns false if the profile could not be found.

sleep

sleep( Number:milliseconds )

Causes the script to pause for the given number of milliseconds.

sneak

**sneak()**

Holds the sneak key (shift) for the provided duration.
Default duration is 0,

When duration <= 0 the key is released

Duration is in milliseconds

sprint

**sprint()**

Default: true, start sprinting

Causes the player to start or stop sprinting

stopAllScripts

stopAllScripts

Kills all running scripts. Like hitting CTRL+AM Menu Key and clicking each little [x]

There's a shortcut for this: CTRL+ALT+SHIFT+AM Menu Key

swapHand

swapHand()

Switches your main hand’s item with your off hand’s item.

toast

**toast(<, String:detail> )** Creates a popup notification

Default text for both is nil

use

use( <Number: duration> ) use()

Holds the use key (a) for the provided duration.

When duration <= 0 the key is released

If no number is provided then it does an instantaneous click

Duration is in milliseconds
You can click faster than Minecraft allows mouse input for with this

waitTick

waitTick()

Causes the script to sleep until the next Minecraft tick starts.