diff options
5 files changed, 27 insertions, 13 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java index b81d96a2..4d99a8bc 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/RootConfigPanel.java @@ -19,6 +19,10 @@ package kr.syeyoung.dungeonsguide.config.guiconfig.nyu; import com.google.common.base.Function; +import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.FeatureEditPane; +import kr.syeyoung.dungeonsguide.config.guiconfig.old.GuiConfig; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.gui.MPanel; @@ -32,6 +36,7 @@ import net.minecraft.client.gui.Gui; import java.awt.*; import java.util.HashMap; +import java.util.List; import java.util.Map; public class RootConfigPanel extends MPanelScaledGUI { @@ -95,7 +100,12 @@ public class RootConfigPanel extends MPanelScaledGUI { NestedCategory finalCurrentRoot = currentRoot; currentRoot = currentRoot.children().computeIfAbsent(s, k -> new NestedCategory(finalCurrentRoot.categoryFull+"."+k)); } + + } + for (Map.Entry<String, List<AbstractFeature>> stringListEntry : FeatureRegistry.getFeaturesByCategory().entrySet()) { + ConfigPanelCreator.map.put("ROOT."+stringListEntry.getKey(),(Supplier<MPanel>) () -> new FeatureEditPane(stringListEntry.getValue(), null)); } + for (NestedCategory value : root.children().values()) { setupNavigationRecursive(value, navigation, 0, 17); } 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 479762cb..fd659596 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -119,6 +119,7 @@ public class DungeonRoomInfoRegistry { fis.close(); register(dri); } catch (Exception e) { + System.out.println(name); e.printStackTrace(); } } @@ -132,7 +133,8 @@ public class DungeonRoomInfoRegistry { ois.close(); fis.close(); register(dri); - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) { + System.out.println(f.getName());e.printStackTrace();} } } 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 9c20bdf9..9052ba3e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java @@ -60,6 +60,9 @@ public class RoomMatcher { } triedMatch = true; + int lowestcost = 10; + int lowestRot = 0; + DungeonRoomInfo bestMatch = null; for (int rotation = 0; rotation < 4; rotation++) { short shape = dungeonRoom.getShape(); for (int j = 0; j<rotation; j++) @@ -67,26 +70,23 @@ public class RoomMatcher { shape = ShortUtils.topLeftifyInt(shape); List<DungeonRoomInfo> roomInfoList = DungeonRoomInfoRegistry.getByShape(shape); - int lowestcost = Integer.MAX_VALUE; - DungeonRoomInfo bestMatch = null; for (DungeonRoomInfo roomInfo : roomInfoList) { int cost = tryMatching(roomInfo, rotation); -// if () { -// match = roomInfo; -// this.rotation = rotation; -// return match; -// } + if (cost == 0) { + match = roomInfo; + this.rotation = rotation; + return match; + } if (cost < lowestcost) { lowestcost = cost; bestMatch = roomInfo; - if (cost == 0) break; + lowestRot = rotation; } } - match = bestMatch; - this.rotation = rotation; - return bestMatch; } - return null; + match = bestMatch; + this.rotation = lowestRot; + return bestMatch; } private int tryMatching(DungeonRoomInfo dungeonRoomInfo, int rotation) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java index 0f842b34..84cccdf5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java @@ -101,6 +101,7 @@ public class MPanel { } public void remove(MPanel panel) { + if (panel != null) panel.setParent(null); this.childComponents.remove(panel); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java index f26fd956..ba56679b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java @@ -67,6 +67,7 @@ public class MTabbedPane extends MPanel { panel2.add(panel); panel2.setBackgroundColor(background2); tabs.put(tab, panel2); + panel2.setParent(this); panel2.setBounds(new Rectangle(1,16,getBounds().width-2, getBounds().height-17)); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; |