mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 21:54:08 +00:00
Added API class to EnergyTrajectoryData
This commit is contained in:
1 parent
0e3ecb3d6e
commit
4eb6072a25
2 files changed
+27
-8
No files matched your search
@@ -1,6 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.ability.data.IEnergyTrajectoryData;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
@@ -20,59 +19,71 @@ public class EnergyTrajectoryData implements IEnergyTrajectoryData {
|
||||
this.currentPath = startingPath < trajectory.size() && startingPath >= 0 ? startingPath : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentPath() {
|
||||
return currentPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentPath(int currentPath) {
|
||||
this.currentPath = currentPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelay(int path) {
|
||||
if (getPath(path) == null) return -1;
|
||||
return getPath(path).delayTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDelay(int path, int ticks) {
|
||||
if (getPath(path) == null) return;
|
||||
getPath(path).delayTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPos getPos(int path) {
|
||||
if (getPath(path) == null) return null;
|
||||
return getPath(path).coords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPos(int path, IPos coords) {
|
||||
if (getPath(path) == null) return;
|
||||
getPath(path).coords = coords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getX(int path) {
|
||||
if (getPos(path) == null) return 0;
|
||||
return getPos(path).getX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setX(int path, double x) {
|
||||
if (getPos(path) == null) return;
|
||||
setPos(path, NpcAPI.Instance().getIPos(x, getY(path), getZ(path)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getY(int path) {
|
||||
if (getPos(path) == null) return 0;
|
||||
return getPos(path).getY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setY(int path, double y) {
|
||||
if (getPos(path) == null) return;
|
||||
setPos(path, NpcAPI.Instance().getIPos(getX(path), y, getZ(path)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getZ(int path) {
|
||||
if (getPos(path) == null) return 0;
|
||||
return getPos(path).getZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZ(int path, double z) {
|
||||
if (getPos(path) == null) return;
|
||||
setPos(path, NpcAPI.Instance().getIPos(getX(path), getY(path), z));
|
||||
@@ -83,20 +94,24 @@ public class EnergyTrajectoryData implements IEnergyTrajectoryData {
|
||||
return trajectory.get(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPath(int path, IPos pos) {
|
||||
setPath(path, pos, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPath(int path, IPos pos, int delay) {
|
||||
setPath(path, pos.getX(), pos.getY(), pos.getZ(), delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPath(int path, double x, double y, double z) {
|
||||
setPath(path, x, y, z, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPath(int path, double x, double y, double z, int delay) {
|
||||
Path newPath = createPath(x, y, z, delay);
|
||||
Path newPath = (Path) createPath(x, y, z, delay);
|
||||
|
||||
if (trajectory.isEmpty()) {
|
||||
trajectory.add(newPath);
|
||||
@@ -105,23 +120,27 @@ public class EnergyTrajectoryData implements IEnergyTrajectoryData {
|
||||
}
|
||||
}
|
||||
|
||||
public Path createPath(IPos coords) {
|
||||
@Override
|
||||
public IPath createPath(IPos coords) {
|
||||
return new Path(coords, 0);
|
||||
}
|
||||
|
||||
public Path createPath(IPos coords, int delay) {
|
||||
@Override
|
||||
public IPath createPath(IPos coords, int delay) {
|
||||
return new Path(coords, delay);
|
||||
}
|
||||
|
||||
public Path createPath(double x, double y, double z) {
|
||||
@Override
|
||||
public IPath createPath(double x, double y, double z) {
|
||||
return createPath(x, y, z, 0);
|
||||
}
|
||||
|
||||
public Path createPath(double x, double y, double z, int delay) {
|
||||
@Override
|
||||
public IPath createPath(double x, double y, double z, int delay) {
|
||||
return new Path(NpcAPI.Instance().getIPos(x, y, z), delay);
|
||||
}
|
||||
|
||||
public static class Path {
|
||||
public static class Path implements IEnergyTrajectoryData.IPath{
|
||||
public IPos coords;
|
||||
public int delayTicks;
|
||||
|
||||
|
||||
Reference in new issue
Block a user