aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-12 01:43:20 +0900
committersyeyoung <cyong06@naver.com>2021-02-12 01:43:20 +0900
commit92c8d9cec9fcc3a53ad95ff0212d77bf87becab7 (patch)
tree269ec202ecc2426ff0d6d73fab95af1fea57042a /src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
parent89c82ad1fea9fd0a8e32a5e818c6c01856cdd660 (diff)
downloadSkyblock-Dungeons-Guide-92c8d9cec9fcc3a53ad95ff0212d77bf87becab7.tar.gz
Skyblock-Dungeons-Guide-92c8d9cec9fcc3a53ad95ff0212d77bf87becab7.tar.bz2
Skyblock-Dungeons-Guide-92c8d9cec9fcc3a53ad95ff0212d77bf87becab7.zip
pathfinder go brrrr
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
index e80cdd84..e521a4c9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
@@ -5,12 +5,16 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
import net.minecraft.client.Minecraft;
+import net.minecraft.pathfinding.PathEntity;
+import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import java.awt.*;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
+import java.util.List;
@Data
public class ActionMove extends AbstractAction {
@@ -36,6 +40,25 @@ public class ActionMove extends AbstractAction {
BlockPos pos = target.getBlockPos(dungeonRoom);
RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.6f, pos.getZ() + 0.5f, 0xFF00FF00, 1f, true, false, partialTicks);
RenderUtils.drawTextAtWorld(String.format("%.2f",MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())))+"m", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 1f, true, false, partialTicks);
+ if (latest != null){
+ List<BlockPos> poses = new ArrayList<BlockPos>();
+ for (int i = 0; i < latest.getCurrentPathLength(); i++) {
+ PathPoint pathPoint = latest.getPathPointFromIndex(i);
+ poses.add(dungeonRoom.getMin().add(pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord));
+ }
+ RenderUtils.drawLines(poses, new Color(0,255,0,255), partialTicks, true);
+ }
+ }
+
+ private int tick = -1;
+ private PathEntity latest;
+ @Override
+ public void onTick(DungeonRoom dungeonRoom) {
+ tick = (tick+1) % 10;
+ if (tick == 0) {
+ latest = dungeonRoom.getPathFinder().createEntityPathTo(dungeonRoom.getContext().getWorld(),
+ Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), 100);
+ }
}
@Override