diff options
author | syeyoung <cyoung06@naver.com> | 2021-10-09 12:20:55 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2021-10-09 12:20:55 +0900 |
commit | 0b1a144b3847df60e78c79a6fe66ed99732e11d5 (patch) | |
tree | 91b01f9e5bd611dfddb3e0c7ceafd62fccdb422f /src/main/java/kr | |
parent | 21ed396dd1ae4d8b327f44cc013d2dd033a04209 (diff) | |
download | Skyblock-Dungeons-Guide-0b1a144b3847df60e78c79a6fe66ed99732e11d5.tar.gz Skyblock-Dungeons-Guide-0b1a144b3847df60e78c79a6fe66ed99732e11d5.tar.bz2 Skyblock-Dungeons-Guide-0b1a144b3847df60e78c79a6fe66ed99732e11d5.zip |
- blaze color
Diffstat (limited to 'src/main/java/kr')
3 files changed, 75 insertions, 25 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index cb6ecd6f..64254a0a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -44,6 +44,7 @@ import kr.syeyoung.dungeonsguide.features.impl.party.customgui.FeatureCustomPart import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; import kr.syeyoung.dungeonsguide.features.impl.secret.*; import kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser.FeatureMechanicBrowse; +import kr.syeyoung.dungeonsguide.features.impl.solvers.FeatureSolverBlaze; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MKeyEditButton; import lombok.Getter; @@ -140,9 +141,7 @@ public class FeatureRegistry { public static final SimpleFeature SOLVER_WATERPUZZLE = register(new SimpleFeature("Solver.Any Floor", "Waterboard (Advanced)", "Calculates solution for waterboard puzzle and displays it to user", "solver.waterboard")); public static final SimpleFeature SOLVER_CREEPER = register(new SimpleFeature("Solver.Any Floor", "Creeper", "Draws line between prismarine lamps in creeper room", "solver.creeper")); public static final SimpleFeature SOLVER_TELEPORT = register(new SimpleFeature("Solver.Any Floor", "Teleport", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport")); - public static final SimpleFeature SOLVER_BLAZE = register(new SimpleFeature("Solver.Floor 2+", "Blaze", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze") {{ - parameters.put("blazeborder", new FeatureParameter<AColor>("blazeborder", "Blaze Border Color", "Blaze border color", new AColor(255,255,255,0), "acolor")); - }}); + public static final FeatureSolverBlaze SOLVER_BLAZE = register(new FeatureSolverBlaze()); public static final SimpleFeature SOLVER_ICEPATH = register(new SimpleFeature("Solver.Floor 3+", "Icepath (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath")); public static final SimpleFeature SOLVER_SILVERFISH = register(new SimpleFeature("Solver.Floor 3+", "Silverfish (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish")); public static final SimpleFeature SOLVER_BOX = register(new SimpleFeature("Solver.Floor 3+", "Box (Advanced)", "Calculates solution for box puzzle room, and displays it to user", "solver.box")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java new file mode 100644 index 00000000..1e698414 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java @@ -0,0 +1,46 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.features.impl.solvers; + +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +public class FeatureSolverBlaze extends SimpleFeature { + public FeatureSolverBlaze() { + super("Solver.Floor 2+", "Blaze", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze"); + parameters.put("normBlazeColor", new FeatureParameter<AColor>("blazecolor", "Normal Blaze Color", "Normal Blaze Color", new AColor(255,255,255,255), "acolor")); + parameters.put("nextBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Blaze Color", "Next Blaze Color", new AColor(0,255,0,255), "acolor")); + parameters.put("nextUpBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Up Blaze Color", "Color of blaze after next blaze", new AColor(255,255,0,255), "acolor")); + parameters.put("blazeborder", new FeatureParameter<AColor>("blazeborder", "Blaze Border Color", "Blaze border color", new AColor(255,255,255,0), "acolor")); + } + + public AColor getBlazeColor() { + return this.<AColor>getParameter("normBlazeColor").getValue(); + } + public AColor getNextBlazeColor() { + return this.<AColor>getParameter("nextBlazeColor").getValue(); + } + public AColor getNextUpBlazeColor() { + return this.<AColor>getParameter("nextUpBlazeColor").getValue(); + } + public AColor getBorder() { + return this.<AColor>getParameter("blazeborder").getValue(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java index 73fa957e..4c3fff71 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java @@ -23,6 +23,7 @@ import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.impl.solvers.FeatureSolverBlaze; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.block.Block; @@ -57,7 +58,7 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { private List<EntityArmorStand> entityList = new ArrayList<EntityArmorStand>(); private List<EntityBlaze> blazeList = new ArrayList<>(); private EntityArmorStand next; - private EntityBlaze nextBlaze; + private EntityBlaze nextBlaze, theoneafterit; public RoomProcessorBlazeSolver(DungeonRoom dungeonRoom) { super(dungeonRoom); Object highToLow = dungeonRoom.getDungeonRoomInfo().getProperties().get("order"); @@ -84,30 +85,32 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { && low.getZ() < pos.getZ() && pos.getZ() < high.getZ(); })); - EntityArmorStand semi_target = null; - int health = (highToLow ? Integer.MIN_VALUE : Integer.MAX_VALUE); - for (EntityArmorStand ea : entityList) { - String name = ea.getName(); + Comparator<EntityArmorStand> comparator = Comparator.comparingInt(a -> { + String name = a.getName(); String colorGone = TextUtils.stripColor(name); String health2 = TextUtils.keepIntegerCharactersOnly(colorGone.split("/")[1]); try { - int heal = Integer.parseInt(health2); - if (highToLow && heal > health) { - health = heal; - semi_target = ea; - } else if (!highToLow && heal < health) { - health = heal; - semi_target = ea; - } - } catch (Exception e){} + return Integer.parseInt(health2); + } catch (Exception e) {return -1;} + }); + if (highToLow) { + entityList.sort(comparator.reversed()); + } else { + entityList.sort(comparator); + } + if (entityList.size() > 0) { + next = entityList.get(0); + nextBlaze = blazeList.stream().min(Comparator.comparingDouble(e -> e.getDistanceSqToEntity(next))).orElse(null); + } else { + nextBlaze = null; } - if (semi_target != null) { - EntityArmorStand finalSemi_target = semi_target; - nextBlaze = blazeList.stream().min(Comparator.comparingDouble(e -> e.getDistanceSqToEntity(finalSemi_target))).orElse(null); + if (entityList.size() > 1) { + EntityArmorStand thenextone = entityList.get(1); + theoneafterit = blazeList.stream().min(Comparator.comparingDouble(e -> e.getDistanceSqToEntity(thenextone))).orElse(null); + } else { + theoneafterit = null; } - - next = semi_target; } @@ -161,10 +164,12 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { boolean border = true; - if (entity != nextBlaze) - RenderUtils.highlightBox(entity, AxisAlignedBB.fromBounds(-0.8,0, -0.8, 0.8, 2, 0.8), new Color(255,255,255,255), partialTicks, false); + if (entity == theoneafterit) { + RenderUtils.highlightBox(entity, AxisAlignedBB.fromBounds(-0.8,0, -0.8, 0.8, 2, 0.8), FeatureRegistry.SOLVER_BLAZE.getNextUpBlazeColor(), partialTicks, false); + } else if (entity == nextBlaze) + RenderUtils.highlightBox(entity, AxisAlignedBB.fromBounds(-0.8,0, -0.8, 0.8, 2, 0.8), FeatureRegistry.SOLVER_BLAZE.getNextBlazeColor(), partialTicks, false); else - RenderUtils.highlightBox(entity, AxisAlignedBB.fromBounds(-0.8,0, -0.8, 0.8, 2, 0.8), new Color(0,255,0,255), partialTicks, false); + RenderUtils.highlightBox(entity, AxisAlignedBB.fromBounds(-0.8,0, -0.8, 0.8, 2, 0.8), FeatureRegistry.SOLVER_BLAZE.getBlazeColor(), partialTicks, false); GlStateManager.color(1,1,1,1); |