cn.nukkit.entity.data.IntPositionEntityData Maven / Gradle / Ivy
package cn.nukkit.entity.data;
import cn.nukkit.entity.Entity;
import cn.nukkit.math.BlockVector3;
import cn.nukkit.math.Vector3;
/**
* @author MagicDroidX (Nukkit Project)
*/
public class IntPositionEntityData extends EntityData {
public int x;
public int y;
public int z;
public IntPositionEntityData(int id, int x, int y, int z) {
super(id);
this.x = x;
this.y = y;
this.z = z;
}
public IntPositionEntityData(int id, Vector3 pos) {
this(id, (int) pos.x, (int) pos.y, (int) pos.z);
}
@Override
public BlockVector3 getData() {
return new BlockVector3(x, y, z);
}
@Override
public void setData(BlockVector3 data) {
if (data != null) {
this.x = data.x;
this.y = data.y;
this.z = data.z;
}
}
@Override
public int getType() {
return Entity.DATA_TYPE_POS;
}
@Override
public String toString() {
return "(" + x + ", " + y + ", " + z + ")";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy