Skip to content

Environment Detector

Picture

!Image of the Environment Detector block

The Environment Detector provides current information from the environment like the current time, the current moon phase, the light level of the block and many more.


| Peripheral Name | Interfaces with | Has events | Introduced in | | -------------------- | --------------- | ---------- | ------------- | | environment_detector | World | No | 0.1b |

Functions

getBiome

getBiome() -> string

Returns the current biome the block is in.

1
2
3
4
local detector = peripheral.find("environment_detector")

-- e.g. prints "Biome: minecraft:plains"
print("Biome: " .. detector.getBiome())

getBlockLightLevel

getBlockLightLevel() -> number

Returns the block light level (0 to 15) at the detector block, this can be influenced by light sources


getSkyLightLevel

getSkyLightLevel() -> number

Returns the current sky light level from 0 to 15 (like a daylight sensor).


getDayLightLevel

getDayLightLevel() -> number

Returns the day light level of the current world from 0 to 15. This is uneffected by blocks covering the peripheral.


getTime

getTime() -> number

WIP

Returns the daytime of the current world.


isSlimeChunk

isSlimeChunk() -> boolean

Returns true if the current chunk is a slime chunk.


getDimension

getDimension() -> string

Returns the name of the current dimension (ex. minecraft:overworld, minecraft:the_nether or minecraft:the_end).

1
2
3
4
local detector = peripheral.find("environment_detector")

-- e.g. prints "Dimension: the_nether"
print("Dimension: " .. detector.getDimension())

listDimensions

listDimensions() -> table

Returns a table with all of the registered dimensions for the current world, this includes modded dimensions.

Example

As an example listDimensions might return a table like so:

{"minecraft:overworld", "minecraft:the_nether", "minecraft:the_end", "twilightforest:twilight_forest"}


getMoon

getMoon() -> number, string

Returns the current moon phase's id and its name

Info

There are 8 different moon phases, see below a list of their names and ids

0 = Full moon, 1 = Waning gibbous, 2 = Third quarter, 3 = Waning crescent, 4 = New moon, 5 = Waxing crescent, 6 = First quarter, 7 = Waxing gibbous


isRaining

isRaining() -> boolean

Returns true if it is raining.


isThunder

isThunder() -> boolean

Returns true if it is thundering.


isSunny

isSunny() -> boolean

Returns true if it is sunny.


getRadiation

getRadiation() -> table

Added in version 0.6.1b

Requirement

Requires the Mekanism mod to be installed

Returns the current radiation level from the Mekanism mod with the radiation unit.

Properties

table Description
radiation: string The current radiation level as a string
unit: string The radiation unit

getRadiationRaw

getRadiationRaw() -> number

Added in version 0.6.5b

Requirement

Requires the Mekanism mod to be installed

Returns the current raw radiation level in Sv/h.


scanEntities

scanEntities(range: number) -> table

Returns a table with all entities in the given range.
Coordinates are relative and not absolute.

Example

// TODO: update this example Example output for an entity:

{
  {
    canFreeze = true,
    uuid = "380df991-f603-344c-a090-369bad2a924a",
    tags = {},
    id = 158,
    y = 0.99835407917146,
    x = 2.3657836835311,
    name = "Dev",
    isGlowing = false,
    z = 1.2416321248782,
    isInWall = false,
    maxHealth = 20,
    health = 20,
  },
}


scanShips

scanShips(range: number) -> table

Requirement

Requires Valkyrien Skies to be installed.

Returns a table with all ships in the given range.
Coordinates are relative and not absolute.


Changelog/Trivia

0.8 Added vs2 integration scanShips, scanShipCost.

0.6.5b
Added getRadiationRaw

0.6.1b
Added getRadiation

0.3.3b
Added many more functions to the environment detector. The environment detector was a useless block before this update.

0.1b
Added the block. It was the second feature of the mod.

Comments