diff options
author | syeyoung <cyong06@naver.com> | 2021-02-12 21:16:58 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-12 21:16:58 +0900 |
commit | 77af3008dba9efab778555093191ecf8817e0ed3 (patch) | |
tree | 0440e57ff7eb6758ada65bf0fa7341d055f85ecb /src/main/java/kr | |
parent | 5cac3f67b8d77bbf10b1c6cff1137f695a11f0f0 (diff) | |
download | Skyblock-Dungeons-Guide-77af3008dba9efab778555093191ecf8817e0ed3.tar.gz Skyblock-Dungeons-Guide-77af3008dba9efab778555093191ecf8817e0ed3.tar.bz2 Skyblock-Dungeons-Guide-77af3008dba9efab778555093191ecf8817e0ed3.zip |
smol fix
Diffstat (limited to 'src/main/java/kr')
12 files changed, 75 insertions, 6 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index b2b730e0..58e256f2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -3,6 +3,7 @@ package kr.syeyoung.dungeonsguide.commands; import com.google.gson.JsonObject; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.e; @@ -20,7 +21,7 @@ import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.awt.*; -import java.io.IOException; +import java.io.*; import java.security.*; import java.security.cert.CertificateException; import java.text.SimpleDateFormat; @@ -117,6 +118,36 @@ public class CommandDungeonsGuide extends CommandBase { } catch (Throwable t) { t.printStackTrace(); } + } else if (args[0].equals("process") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-","").equals("e686fe0aab804a71ac7011dc8c2b534c")) { + File root = e.getDungeonsGuide().getConfigDir(); + File dir = new File(root, "processorinput"); + File outsecret = new File(root, "processoroutpuzzle"); + File outpuzzle = new File(root, "processoroutsecret"); + for (File f : dir.listFiles()) { + if (!f.getName().endsWith(".roomdata")) continue; + try { + InputStream fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis); + DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); + ois.close(); + fis.close(); + dri.setUserMade(false); + + FileOutputStream fos = new FileOutputStream(new File(outsecret, dri.getUuid().toString() + ".roomdata")); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(dri); + oos.flush(); + oos.close(); + + dri.getMechanics().clear(); + + fos = new FileOutputStream(new File(outpuzzle, dri.getUuid().toString() + ".roomdata")); + oos = new ObjectOutputStream(fos); + oos.writeObject(dri); + oos.flush(); + oos.close(); + } catch (Exception e) {e.printStackTrace();} + } } else { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); 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<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); 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<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); 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<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); 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 { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java index 18d1195e..ceda3e6d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java @@ -41,7 +41,7 @@ public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret> value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); add(value); - selectionButton = new MStringSelectionButton(Arrays.asList(new String[] {"CHEST", "BAT", "ITEM_DROP", "ESSENCE"}), "CHEST"); + selectionButton = new MStringSelectionButton(Arrays.asList(new String[] {"CHEST", "BAT", "ITEM_DROP", "ESSENCE"}), dungeonSecret.getSecretType().name()); selectionButton.setOnUpdate(new Runnable() { @Override public void run() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index aeec01dd..b795472f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -176,6 +176,7 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void onInteract(PlayerInteractEntityEvent event) { + if (path != null) path.getCurrentAction().onLivingInteract(getDungeonRoom(), event); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java index 42f27628..ff06bbb6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java @@ -84,7 +84,7 @@ public class RoomProcessorIcePath extends GeneralRoomProcessor { public void tick() { super.tick(); - if (err) { + if (err || silverfish.isDead) { findSilverFishanddoStuff(); if (err) return; } |