From d72f7f1db99b76385073995ed0b193b7ed5361c0 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sun, 28 Feb 2021 22:21:58 +0900 Subject: iron bars --- .../commands/CommandDungeonsGuide.java | 17 ++++++------- .../pathfinding/NodeProcessorDungeonRoom.java | 28 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'src/main/java/kr') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index e329beb6..b8b15fa3 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -4,6 +4,8 @@ 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.mechanics.DungeonMechanic; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.e; @@ -34,6 +36,7 @@ import java.security.*; import java.security.cert.CertificateException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Map; import java.util.zip.GZIPOutputStream; public class CommandDungeonsGuide extends CommandBase { @@ -159,7 +162,7 @@ public class CommandDungeonsGuide extends CommandBase { e.printStackTrace(); } } - } else if (args[0].equals("fixmap") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { + } else if (args[0].equals("check") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { File root = e.getDungeonsGuide().getConfigDir(); for (File f : root.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; @@ -169,16 +172,14 @@ public class CommandDungeonsGuide extends CommandBase { DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); ois.close(); fis.close(); - - for (int i = 0; i < dri.getBlocks().length; i++) { - for (int i1 = 0; i1 < dri.getBlocks()[i].length; i1++) { - if (dri.getBlocks()[i][i1] == 54 || dri.getBlocks()[i][i1] == 146) { - dri.getBlocks()[i][i1] = -1; - System.out.println("Fixed the thing at "+i+" - "+i1 +" on "+dri.getName()); + for (Map.Entry stringDungeonMechanicEntry : dri.getMechanics().entrySet()) { + if (stringDungeonMechanicEntry.getValue() instanceof DungeonSecret) { + if (stringDungeonMechanicEntry.getKey().charAt(0) != Character.toLowerCase(((DungeonSecret) stringDungeonMechanicEntry.getValue()).getSecretType().name().charAt(0))) { + System.out.println("Mismatch found at "+dri.getName() + " - "+stringDungeonMechanicEntry.getKey() +" - "+((DungeonSecret) stringDungeonMechanicEntry.getValue()).getSecretType()); + System.out.print(' '); } } } - FileOutputStream fos = new FileOutputStream(f); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(dri); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java index 8955a765..8e937b34 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java @@ -77,6 +77,34 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { } } } + + if (dir.getY() == 0 && curr.getBlock() == Blocks.iron_bars && up.getBlock() == Blocks.air && + entityIn.getEntityWorld().getBlockState(new BlockPos(currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord)).getBlock() != Blocks.iron_bars) { + boolean theFlag = false; + if (newX == 0) { + if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) + .add(0,0,1)).getBlock() == Blocks.air) { + theFlag = true; + } else if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) + .add(0,0,-1)).getBlock() == Blocks.air) { + theFlag = true; + } + } else if (newZ == 0) { + if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) + .add(-1,0,0)).getBlock() == Blocks.air) { + theFlag = true; + } else if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) + .add(1,0,0)).getBlock() == Blocks.air) { + theFlag = true; + } + } + if (theFlag) { + PathPoint pt = openPoint(newX, newY, newZ); + if (pt.visited) continue; + pathOptions[i++] = pt; + continue; + } + } } return i; } -- cgit