←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

How to detect which dimension & world...

luochen1990's Photo luochen1990 25 Mar 2020

Hello guys, I'm now writing a program using rednet to control turtles, and now I need to detech which dimension & world my turtle is inside, so that they can avoid to abuse the coordinate information in the other world.

Is there some mechanism to implement a function like following ?

local result = detectWorld()
print(result.dimensionName)  -- "overworld" / "the nether" / "the end"
print(result.worldName) -- "world" / "DIM1" / ...
Quote

Luca_S's Photo Luca_S 25 Mar 2020

AFAIK there is no builtin way to do that. You could however do something similar to the GPS program and have a server in each dimension responding to PINGs with the dimension it's in(Or patch that into the already existing GPS Program).

Because the modem_message event doesn't provide a distance if the message is coming from another dimension you can determine which response came from a server within your current dimension.
Quote