Skip to content

Clientside Scripting API #4

Description

@EmpyTM

Note: this does not include what is in https://github.com/ClassiCube/ClassiCube-Plugins/tree/master/Scripting

bind

Functions

bind.lookupBinding(bindName)

  • returns the key that the bind is called from
  • this function will also return true if the bind is bound to input, otherwise false

Events

bind.onBindActivated(uniqueIdentifier, callback(keybind))

  • called when a bind has been pressed
  • keybind is the bind that was last detected

block

Functions

block.getTexture(blockID, face)

  • returns the corresponding texture to its face number

block.getSize(blockID)

  • returns the width, height, and length of the block as a key-value table, e.g. {x = 16, y = 8, z = 16}

block.getShape(blockID)

  • returns the shape type
  • valid return values are of the enums shapeBlock = 0 and shapeCross = 1

block.getCollisionType(blockID)

  • returns the collision type of the block id

block.setFogColor(blockID, red, green, blue)

  • sets the fog color of the block

block.setTexture(blockID, textureID, face)

  • sets the texture of the block using the current texture atlas
  • face paremeter is optional, by default the texture will apply to all faces

camera

Functions

camera.setPitch(p)

  • sets the pitch of the camera in degrees

camera.setYaw(y)

  • sets the yaw of the camera in degrees

env

Functions

env.getCloudsColor()

  • get the clouds color

env.getCloudsHeight()

  • get the cloud's current height in the map

env.getCloudsRate()

  • get the cloud's current speed in the map

env.getFogColor()

  • get the current fog color

env.getShadowColor()

  • get the current shadow color

env.getSkyColor()

  • get the current sky color

env.getSunlightColor()

  • get the current sun color

env.getWaterLevel()

  • get the current water level

env.getWeather()

  • get the current weather
  • return either sunny = 0, rainy = 1, or snowy = 2

env.getWeatherRate()

  • returns the current speed of the weather

env.setCloudsColor(red, green, blue)

  • set the clouds color

env.setFogColor(red, green, blue)

  • set the color of the fog

env.setShadowColor(red, green, blue)

  • set the shadow color

env.setSkyColor(red, green, blue)

  • set the sky color

env.setSunlightColor(red, green, blue)

  • set the sunlight color

env.setWaterLevel(level)

  • set the current water level

Events

env.onVariableChanged(uniqueIdentifier, callback(envProperty))

  • called whenever some aspect of the environment was changed
  • envProperty - the env var on the client that was actually changed
  • this triggers no matter if the client or server changes it

game

Events

game.onBlockChanged(uniqueIdentifier, callback(block))

  • called when a block has been changed
  • block - the unique block in the world that was changed

game.think(uniqueIdentifier, callback)

  • a generic event that is called every frame

hacks

Functions

hacks.breakableLiquids(bool)

  • enables liquids to be broken like a block

hacks.cameraClipping(bool)

  • enables the camera to ignore being affected by map geometry

hacks.enable(bool)

  • enables or disables all clientside hacks

hacks.fullBlockStepping(bool)

  • enables traversing taller blocks as if they were short enough to walk up and down

hacks.getSpeedMultiplier()

  • returns the current speed multiplier

hacks.getJumpHeight()

  • returns the current jump height

hacks.noclipSlide(bool)

  • enables sliding after noclipping

hacks.pushbackPlacing(bool)

  • enables being pushed up or away from blocks if the block placed were to occupy your current position

hacks.setSpeedMultiplier(multiplier)

  • set the current speed multiplier

hacks.setJumpHeight(height)

  • set the jump height

hacks.womStyleHacks(bool)

  • enables or disables the "wom-style" hacks

inventory

Functions

inventory.getPage()

  • returns the current alt-page the player has open

inventory.isSlotEmpty(slot)

  • returns if the inventory slot has a block within

inventory.moveCursorTo(slot)

  • highlights the slot

inventory.selectPage(pageNumber)

  • selects the current alt-page to inventoryPrimary = 0 or inventorySecondary = 1

inventory.setSelectedTo(blockID)

  • overwrites the block id in the current selected slot

player

Functions

player.isInWorld()

  • returns if the player is inside or outside the world bounds

player.isOnGround()

  • returns if the player is currently standing on a solid block

player.setSkin(filepath)

  • sets the player's skin to the filepath image
  • the path could be local to the plugins folder, e.g. ./skins/zombie.png

tablist

Events

tablist.onTablistUpdated(uniqueIdentifier, callback(id, entry))

  • called when an entry in the tablist was updated
  • id - the id of the tablist
  • entry - the entry of the id that was changed

texture

Functions

texture.load(filepath)

  • loads the texture local to the texture_packs folder
  • file can be either an image or a zip folder

window

Functions

window.capturePixels()

  • takes a screenshot of the current game

window.getResolution()

  • returns the internal resolution
  • this is not the same as the window size

window.getSize()

  • returns the size of the game window in pixels

window.setResolution(width, height)

  • sets the width and height of the internal resolution

window.setSize(width, height)

  • sets the width and height of the game window itself, in pixels

Version History

20221215
+ reformatted the markdown file itself
	- removed "Things to Consider"
+ cleaned up the API a bit
	- renamed hacks.womStyleEnable to hacks.womStyleHacks
	- renamed inventory.setSelected to inventory.setSelectedTo
	- renamed window.capture to window.capturePixels
+ added window.setSize

20220519
+ added a bunch of stuff

20220515
+ initial draft release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions