diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
12 files changed, 44 insertions, 48 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index 99517134..cc3b1617 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -30,26 +30,26 @@ import java.util.List; public class DungeonContext { @Getter - private World world; + private final World world; @Getter - private MapProcessor mapProcessor; + private final MapProcessor mapProcessor; @Getter @Setter private BlockPos dungeonMin; @Getter - private Map<Point, DungeonRoom> roomMapper = new HashMap<Point, DungeonRoom>(); + private final Map<Point, DungeonRoom> roomMapper = new HashMap<Point, DungeonRoom>(); @Getter - private List<DungeonRoom> dungeonRoomList = new ArrayList<DungeonRoom>(); + private final List<DungeonRoom> dungeonRoomList = new ArrayList<DungeonRoom>(); @Getter - private List<RoomProcessor> globalRoomProcessors = new ArrayList<RoomProcessor>(); + private final List<RoomProcessor> globalRoomProcessors = new ArrayList<RoomProcessor>(); @Getter - private Map<String, Integer> deaths = new HashMap<String, Integer>(); + private final Map<String, Integer> deaths = new HashMap<String, Integer>(); @Getter - private List<String[]> milestoneReached = new ArrayList<String[]>(); + private final List<String[]> milestoneReached = new ArrayList<String[]>(); @Getter @Setter private long BossRoomEnterSeconds = -1; @@ -81,16 +81,16 @@ public class DungeonContext { private BossfightProcessor bossfightProcessor; @Getter - private Set<String> players = new HashSet<String>(); + private final Set<String> players = new HashSet<String>(); @Getter - private List<DungeonEvent> events = new ArrayList<DungeonEvent>(); + private final List<DungeonEvent> events = new ArrayList<DungeonEvent>(); public DungeonContext(World world) { this.world = world; createEvent(new DungeonNodataEvent("DUNGEON_CONTEXT_CREATION")); mapProcessor = new MapProcessor(this); - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (doorFinder != null) trapRoomGen = doorFinder.isTrapSpawn(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); else mapProcessor.setBugged(true); @@ -112,7 +112,7 @@ public class DungeonContext { bossroomSpawnPos = Minecraft.getMinecraft().thePlayer.getPosition(); MinecraftForge.EVENT_BUS.post(new BossroomEnterEvent()); createEvent(new DungeonNodataEvent("BOSSROOM_ENTER")); - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (doorFinder != null) { bossfightProcessor = doorFinder.createBossfightProcessor(world, e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); } else { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index e3ec00c6..51442cf1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -42,7 +42,7 @@ public class MapProcessor { private MapData lastMapData2; @Getter - private BiMap<String, String> mapIconToPlayerMap = HashBiMap.create(); + private final BiMap<String, String> mapIconToPlayerMap = HashBiMap.create(); @Getter private Dimension unitRoomDimension; @@ -54,7 +54,7 @@ public class MapProcessor { @Setter private boolean bugged = false; - private List<Point> roomsFound = new ArrayList<Point>(); + private final List<Point> roomsFound = new ArrayList<Point>(); private boolean axisMatch = false; @@ -127,7 +127,7 @@ public class MapProcessor { } // determine door location based on npc, and determine map min from there { - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (doorFinder == null) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find door processor for "+e.getDungeonsGuide().getSkyblockStatus().getDungeonName())); bugged = true; @@ -245,7 +245,7 @@ public class MapProcessor { builder.append(isSet ? "O" : "X"); } } - e.sendDebugChat(new ChatComponentText("Shape visual: "+builder.toString())); + e.sendDebugChat(new ChatComponentText("Shape visual: "+ builder)); context.getDungeonRoomList().add(rooms); for (Point p:rooms.getUnitPoints()) { 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 2a7ebd38..f8071fd5 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -47,7 +47,7 @@ public class ActionMove extends AbstractAction { 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("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); if (FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() && Keybinds.togglePathfindStatus) return; 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 3a49005d..a149e129 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -46,7 +46,7 @@ public class ActionMoveNearestAir extends AbstractAction { 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("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); if (FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() && Keybinds.togglePathfindStatus) return; 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 d5c99c8a..ce4ba4df 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 @@ -13,16 +13,16 @@ import java.util.List; public class ActionRoute { @Getter - private String mechanic; + private final String mechanic; @Getter - private String state; + private final String state; @Getter private int current; @Getter - private List<Action> actions; + private final List<Action> actions; - private DungeonRoom dungeonRoom; + private final DungeonRoom dungeonRoom; public ActionRoute(DungeonRoom dungeonRoom, String mechanic, String state) { this.mechanic = mechanic; @@ -62,10 +62,12 @@ public class ActionRoute { } public void onRenderWorld(float partialTicks) { getCurrentAction().onRenderWorld(dungeonRoom, partialTicks); - }; + } + public void onRenderScreen(float partialTicks) { getCurrentAction().onRenderScreen(dungeonRoom, partialTicks); - }; + } + public void onTick() { Action current = getCurrentAction(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java index 0c874458..50955ba9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -104,9 +104,6 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { return true; } else if (floor.equals("F6")) { return true; - } else if (floor.equals("F7")) { - return true; - } - return false; + } else return floor.equals("F7"); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java index f41bcf03..0e8e67b2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java @@ -89,9 +89,6 @@ public class CatacombMasterDataProvider implements DungeonSpecificDataProvider { return true; } else if (floor.equals("M6")) { return true; - } else if (floor.equals("M7")) { - return true; - } - return false; + } else return floor.equals("M7"); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java index d9e8cd2d..b7760327 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java @@ -14,7 +14,7 @@ import java.util.HashSet; import java.util.Set; public class DungeonRoomDoor implements DungeonMechanic { - private DungeonDoor doorfinder; + private final DungeonDoor doorfinder; public DungeonRoomDoor(DungeonDoor doorfinder) { this.doorfinder = doorfinder; 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 b7a3eee9..6966fd65 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -58,7 +58,7 @@ public class DungeonSecret implements DungeonMechanic { if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) return; } - dungeonRoom.getRoomContext().put("i-" + pos.toString(), true); + dungeonRoom.getRoomContext().put("i-" + pos, true); } } } @@ -104,7 +104,7 @@ public class DungeonSecret implements DungeonMechanic { return SecretStatus.NOT_SURE; } else { Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom)); - if (dungeonRoom.getRoomContext().containsKey("i-"+pos.toString())) + if (dungeonRoom.getRoomContext().containsKey("i-"+ pos)) return SecretStatus.FOUND; Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); if (player.squareDistanceTo(pos) < 16) { @@ -116,7 +116,7 @@ public class DungeonSecret implements DungeonMechanic { if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) return SecretStatus.NOT_SURE; } - dungeonRoom.getRoomContext().put("i-" + pos.toString(), true); + dungeonRoom.getRoomContext().put("i-" + pos, true); } return SecretStatus.NOT_SURE; } @@ -175,16 +175,16 @@ public class DungeonSecret implements DungeonMechanic { RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); } - public static enum SecretType { + public enum SecretType { BAT, CHEST, ITEM_DROP, ESSENCE } @AllArgsConstructor @Getter - public static enum SecretStatus { + public enum SecretStatus { DEFINITELY_NOT("definitely_not"), NOT_SURE("not_sure"), CREATED("created"), FOUND("found"), ERROR("error"); - private String stateName; + private final String stateName; } public DungeonSecret clone() throws CloneNotSupportedException { 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 ffc9ca6d..c77e8056 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java @@ -74,7 +74,7 @@ public class DungeonRoom { } @Getter - private PathFinder pathFinder; + private final PathFinder pathFinder; public ScheduledFuture<List<BlockPos>> createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, BlockPos targetPos, float dist) { return asyncPathFinder.schedule(() -> { @@ -93,16 +93,16 @@ public class DungeonRoom { private static final ScheduledExecutorService asyncPathFinder = Executors.newScheduledThreadPool(2); @Getter - private NodeProcessorDungeonRoom nodeProcessorDungeonRoom; + private final NodeProcessorDungeonRoom nodeProcessorDungeonRoom; @Getter private final Map<String, Object> roomContext = new HashMap<String, Object>(); @AllArgsConstructor @Getter - public static enum RoomState { + public enum RoomState { DISCOVERED(0), COMPLETE_WITHOUT_SECRETS(0), FINISHED(0), FAILED(-14); - private int scoreModifier; + private final int scoreModifier; } private RoomProcessor roomProcessor; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java index 19f2fd3c..e0bfe0f3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -18,9 +18,9 @@ import java.security.NoSuchAlgorithmException; import java.util.*; public class DungeonRoomInfoRegistry { - private static List<DungeonRoomInfo> registered = new ArrayList<DungeonRoomInfo>(); - private static Map<Short, List<DungeonRoomInfo>> shapeMap = new HashMap<Short, List<DungeonRoomInfo>>(); - private static Map<UUID, DungeonRoomInfo> uuidMap = new HashMap<UUID, DungeonRoomInfo>(); + private static final List<DungeonRoomInfo> registered = new ArrayList<DungeonRoomInfo>(); + private static final Map<Short, List<DungeonRoomInfo>> shapeMap = new HashMap<Short, List<DungeonRoomInfo>>(); + private static final Map<UUID, DungeonRoomInfo> uuidMap = new HashMap<UUID, DungeonRoomInfo>(); public static void register(DungeonRoomInfo dungeonRoomInfo) { if (dungeonRoomInfo == null) throw new NullPointerException("what the fak parameter is noll?"); @@ -42,7 +42,7 @@ public class DungeonRoomInfoRegistry { public static List<DungeonRoomInfo> getByShape(Short shape) { List<DungeonRoomInfo> dungeonRoomInfos = shapeMap.get(shape); - return dungeonRoomInfos == null ? Collections.<DungeonRoomInfo>emptyList() : dungeonRoomInfos; + return dungeonRoomInfos == null ? Collections.emptyList() : dungeonRoomInfos; } public static DungeonRoomInfo getByUUID(UUID uid) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java index cf846b20..c3e3706b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java @@ -12,7 +12,7 @@ import net.minecraft.world.World; import java.util.List; public class RoomMatcher { - private DungeonRoom dungeonRoom; + private final DungeonRoom dungeonRoom; @Getter private DungeonRoomInfo match; @@ -20,7 +20,7 @@ public class RoomMatcher { private int rotation; // how much the "found room" has to rotate clockwise to match the given dungeon room info. ! private boolean triedMatch = false; - private World w; + private final World w; public RoomMatcher(DungeonRoom dungeonRoom) { this.dungeonRoom = dungeonRoom; |