detect

Detect if there is a block next to the agent in the specified direction.

agent.detect(AgentDetection.Block, FORWARD);

Parameters

  • kind: what the agent should attempt to detect
    • block: detect any destructible block
    • redstone: detect only redstone
  • direction: the direction in which to perform the detection, such as: FORWARD

Example

Display a message in the game chat if there is redstone in front of the agent.

if (agent.detect(AgentDetection.Redstone, FORWARD)) {
    player.say("Agent found redstone!");
}