# portals-110530122602-phpapp02

Document Sample

```					How Portals Work

Eric Haines
http://vokselia.com
5/30/2011
Overworld vs.Nether Coordinates
Use F3 to find your coordinates. X is north/south (south is positive), Z is
east/west (west is positive).
Overworld to Nether:
Nether X = Overworld X / 8
Nether Y = Overworld Y (no change)
Nether Z = Overworld Z / 8
So (386,116,-837) in the Overworld converts to (48.25,116,-104.625) Nether

Nether to Overworld:
Overworld X = Nether X * 8
Overworld Y = Nether Y (no change)
Overworld Z = Nether Z * 8
So (46,95,-117) in the Nether converts to (368,95,-936) in the Overworld
Overworld Portal to Nether
Convert the player’s location from Overworld to Nether coordinates.
From the Nether X and Z (north/south, east/west) location, look in the Nether
for 128 blocks north, south, east, and west. Find the closest Nether portal
to the player’s location. Distance is measured in 3 dimensions.

128         Steve pops into the
high        Nether. The program
searches for the
closest portal in a box
that’s 257x257 wide
and 128 high (the
-128                   +128
world’s height) in the
Nether.
If no portal is inside this volume…
Then a new portal is spawned close by, in an area large enough to hold it.

Instead of spawning a portal at Steve’s location in solid rock, it is placed in a cave.
Overworld to Nether Range
Searching from the Overworld into the Nether searches 128 meters in each
direction in the Nether.

This distance is the same as          1024m                 1024m
1024 meters in the
Overworld. A single portal
in the Nether will be
connected, one way, from
any Overworld portal within
the 1024 meters box
around it.

So, a box of size 2048x2048
(approx.) in the Overworld
can connect to one Nether
portal.                               128m                  128m
Nether Portal to Overworld
Uses the same sort of process: find the player’s Nether location in the
Overworld and then find the closest portal within a box 128 meters
(blocks) north, south, east, and west of that location, in the Overworld.
Note the key difference:              128m   128m
The left
128 meters in the
Overworld
Overworld is just 16 meters
portal is in
in the Nether. So a Nether
range, the
portal searches a much
right is not.
smaller box, 256x256
Overworld-equivalent vs.
2048x2048 Overworld-
equivalent.

Nether portals search a
much smaller overall
16m     16m
equivalent space!
Conclusions
To make an unbreakable two-way link between Overworld and Nether
portals, build them at the exactly the same locations in each world.

Going from an Overworld portal to a Nether portal can go a long distance and
is very common, since the search range is huge in Overworld term.
But, it’s often a one-way trip, since the Nether portal searches a relatively
small range when looking in the Overworld for a nearby portal.

This small search range also means that, if you build a portal in the Nether, it
is pretty easy to (accidentally or on purpose) spawn a new portal in the
Overworld. If your Nether portal’s Overworld location is more than 128
meters away, in a cardinal direction (north/south or east/west), from any
Overworld portal, a new Overworld portal will be created.

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 3 posted: 6/2/2011 language: English pages: 7