Scripting Reference

This section summarizes the most important classes and methods you will interact with.

Note: Exact members may vary slightly depending on your version of the kit, but the concepts remain the same.

Inventory

Key members:

  • InventorySlot[] slots
  • int hotbarSize
  • int inventorySize
  • int selectedHotbarIndex
  • BlockData CurrentHotbarBlock { get; }
  • ToolData CurrentHotbarTool { get; }
  • event Action OnInventoryChanged

Methods:

  • AddBlock, AddTool
  • ConsumeFromSlot, ConsumeFromSelectedHotbar
  • NotifyChanged()

InventorySlot

  • BlockData block
  • ToolData tool
  • int count
  • bool IsEmpty
  • void SetBlock(BlockData b, int amount)
  • void SetTool(ToolData t, int amount)
  • void Clear()

BlockInteractor

  • Uses camera raycasts to find blocks.
  • Tracks which block is being broken (chunk + local coords).
  • Computes break time from BlockData (and optionally tools).
  • Sets blocks to Air and rebuilds chunk mesh when broken.
  • Spawns drops via BlockData.dropPrefab.
  • Places blocks from the selected hotbar slot and consumes inventory.

HeldItemRenderer

  • Watches Inventory.OnInventoryChanged.
  • Instantiates either a tool’s inHandPrefab or a block’s worldPrefab under the hand anchor transform.
  • Disables physics on the held instance.