/*
 * ==============================================================================
 *  _   _               _                       ____   _                    
 * | \ | |  ___  _   _ | |_  _ __  ___   _ __  / ___| | |_  __ _  _ __  ___ 
 * |  \| | / _ \| | | || __|| '__|/ _ \ | '_ \ \___ \ | __|/ _` || '__|/ __|
 * | |\  ||  __/| |_| || |_ | |  | (_) || | | | ___) || |_| (_| || |   \__ \
 * |_| \_| \___| \__,_| \__||_|   \___/ |_| |_||____/  \__|\__,_||_|   |___/
 *                                                                         
 * ==============================================================================
 *            _    _______   __________________  _____
 *            | |  / /  _/ | / / ____/_  __/ __ \/ ___/
 *            | | / // //  |/ / __/   / / / / / /\__ \
 *            | |/ // // /|  / /___  / / / /_/ /___/ /
 *            |___/___/_/ |_/_____/ /_/  \____//____/
 *
 * ==============================================================================
 *
 * FreeWorld game
 * Copyright (c) NeutronStars & Vinetos Software 2017,
 * By NeutronStars, juin 2017
 * 
 * ==============================================================================
 * 
 * This file is part of FreeWorld game.
 * 
 * FreeWorld is free software: you can redistribute it and/or modify
 * it under the terms of the MIT License.
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in 
 * the Software without restriction, including without limitation the rights to 
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
 * of the Software, and to permit persons to whom the Software is furnished to do so, 
 * subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all 
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *==============================================================================
 */
package org.freeworld.client.utils;

import org.freeworld.client.block.Block;
import org.freeworld.client.maths.Vector5f;
import org.freeworld.client.world.World;

public class Location{

    private World world;
    private Vector5f vector5f;

    public Location(Location location){
        this(location.world, location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    }

    public Location(World world, float x, float y, float z, float yaw, float pitch){
        this.world = world;
        this.vector5f = new Vector5f(x, y, z, yaw, pitch);
    }

    public World getWorld() {
        return world;
    }

    public Block getBlock(){
        return world.getBlock(getBlockX(), getBlockY(), getBlockZ());
    }

    public int getBlockX(){
        return (int) vector5f.getX();
    }

    public int getBlockY(){
        return (int) vector5f.getY();
    }

    public int getBlockZ(){
        return (int) vector5f.getZ();
    }

    public float getX(){
        return vector5f.getX();
    }

    public float getY(){
        return vector5f.getY();
    }

    public float getZ(){
        return vector5f.getZ();
    }

    public float getYaw(){
        return vector5f.getYaw();
    }

    public float getPitch(){
        return vector5f.getPitch();
    }

    public Location set(int x, int y, int z){
        vector5f.setX(x).setY(y).setZ(z);
        return this;
    }

    public Location add(int x, int y, int z){
        return new Location(world, vector5f.getX()+x, vector5f.getY()+y, vector5f.getZ()+z,vector5f.getYaw(), vector5f.getPitch());
    }

    public Location clone(){
        return new Location(this);
    }
}

@@ -2685,16 +2685,17 @@
 Location
+ 
 %7B%0A%0A    p
@@ -2784,16 +2784,17 @@
 ocation)
+ 
 %7B%0A      
@@ -2998,16 +2998,17 @@
 t pitch)
+ 
 %7B%0A      
@@ -3181,16 +3181,17 @@
 tBlock()
+ 
 %7B%0A      
@@ -3287,16 +3287,17 @@
 BlockX()
+ 
 %7B%0A      
@@ -3361,16 +3361,17 @@
 BlockY()
+ 
 %7B%0A      
@@ -3435,16 +3435,17 @@
 BlockZ()
+ 
 %7B%0A      
@@ -3506,16 +3506,17 @@
 t getX()
+ 
 %7B%0A      
@@ -3571,16 +3571,17 @@
 t getY()
+ 
 %7B%0A      
@@ -3636,16 +3636,17 @@
 t getZ()
+ 
 %7B%0A      
@@ -3703,16 +3703,17 @@
 getYaw()
+ 
 %7B%0A      
@@ -3774,16 +3774,17 @@
 tPitch()
+ 
 %7B%0A      
@@ -3856,32 +3856,33 @@
 x, int y, int z)
+ 
 %7B%0A        vector
@@ -3981,16 +3981,17 @@
 , int z)
+ 
 %7B%0A      
@@ -4034,17 +4034,19 @@
 f.getX()
-+
+ + 
 x, vecto
@@ -4055,17 +4055,19 @@
 f.getY()
-+
+ + 
 y, vecto
@@ -4080,11 +4080,14 @@
 tZ()
-+
+ + 
 z,
+ 
 vect
@@ -4157,16 +4157,17 @@
  clone()
+ 
 %7B%0A      

Reformat code