Repository navigation
OC CC Functions
Nicholas Kreimeyer edited this page Nov 4, 2026
·
8 revisions
Minecraft 1.12.2 only. The versions for Minecraft 1.20.1 and newer have no OpenComputers or ComputerCraft integration and no Serial Port addon.
A base is reachable from a computer if it is tier 5 or has a Serial Port addon, and OpenComputers or ComputerCraft is installed. It shows up as a peripheral (ComputerCraft) or component (OpenComputers) next to the base.
| function name | description |
|---|---|
| getOwner() | function():string; returns owner of turret base. |
| isAttacksMobs() | function():boolean; returns if the turret is currently set to attack hostile mobs. |
| setAttacksMobs(args) | function(state:boolean):void; set attack hostile mobs or not. |
| isAttacksNeutrals() | function():boolean; returns if the turret is currently set to attack neutral mobs. |
| setAttacksNeutrals(args) | function(state:boolean):void; set attack neutral mobs or not. |
| isAttacksPlayers() | function():boolean; returns if the turret is currently set to attack players. |
| setAttacksPlayers(args) | function(state:boolean):void; sets attack players or not. |
| getTrustedPlayers() | function():table; returns a table of all trusted players on this base. |
| getTrustedPlayer(args) | function():table; tries to return a specific trusted player from this base |
| addTrustedPlayer(args) | function(name:String, [accessLevel:Integer]):boolean; adds trusted player to trustlist. Can return error. |
| removeTrustedPlayer(args) | function(name:String):string; removes trusted player from trust list. |
| changeAccessLevel(args) | function(name:String, accessLevel:Integer):string; change players access level. Can return error. |
| getMaxEnergyStorage() | function():int; returns maximum energy storage. |
| getCurrentEnergyStorage() | function():int; returns current energy stored. |
| getActive() | function():boolean; returns if the turret is currently active. |
| getMode() | function():int; shows base mode. 0 always on, 1 always off, 2 inverted, 3 non-inverted |
| setMode() | function(state:int):void; toggles turret redstone inversion state. |
| getRedstone() | function():boolean; shows redstone state. |
| getType() | function():string; returns the peripheral type. |
| setAllYawPitch(args) | function(yaw:double, pitch:double):void; Set yaw and pitch for all turrets (deactivate auto targeting before). |
| setTurretYawPitch(args) | function(side:int, yaw:double, pitch:double):boolean; Set yaw and pitch for a turret (deactivate auto targeting before). |
| setAllAutoForceFire(args) | function(state:boolean):void; Enable auto firing for all Turrets (deact. auto targ. before). |
| setTurretAutoForceFire(args) | function(side:int, state:boolean):boolean; Enable auto firing for specified Turret (deact. auto targ. before). |
| forceShootAllTurrets() | function():int; Try to shoot all turrets, returns number of successful shots |
| forceShootTurret(args) | function(side:int):boolean; Try to shoot specified turret, returns true if successful |