aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2021-10-02 15:30:51 +0900
committersyeyoung <cyoung06@naver.com>2021-10-02 15:33:33 +0900
commitf818e42c6c21ed6b2d7993dca87e6cd52f3d5251 (patch)
tree250f7979a82e146b61bcbcc2f4d9fd6b57bee911 /src/main/java/kr/syeyoung/dungeonsguide/dungeon
parent07f74480447495e6cd42237e4740fb082cb4b821 (diff)
downloadSkyblock-Dungeons-Guide-f818e42c6c21ed6b2d7993dca87e6cd52f3d5251.tar.gz
Skyblock-Dungeons-Guide-f818e42c6c21ed6b2d7993dca87e6cd52f3d5251.tar.bz2
Skyblock-Dungeons-Guide-f818e42c6c21ed6b2d7993dca87e6cd52f3d5251.zip
Line Properties for each pathfind context
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java13
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java13
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java36
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java38
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java41
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java1
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java5
13 files changed, 104 insertions, 79 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
index a551f544..4fd4056d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
@@ -25,32 +26,32 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
public abstract class AbstractAction implements Action {
@Override
- public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event) {
+ public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
}
@Override
- public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event) {
+ public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
}
@Override
- public void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties) {
}
@Override
- public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event) {
+ public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
}
@Override
- public void onTick(DungeonRoom dungeonRoom) {
+ public void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties) {
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
index 87cb54c6..1a4ad682 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
@@ -28,12 +29,12 @@ import java.util.Set;
public interface Action {
Set<Action> getPreRequisites(DungeonRoom dungeonRoom);
- void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event);
- void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event);
- void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event);
- void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks);
- void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks);
- void onTick(DungeonRoom dungeonRoom);
+ void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties);
+ void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRoute.ActionRouteProperties actionRouteProperties);
+ void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRoute.ActionRouteProperties actionRouteProperties);
+ void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag);
+ void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties);
+ void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties);
boolean isComplete(DungeonRoom dungeonRoom);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java
index d80496f2..39d3e7ef 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java
@@ -18,8 +18,7 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
@@ -31,12 +30,9 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.renderer.vertex.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
-import net.minecraft.util.MathHelper;
import java.awt.*;
import java.util.HashSet;
@@ -62,7 +58,7 @@ public class ActionBreakWithSuperBoom extends AbstractAction {
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
BlockPos blockpos = target.getBlockPos(dungeonRoom);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java
index f5958914..1b463f2e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java
@@ -20,11 +20,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
-import lombok.EqualsAndHashCode;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -56,7 +56,7 @@ public class ActionClick extends AbstractAction {
}
@Override
- public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event) {
+ public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
if (clicked) return;
if (target.getBlockPos(dungeonRoom).equals(event.pos) &&
(predicate == null || predicate.apply(event.entityLiving.getHeldItem()))) {
@@ -64,7 +64,7 @@ public class ActionClick extends AbstractAction {
}
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
BlockPos pos = target.getBlockPos(dungeonRoom);
RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true);
RenderUtils.drawTextAtWorld("Click", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java
index 356c592a..975c19e9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java
@@ -20,12 +20,12 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
-import lombok.EqualsAndHashCode;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -56,7 +56,7 @@ public class ActionClickSet extends AbstractAction {
private boolean clicked = false;
@Override
- public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event) {
+ public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
if (clicked) return;
for (OffsetPoint pt2: target.getOffsetPointList()) {
if (pt2.getBlockPos(dungeonRoom).equals(event.pos) &&
@@ -68,7 +68,7 @@ public class ActionClickSet extends AbstractAction {
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
float xAcc = 0;
float yAcc = 0;
float zAcc = 0;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java
index a6f7eb59..2e90d3a3 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java
@@ -20,13 +20,12 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
-import lombok.EqualsAndHashCode;
import net.minecraft.entity.item.EntityItem;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
@@ -59,7 +58,7 @@ public class ActionDropItem extends AbstractAction {
return (predicate == null || predicate.apply(item.get(0)));
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
BlockPos pos = target.getBlockPos(dungeonRoom);
RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true);
RenderUtils.drawTextAtWorld("Drop Item", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java
index acdda662..3033754c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java
@@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
@@ -57,7 +58,7 @@ public class ActionInteract extends AbstractAction {
private boolean interacted = false;
@Override
- public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event) {
+ public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
if (interacted) return;
Vec3 spawnLoc = DungeonActionManager.getSpawnLocation().get(event.getEntity().getEntityId());
@@ -67,7 +68,7 @@ public class ActionInteract extends AbstractAction {
interacted = true;
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
BlockPos pos = target.getBlockPos(dungeonRoom);
RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true);
RenderUtils.drawTextAtWorld("Interact", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java
index 010c5f89..a08b81f0 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java
@@ -21,8 +21,8 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
@@ -66,7 +66,7 @@ public class ActionKill extends AbstractAction {
private boolean killed = false;
@Override
- public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event) {
+ public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) {
if (killed) return;
Vec3 spawnLoc = DungeonActionManager.getSpawnLocation().get(event.entity.getEntityId());
@@ -76,7 +76,7 @@ public class ActionKill extends AbstractAction {
killed = true;
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
BlockPos pos = target.getBlockPos(dungeonRoom);
RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true);
RenderUtils.drawTextAtWorld("Spawn", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks);
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 f0b694b0..754bdf35 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
@@ -19,21 +19,17 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.Keybinds;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
import net.minecraft.client.Minecraft;
-import net.minecraft.pathfinding.PathEntity;
-import net.minecraft.pathfinding.PathFinder;
-import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
-import java.awt.*;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.List;
@@ -60,23 +56,24 @@ public class ActionMove extends AbstractAction {
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
BlockPos pos = target.getBlockPos(dungeonRoom);
float distance = MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()));
float multiplier = distance / 120f; //mobs only render ~120 blocks away
+ if (flag) multiplier *= 2.0f;
float scale = 0.45f * multiplier;
scale *= 25.0 / 6.0;
- if (FeatureRegistry.SECRET_BEACONS.isEnabled()) {
- RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), FeatureRegistry.SECRET_BROWSE.getColor(), partialTicks);
- RenderUtils.highlightBlock(pos, FeatureRegistry.SECRET_BROWSE.getColor(), partialTicks);
+ if (actionRouteProperties.isBeacon()) {
+ RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks);
+ RenderUtils.highlightBlock(pos, actionRouteProperties.getBeaconColor(), partialTicks);
}
- RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, 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.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, 1f, true, false, partialTicks);
+ RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 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.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, flag ? 2f : 1f, true, false, partialTicks);
if (!FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() || !Keybinds.togglePathfindStatus) {
if (poses != null){
- RenderUtils.drawLinesVec3(poses, FeatureRegistry.SECRET_BROWSE.getColor(), FeatureRegistry.SECRET_BROWSE.getThickness(), partialTicks, true);
+ RenderUtils.drawLinesVec3(poses, actionRouteProperties.getLineColor(), actionRouteProperties.getLineWidth(), partialTicks, true);
}
}
}
@@ -86,8 +83,8 @@ public class ActionMove extends AbstractAction {
private Future<List<Vec3>> latestFuture;
@Override
- public void onTick(DungeonRoom dungeonRoom) {
- tick = (tick+1) % Math.max(1, FeatureRegistry.SECRET_BROWSE.getRefreshRate());
+ public void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties) {
+ tick = (tick+1) % Math.max(1, actionRouteProperties.getLineRefreshRate());
if (latestFuture != null && latestFuture.isDone()) {
try {
poses = latestFuture.get();
@@ -97,16 +94,21 @@ public class ActionMove extends AbstractAction {
}
}
- if (tick == 0) {
+ if (tick == 0 && actionRouteProperties.isPathfind()) {
try {
if (latestFuture != null) latestFuture.cancel(true);
} catch (Exception ignored) {}
if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() || poses == null)
- latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(),
- Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE);
+ latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, actionRouteProperties.getLineRefreshRate()* 50- 10);
}
}
+ public void forceRefresh(DungeonRoom dungeonRoom) {
+ try {
+ if (latestFuture != null) latestFuture.cancel(true);
+ } catch (Exception ignored) {}
+ latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000);
+ }
@Override
public String toString() {
return "Move\n- target: "+target.toString();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
index b2746157..d990a835 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
@@ -19,20 +19,17 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.Keybinds;
+import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
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 net.minecraft.util.Vec3;
-import java.awt.*;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -59,22 +56,24 @@ public class ActionMoveNearestAir extends AbstractAction {
}
@Override
- public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) {
BlockPos pos = target.getBlockPos(dungeonRoom);
+
float distance = MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()));
float multiplier = distance / 120f; //mobs only render ~120 blocks away
+ if (flag) multiplier *= 2.0f;
float scale = 0.45f * multiplier;
scale *= 25.0 / 6.0;
- if (FeatureRegistry.SECRET_BEACONS.isEnabled()) {
- RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), FeatureRegistry.SECRET_BROWSE.getColor(), partialTicks);
- RenderUtils.highlightBlock(pos, FeatureRegistry.SECRET_BROWSE.getColor(), partialTicks);
+ if (actionRouteProperties.isBeacon()) {
+ RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks);
+ RenderUtils.highlightBlock(pos, actionRouteProperties.getBeaconColor(), partialTicks);
}
- RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, 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.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, 1f, true, false, partialTicks);
+ RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 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.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, flag ? 2f : 1f, true, false, partialTicks);
if (!FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() || !Keybinds.togglePathfindStatus) {
if (poses != null){
- RenderUtils.drawLinesVec3(poses, FeatureRegistry.SECRET_BROWSE.getColor(), FeatureRegistry.SECRET_BROWSE.getThickness(), partialTicks, true);
+ RenderUtils.drawLinesVec3(poses, actionRouteProperties.getLineColor(), actionRouteProperties.getLineWidth(), partialTicks, true);
}
}
}
@@ -83,8 +82,8 @@ public class ActionMoveNearestAir extends AbstractAction {
private List<Vec3> poses;
private Future<List<Vec3>> latestFuture;
@Override
- public void onTick(DungeonRoom dungeonRoom) {
- tick = (tick+1) % Math.max(1, FeatureRegistry.SECRET_BROWSE.getRefreshRate());
+ public void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties) {
+ tick = (tick+1) % Math.max(1, actionRouteProperties.getLineRefreshRate());
if (latestFuture != null && latestFuture.isDone()) {
try {
poses = latestFuture.get();
@@ -94,17 +93,22 @@ public class ActionMoveNearestAir extends AbstractAction {
}
}
- if (tick == 0) {
+ if (tick == 0 && actionRouteProperties.isPathfind()) {
try {
if (latestFuture != null) latestFuture.cancel(true);
} catch (Exception ignored) {}
- if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled()|| poses == null)
- latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(),
- Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE);
+ if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() || poses == null)
+ latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, actionRouteProperties.getLineRefreshRate()* 50- 10);
}
}
+ public void forceRefresh(DungeonRoom dungeonRoom) {
+ try {
+ if (latestFuture != null) latestFuture.cancel(true);
+ } catch (Exception ignored) {}
+ latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000);
+ }
@Override
public String toString() {
return "MoveNearestAir\n- target: "+target.toString();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java
index 76fe5c85..3580dd03 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java
@@ -18,10 +18,13 @@
package kr.syeyoung.dungeonsguide.dungeon.actions.tree;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.dungeon.actions.*;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
+import lombok.Data;
import lombok.Getter;
+import net.minecraft.client.Minecraft;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -40,9 +43,13 @@ public class ActionRoute {
private final DungeonRoom dungeonRoom;
- public ActionRoute(DungeonRoom dungeonRoom, String mechanic, String state) {
+ @Getter
+ private final ActionRouteProperties actionRouteProperties;
+
+ public ActionRoute(DungeonRoom dungeonRoom, String mechanic, String state, ActionRouteProperties actionRouteProperties) {
this.mechanic = mechanic;
this.state = state;
+ this.actionRouteProperties = actionRouteProperties;
ActionChangeState actionChangeState = new ActionChangeState(mechanic, state);
ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom);
@@ -71,25 +78,27 @@ public class ActionRoute {
public void onPlayerInteract(PlayerInteractEvent event) {
- getCurrentAction().onPlayerInteract(dungeonRoom, event);
+ getCurrentAction().onPlayerInteract(dungeonRoom, event, actionRouteProperties );
}
public void onLivingDeath(LivingDeathEvent event) {
- getCurrentAction().onLivingDeath(dungeonRoom, event);
+ getCurrentAction().onLivingDeath(dungeonRoom, event, actionRouteProperties );
}
- public void onRenderWorld(float partialTicks) {
- if (current -1 >= 0 && (actions.get(current-1) instanceof ActionMove || actions.get(current-1) instanceof ActionMoveNearestAir)) actions.get(current-1).onRenderWorld(dungeonRoom, partialTicks);
- getCurrentAction().onRenderWorld(dungeonRoom, partialTicks);
+ public void onRenderWorld(float partialTicks, boolean flag) {
+ if (current -1 >= 0 && (
+ (actions.get(current-1) instanceof ActionMove && ((ActionMove) actions.get(current-1)).getTarget().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) >= 25)
+ || (actions.get(current-1) instanceof ActionMoveNearestAir && ((ActionMoveNearestAir) actions.get(current-1)).getTarget().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) >= 25))) actions.get(current-1).onRenderWorld(dungeonRoom, partialTicks, actionRouteProperties, flag );
+ getCurrentAction().onRenderWorld(dungeonRoom, partialTicks, actionRouteProperties, flag);
}
public void onRenderScreen(float partialTicks) {
- getCurrentAction().onRenderScreen(dungeonRoom, partialTicks);
+ getCurrentAction().onRenderScreen(dungeonRoom, partialTicks, actionRouteProperties);
}
public void onTick() {
Action current = getCurrentAction();
- current.onTick(dungeonRoom);
- if (this.current -1 >= 0 && (actions.get(this.current-1) instanceof ActionMove || actions.get(this.current-1) instanceof ActionMoveNearestAir)) actions.get(this.current-1).onTick(dungeonRoom);
+ current.onTick(dungeonRoom, actionRouteProperties);
+ if (this.current -1 >= 0 && (actions.get(this.current-1) instanceof ActionMove || actions.get(this.current-1) instanceof ActionMoveNearestAir)) actions.get(this.current-1).onTick(dungeonRoom, actionRouteProperties );
if (dungeonRoom.getMechanics().get(mechanic).getCurrentState(dungeonRoom).equals(state)) {
this.current = actions.size() - 1;
@@ -99,5 +108,17 @@ public class ActionRoute {
next();
}
- public void onLivingInteract(PlayerInteractEntityEvent event) { getCurrentAction().onLivingInteract(dungeonRoom, event); }
+ public void onLivingInteract(PlayerInteractEntityEvent event) { getCurrentAction().onLivingInteract(dungeonRoom, event, actionRouteProperties ); }
+
+ @Data
+ public static class ActionRouteProperties {
+ private boolean pathfind;
+ private int lineRefreshRate;
+ private AColor lineColor;
+ private float lineWidth;
+
+ private boolean beacon;
+ private AColor beaconColor;
+ private AColor beaconBeamColor;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
index 70c714fe..65408f92 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -156,6 +156,7 @@ public class DungeonSecret implements DungeonMechanic {
return base;
}
if (!"found".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret");
+ if (state.equals("found") && getSecretStatus(dungeonRoom) == SecretStatus.FOUND) return new HashSet<>();
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
if (secretType == SecretType.CHEST || secretType == SecretType.ESSENCE) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
index c68cb511..00b81f59 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
@@ -94,13 +94,13 @@ public class DungeonRoom {
this.currentState = currentState;
}
- public ScheduledFuture<List<Vec3>> createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, BlockPos targetPos, float dist) {
+ public ScheduledFuture<List<Vec3>> createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, BlockPos targetPos, float dist, int timeout) {
if (FeatureRegistry.SECRET_PATHFIND_STRATEGY.isEnabled()) {
ScheduledFuture<List<Vec3>> sf = asyncPathFinder.schedule(() -> {
BlockPos min = new BlockPos(getMin().getX(), 0, getMin().getZ());
BlockPos max= new BlockPos(getMax().getX(), 255, getMax().getZ());
JPSPathfinder pathFinder = new JPSPathfinder(context.getWorld(), min, max);
- pathFinder.pathfind(entityIn.getPositionVector(), new Vec3(targetPos).addVector(0.5, 0.5, 0.5), 1.5f,1000);
+ pathFinder.pathfind(entityIn.getPositionVector(), new Vec3(targetPos).addVector(0.5, 0.5, 0.5), 1.5f,timeout);
return pathFinder.getRoute();
}, 0, TimeUnit.MILLISECONDS);
return sf;
@@ -118,7 +118,6 @@ public class DungeonRoom {
}
return new ArrayList<>();
}, 0, TimeUnit.MILLISECONDS);
- asyncPathFinder.schedule(() -> sf.cancel(true), 10, TimeUnit.SECONDS);
return sf;
}
}