Minecraft X Y Z

Minecraft uses the Cartesian coordinate system to locate and display blocks. That means that every block location in a Minecraft universe can be described using three values: X, Y, and Z. Even the player’s avatar “Steve” has a position recorded this way. If you type the F3 key, you can see a bunch of text on the screen. Buried in there somewhere are the 3 values for Steve’s position.

In order to get a more visual representation of these three numbers, here is a simple modification (Mod) to Minecraft that draws a portion of the three axis. The X axis here is described by the red bircks. These are placed along the X values from -100 to + 100, and both Y and Z are set to 0.

The same is done for the Y axis, shown in Obsidian. Since we can’t draw under the world (negative Y does not render) it only goes up.

The same is also done for the Z axis using the gray stones. Positive Z comes forward, negative goes back.

Our view point is from X=10 Y=1 Z = 10, looking almost halfway between negative X and Negative Z.

 

 

x-y-z-axis

Here is the code to render the axis.

@Override
  public void execute( MinecraftServer server, ICommandSender sender, String[] args ) throws CommandException {

    EntityPlayer player = ( EntityPlayer ) sender;
    World world = player.worldObj;

    for ( int x = -LENGTH ; x < LENGTH; x++ ) {
      world.setBlockState( new BlockPos( x, 0, 0 ), Blocks.BRICK_BLOCK.getDefaultState( ) );
    }

    for ( int y = 0; y < LENGTH ; y++ ) {
      world.setBlockState( new BlockPos( 0, y, 0 ), Blocks.OBSIDIAN.getDefaultState( ) );
    }

    for ( int z = -LENGTH ; z < LENGTH ; z++ ) {
      world.setBlockState( new BlockPos( 0, 00, z ), Blocks.COBBLESTONE.getDefaultState( ) );
    }

    world.setBlockState( new BlockPos( 0, 0, 0 ), Blocks.COMMAND_BLOCK.getDefaultState( ) );


  }

Leave a Reply

Your email address will not be published. Required fields are marked *