From 77af3008dba9efab778555093191ecf8817e0ed3 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Fri, 12 Feb 2021 21:16:58 +0900 Subject: smol fix --- .../dungeonsguide/dungeon/actions/ActionInteract.java | 1 + .../dungeonsguide/dungeon/mechanics/DungeonDoor.java | 10 +++++++++- .../dungeonsguide/dungeon/mechanics/DungeonDummy.java | 7 ++++++- .../dungeonsguide/dungeon/mechanics/DungeonLever.java | 1 + .../dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java | 10 +++++++++- .../dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java | 1 + .../dungeon/mechanics/DungeonPressurePlate.java | 1 + .../dungeon/roomfinder/DungeonRoomInfoRegistry.java | 12 ++++++++++++ 8 files changed, 40 insertions(+), 3 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon') 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 b3be996a..96b4e874 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java @@ -40,6 +40,7 @@ public class ActionInteract extends AbstractAction { private boolean interacted = false; @Override public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event) { + System.out.println("eve"); if (interacted) return; Vec3 spawnLoc = EntitySpawnManager.getSpawnLocation().get(event.getEntity().getEntityId()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java index 39d53931..cdfc7c37 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java @@ -102,6 +102,14 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker { @Override public OffsetPoint getRepresentingPoint() { - return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0); + int leastY = Integer.MAX_VALUE; + OffsetPoint thatPt = null; + for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { + if (offsetPoint.getY() < leastY) { + thatPt = offsetPoint; + leastY = offsetPoint.getY(); + } + } + return thatPt; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java index 41e591c1..3fe6ef46 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java @@ -31,9 +31,14 @@ public class DungeonDummy implements DungeonMechanic { preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); } else if (state.equalsIgnoreCase("click")) { - ActionClick actionMove = new ActionClick(secretPoint); + ActionClick actionClick = new ActionClick(secretPoint); + preRequisites.add(actionClick); + preRequisites = actionClick.getPreRequisite(); + + ActionMove actionMove = new ActionMove(secretPoint); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); + } { for (String str : preRequisite) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java index 787208cc..7dd69af3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java @@ -20,6 +20,7 @@ public class DungeonLever implements DungeonMechanic { @Override public Set getAction(String state, DungeonRoom dungeonRoom) { + if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { Set base; Set preRequisites = base = new HashSet(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java index 2e279b64..803f7c5b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java @@ -104,6 +104,14 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { @Override public OffsetPoint getRepresentingPoint() { - return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0); + int leastY = Integer.MAX_VALUE; + OffsetPoint thatPt = null; + for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { + if (offsetPoint.getY() < leastY) { + thatPt = offsetPoint; + leastY = offsetPoint.getY(); + } + } + return thatPt; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java index 926c989d..bddfa231 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java @@ -20,6 +20,7 @@ public class DungeonOnewayLever implements DungeonMechanic { @Override public Set getAction(String state, DungeonRoom dungeonRoom) { + if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { Set base; Set preRequisites = base = new HashSet(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java index 3574c8c9..79ef4bda 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -20,6 +20,7 @@ public class DungeonPressurePlate implements DungeonMechanic { @Override public Set getAction(String state, DungeonRoom dungeonRoom) { + if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { Set base; Set preRequisites = base = new HashSet(); 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 e014d721..128090db 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.dungeon.roomfinder; +import com.google.common.io.Files; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import net.minecraft.client.Minecraft; @@ -10,6 +11,7 @@ import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.io.*; import java.net.URL; +import java.nio.charset.Charset; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; @@ -22,6 +24,7 @@ public class DungeonRoomInfoRegistry { public static void register(DungeonRoomInfo dungeonRoomInfo) { if (dungeonRoomInfo == null) throw new NullPointerException("what the fak parameter is noll?"); + if (uuidMap.containsKey(dungeonRoomInfo.getUuid())) return; dungeonRoomInfo.setRegistered(true); registered.add(dungeonRoomInfo); uuidMap.put(dungeonRoomInfo.getUuid(), dungeonRoomInfo); @@ -54,6 +57,7 @@ public class DungeonRoomInfoRegistry { dir.mkdirs(); boolean isDev = Minecraft.getMinecraft().getSession().getPlayerID().replace("-","").equals("e686fe0aab804a71ac7011dc8c2b534c"); System.out.println(isDev); + String nameidstring = "name,uuid,processsor,secrets"; for (DungeonRoomInfo dungeonRoomInfo : registered) { try { if (!dungeonRoomInfo.isUserMade() && !isDev) continue; @@ -62,8 +66,16 @@ public class DungeonRoomInfoRegistry { oos.writeObject(dungeonRoomInfo); oos.flush(); oos.close(); + + nameidstring += "\n"+dungeonRoomInfo.getName()+","+dungeonRoomInfo.getUuid() +","+dungeonRoomInfo.getProcessorId()+","+dungeonRoomInfo.getTotalSecrets(); } catch (Exception e) {e.printStackTrace();} } + + try { + Files.write(nameidstring, new File(dir, "roomidmapping.csv"), Charset.defaultCharset()); + } catch (IOException e) { + e.printStackTrace(); + } } public static void loadAll(File dir) throws BadPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException, IllegalBlockSizeException, NoSuchPaddingException, InvalidKeyException { -- cgit