From b808e27a2cc2c6c8fdf93e5de6ddf05053c3addb Mon Sep 17 00:00:00 2001 From: syeyoung Date: Fri, 12 Feb 2021 15:14:12 +0900 Subject: works pretty great --- .../dungeonsguide/dungeon/actions/ActionMove.java | 11 ++++- .../dungeonsguide/features/FeatureRegistry.java | 3 ++ .../features/impl/boss/FeatureCurrentPhase.java | 55 ++++++++++++++++++++++ .../features/impl/secret/FeatureActions.java | 14 ++++-- .../pathfinding/NodeProcessorDungeonRoom.java | 12 ++++- .../roomedit/panes/GeneralEditPane.java | 6 +-- .../roomprocessor/GeneralRoomProcessor.java | 18 ++++++- 7 files changed, 107 insertions(+), 12 deletions(-) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java (limited to 'src/main/java/kr') 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 e521a4c9..e2d6b318 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -38,8 +38,15 @@ public class ActionMove extends AbstractAction { @Override public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { 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); + + float distance = MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())); + float multiplier = distance / 120f; //mobs only render ~120 blocks away + float scale = 0.45f * multiplier; + scale *= 25.0 / 6.0; + RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, (float) (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); + + if (latest != null){ List poses = new ArrayList(); for (int i = 0; i < latest.getCurrentPathLength(); i++) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index b507ba47..e9f7c14f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -73,6 +73,7 @@ public class FeatureRegistry { public static final FeatureBoxRealLivid BOSSFIGHT_BOX_REALLIVID = register(new FeatureBoxRealLivid()); public static final FeatureBossHealth BOSSFIGHT_HEALTH = register(new FeatureBossHealth()); public static final FeatureThornBearPercentage BOSSFIGHT_BEAR_PERCENT = register(new FeatureThornBearPercentage()); + public static final FeatureCurrentPhase BOSSFIGHT_CURRENT_PHASE = register(new FeatureCurrentPhase()); public static final FeatureInstaCloseChest DUNGEON_INSTACLOSE = register(new FeatureInstaCloseChest()); public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster()); @@ -90,5 +91,7 @@ public class FeatureRegistry { public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); + public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Secret", "Auto browse next secret.", "Auto browse next secret after current one completes.\nYou still need to trigger first pathfinding of first secret, after that this option would start working", "secret.autobrowse", false)); + public static final SimpleFeature SECRET_DRAW_ARROW = register(new SimpleFeature("Secret", "Draw Arrows on Moving actions", "Overlay arrows over found path", "secret.arrows", false)); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java new file mode 100644 index 00000000..f38e02ed --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java @@ -0,0 +1,55 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.text.StyledText; +import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class FeatureCurrentPhase extends TextHUDFeature { + public FeatureCurrentPhase() { + super("Bossfight", "Display Current Phase", "Displays the current phase of bossfight", "bossfight.phasedisplay", false, getFontRenderer().getStringWidth("Current Phase: fight-2-idk-howlng"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(true); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + private static final List dummyText= new ArrayList(); + static { + dummyText.add(new StyledText("Current Phase","title")); + dummyText.add(new StyledText(": ","separator")); + dummyText.add(new StyledText("fight-2","phase")); + } + @Override + public boolean isHUDViewable() { + return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() != null; + } + + @Override + public List getUsedTextStyle() { + return Arrays.asList(new String[] { + "title", "separator", "phase" + }); + } + + @Override + public List getDummyText() { + return dummyText; + } + + @Override + public List getText() { + String currentPhsae =skyblockStatus.getContext().getBossfightProcessor().getCurrentPhase(); + List actualBit = new ArrayList(); + actualBit.add(new StyledText("Current Phase","title")); + actualBit.add(new StyledText(": ","separator")); + actualBit.add(new StyledText(currentPhsae,"phase")); + return actualBit; + } + +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java index 888f4d8c..297ec27d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java @@ -39,7 +39,6 @@ public class FeatureActions extends TextHUDFeature { @Override public boolean isHUDViewable() { - if (Minecraft.getMinecraft().currentScreen != null) return false; if (!skyblockStatus.isOnDungeon()) return false; if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return false; DungeonContext context = skyblockStatus.getContext(); @@ -105,17 +104,22 @@ public class FeatureActions extends TextHUDFeature { actualBit.add(new StyledText("-> ","separator")); actualBit.add(new StyledText(path.getState()+"\n","state")); - for (int i = 0; i < path.getActions().size(); i++) { + for (int i = Math.max(0,path.getCurrent()-2); i < path.getActions().size(); i++) { actualBit.add(new StyledText((i == path.getCurrent() ? ">" : " ") +" ","current")); actualBit.add(new StyledText(i+"","number")); actualBit.add(new StyledText(". ","dot")); Action action = path.getActions().get(i); - String[] str = action.toString().split(" "); + String[] str = action.toString().split("\n"); actualBit.add(new StyledText(str[0] + " ","action")); + actualBit.add(new StyledText("(","afterline")); for (int i1 = 1; i1 < str.length; i1++) { - actualBit.add(new StyledText(str[i1]+" ","afterline")); + String base = str[i1].trim(); + if (base.startsWith("-")) + base = base.substring(1); + base = base.trim(); + actualBit.add(new StyledText(base+" ","afterline")); } - actualBit.add(new StyledText("\n","afterline")); + actualBit.add(new StyledText(")\n","afterline")); } } return actualBit; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java index e31b0f84..b625e869 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java @@ -31,11 +31,21 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { (int)z - dungeonRoom.getMin().getZ()); } + private static final EnumFacing[] values2 = new EnumFacing[6]; + static { + values2[0] = EnumFacing.DOWN; + values2[1] = EnumFacing.NORTH; + values2[2] = EnumFacing.SOUTH; + values2[3] = EnumFacing.EAST; + values2[4] = EnumFacing.WEST; + values2[5] = EnumFacing.UP; + } + @Override public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; - for (EnumFacing ef:EnumFacing.VALUES) { + for (EnumFacing ef:values2) { Vec3i dir = ef.getDirectionVec(); int newX = currentPoint.xCoord + dir.getX(); int newY = currentPoint.yCoord + dir.getY(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java index fc2584d6..f4450bd2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java @@ -173,10 +173,10 @@ public class GeneralEditPane extends MPanel { @Override public void onBoundsUpdate() { if (save != null) - save.setBounds(new Rectangle(0,140,getBounds().width, 20)); - end.setBounds(new Rectangle(1,120,getBounds().width-2, 20)); + save.setBounds(new Rectangle(0,160,getBounds().width, 20)); + end.setBounds(new Rectangle(1,140,getBounds().width-2, 20)); if (schematic != null) - schematic.setBounds(new Rectangle(0,160,getBounds().width, 20)); + schematic.setBounds(new Rectangle(0,180,getBounds().width, 20)); } private NBTTagCompound createNBT() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 71c6fbc0..da7b7b59 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionComplete; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; @@ -48,7 +49,22 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void tick() { - if (path != null) path.onTick(); + if (path != null) { + path.onTick(); + if (FeatureRegistry.SECRET_AUTO_BROWSE_NEXT.isEnabled() && path.getCurrentAction() instanceof ActionComplete) { + if (!path.getState().equals("found")) return; + if (!(dungeonRoom.getDungeonRoomInfo().getMechanics().get(path.getMechanic()) instanceof DungeonSecret)) return; + boolean foundcurr = false; + for (Map.Entry mech: dungeonRoom.getDungeonRoomInfo().getMechanics().entrySet()) { + if (!(mech.getValue() instanceof DungeonSecret)) continue; + if (foundcurr && ((DungeonSecret) mech.getValue()).getSecretStatus(getDungeonRoom()) != DungeonSecret.SecretStatus.FOUND) { + pathfind(mech.getKey(), "found"); + break; + } + if (mech.getKey().equals(path.getMechanic())) foundcurr = true; + } + } + } } @Override -- cgit