This page documents the Forestry integration exposed to Lua by OpenComputers. The available components cover analyzers, bee housings, and the robot beekeeper upgrade.
- Dependency:
forestry - Label:
integration-required
forestry_analyzerbee_housingbeekeeper
- Reading analyzed bee data from Forestry analyzers.
- Inspecting drones, queens, and mutation data from apiaries and related bee housings.
- Using a robot upgrade to swap bees, analyze specimens, and manage GregTech industrial apiary upgrades.
Several callbacks on this page return Forestry individual data tables produced by the OpenComputers converter layer.
Common top-level fields include:
displayNameidentisAnalyzedisSecrettype
Depending on the specimen, tables may also contain:
healthmaxHealthgenerationisAliveisNaturalcanSpawnhasEffectactiveinactive
For bees, the active and inactive sub-tables usually include chromosome-derived values such as:
speciesspeedlifespanfertilitytemperatureTolerancehumidityTolerancenocturnaltolerantFlyercaveDwellingflowerProviderfloweringeffectterritory
forestry_analyzer is exposed on Forestry analyzers.
- Syntax:
isWorking(): boolean - Purpose: Return whether the analyzer currently has work available.
- Returns:
trueif it can process the current specimen.falseotherwise.
- Syntax:
getProgress(): number - Purpose: Return the progress of the current analysis operation.
- Returns:
- A progress value between
0and1.
- A progress value between
- Usage notes:
- The driver converts Forestry's scaled progress into a normalized fraction where higher means closer to completion.
- Syntax:
getIndividualOnDisplay(): table - Purpose: Return data for the individual currently shown in the analyzer display.
- Returns:
- Forestry individual data table.
- Usage notes:
- The returned table depends on what type of Forestry specimen is currently displayed.
bee_housing is exposed on Forestry bee housings such as apiaries, alvearies, and compatible bee-capable machines.
- Syntax:
canBreed(): boolean - Purpose: Return whether the current housing can work and breed bees right now.
- Returns:
trueif the beekeeping logic can work.falseotherwise.
- Syntax:
getDrone(): table - Purpose: Return the drone currently installed in the housing.
- Returns:
- Forestry individual data table for the drone.
nilif there is no drone present.
- Syntax:
getQueen(): table - Purpose: Return the queen currently installed in the housing.
- Returns:
- Forestry individual data table for the queen.
nilif there is no queen present.
- Syntax:
getBeeBreedingData(): table - Purpose: Return known bee mutation definitions from Forestry's bee root.
- Returns:
- A set-like collection of mutation description tables.
- Usage notes:
- Each mutation table may include:
allele1allele2chancespecialConditionsresult
- This is useful when building in-game mutation lookup or planning tools.
- Each mutation table may include:
- Syntax:
listAllSpecies(): table - Purpose: Return all bee species discovered from the registered mutation outputs.
- Returns:
- A collection of species descriptor tables.
- Usage notes:
- Each species entry normally includes fields such as
name,uid,humidity, andtemperature.
- Each species entry normally includes fields such as
- Syntax:
getBeeParents(beeName: string): table - Purpose: Return mutation definitions whose result matches the specified bee species.
- Parameters:
beeName: stringSpecies localized name or UID, case-insensitive.
- Returns:
- A collection of matching mutation records.
- Usage notes:
- Matching checks both the species localized name and UID.
beekeeper is exposed by the Forestry beekeeper robot upgrade.
- Syntax:
swapQueen(side: number): boolean - Purpose: Swap the robot's selected inventory slot with the queen slot of a bee housing on the specified side.
- Parameters:
side: numberRelative robot side containing the target housing.
- Returns:
trueif a compatible housing was found and the swap happened.falseotherwise.
- Syntax:
swapDrone(side: number): boolean - Purpose: Swap the robot's selected inventory slot with the drone slot of a bee housing on the specified side.
- Parameters:
side: numberRelative robot side containing the target housing.
- Returns:
trueif a compatible housing was found and the swap happened.falseotherwise.
- Syntax:
getBeeProgress(side: number): number[, string] - Purpose: Return the current bee work progress percent for the housing on the specified side.
- Parameters:
side: numberRelative robot side containing the target housing.
- Returns:
- Current progress percent on success.
false, "No bee housing found"if no compatible housing is present.
- Syntax:
canWork(side: number): boolean[, string] - Purpose: Return whether the current bee housing can work right now.
- Parameters:
side: numberRelative robot side containing the target housing.
- Returns:
trueorfalseon success.false, "No bee housing found"if none is present.
- Syntax:
analyze(honeySlot: number): boolean[, string] - Purpose: Analyze the bee in the robot's selected slot, consuming one honey item from the specified slot.
- Parameters:
honeySlot: numberRobot inventory slot containinghoneydeworhoneyDrop.
- Returns:
trueon success.false, "Not a bee"if the selected slot does not contain a bee.false, "No honey!"if the specified honey slot is missing a valid honey item.
- Usage notes:
- The selected specimen slot is the robot's currently selected inventory slot.
- Syntax:
addIndustrialUpgrade(side: number[, amount: number]): number - Purpose: Push industrial apiary upgrades from the robot's selected slot into a GregTech industrial apiary.
- Parameters:
side: numberRelative robot side containing the target industrial apiary.amount: numberOptional number of upgrades to try to install. Defaults to64.
- Returns:
- Number of upgrades successfully inserted.
- Usage notes:
- Returns
0if no GregTech industrial apiary is found, the selected slot is empty, or nothing could be inserted.
- Returns
- Syntax:
getIndustrialUpgrade(side: number, slot: number): table[, string] - Purpose: Return the upgrade stack installed in one GregTech industrial apiary upgrade slot.
- Parameters:
side: numberRelative robot side containing the target industrial apiary.slot: numberOne-based industrial upgrade slot index.
- Returns:
- Item stack description table for the upgrade in that slot.
nil, "Wrong slot index (should be 1-X)"if the slot number is invalid.
- Syntax:
removeIndustrialUpgrade(side: number, slot: number[, amount: number]): boolean|number[, string] - Purpose: Remove upgrades from a GregTech industrial apiary and place them into the robot inventory.
- Parameters:
side: numberRelative robot side containing the target industrial apiary.slot: numberOne-based industrial upgrade slot index.amount: numberOptional number of upgrades to remove. Defaults to64.
- Returns:
- Number of upgrades successfully moved into the robot inventory.
false, "Wrong slot index (should be 1-X)"if the slot number is invalid.
- Usage notes:
- The helper tries the selected robot slot first, then matching stacks, then any free slots.
local component = require("component")
if component.isAvailable("bee_housing") then
local housing = component.bee_housing
local queen = housing.getQueen()
if queen then
print("Queen:", queen.displayName, queen.isAnalyzed)
end
end
if component.isAvailable("beekeeper") then
local keeper = component.beekeeper
print("Can work:", keeper.canWork(3))
endgregtechvanilla