All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.entity.data.Vector3fEntityData Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.entity.data;

import cn.nukkit.entity.Entity;
import cn.nukkit.math.Vector3f;

/**
 * @author MagicDroidX (Nukkit Project)
 */
public class Vector3fEntityData extends EntityData {
    public float x;
    public float y;
    public float z;

    public Vector3fEntityData(int id, float x, float y, float z) {
        super(id);
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public Vector3fEntityData(int id, Vector3f pos) {
        this(id, pos.x, pos.y, pos.z);
    }

    @Override
    public Vector3f getData() {
        return new Vector3f(x, y, z);
    }

    @Override
    public void setData(Vector3f data) {
        if (data != null) {
            this.x = data.x;
            this.y = data.y;
            this.z = data.z;
        }
    }

    @Override
    public int getType() {
        return Entity.DATA_TYPE_VECTOR3F;
    }

    @Override
    public String toString() {
        return "(" + x + ", " + y + ", " + z + ")";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy