From 3bbe67ecd993bac9e32e7f303ce84b2fa5c7cda4 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 13 Feb 2021 21:38:22 +0900 Subject: I commit --- .../syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java | 4 ++-- .../dungeon/roomfinder/DungeonRoomInfoRegistry.java | 10 +++++++++- .../syeyoung/dungeonsguide/eventlistener/FeatureListener.java | 3 ++- .../features/impl/dungeon/FeatureInstaCloseChest.java | 10 +++++----- .../dungeonsguide/features/impl/etc/FeatureTooltipPrice.java | 6 +++--- .../features/impl/secret/FeatureMechanicBrowse.java | 9 ++++++--- .../dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java | 5 ++++- .../dungeonsguide/roomprocessor/GeneralRoomProcessor.java | 2 +- .../roomprocessor/bossfight/BossfightProcessorLivid.java | 2 +- src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java | 2 +- 10 files changed, 34 insertions(+), 19 deletions(-) (limited to 'src/main/java/kr/syeyoung') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index 17ae010d..29c53b59 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -125,8 +125,8 @@ public class CommandDungeonsGuide extends CommandBase { } 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"); + File outpuzzle = new File(root, "processoroutpuzzle"); + File outsecret = new File(root, "processoroutsecret"); for (File f : dir.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; try { 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 128090db..1bd708d3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -24,7 +24,12 @@ 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; + if (uuidMap.containsKey(dungeonRoomInfo.getUuid())) { + DungeonRoomInfo dri1 = uuidMap.get(dungeonRoomInfo.getUuid()); + registered.remove(dri1); + shapeMap.get(dri1.getShape()).remove(dri1); + uuidMap.remove(dri1.getUuid()); + } dungeonRoomInfo.setRegistered(true); registered.add(dungeonRoomInfo); uuidMap.put(dungeonRoomInfo.getUuid(), dungeonRoomInfo); @@ -58,6 +63,7 @@ public class DungeonRoomInfoRegistry { boolean isDev = Minecraft.getMinecraft().getSession().getPlayerID().replace("-","").equals("e686fe0aab804a71ac7011dc8c2b534c"); System.out.println(isDev); String nameidstring = "name,uuid,processsor,secrets"; + String ids = ""; for (DungeonRoomInfo dungeonRoomInfo : registered) { try { if (!dungeonRoomInfo.isUserMade() && !isDev) continue; @@ -68,11 +74,13 @@ public class DungeonRoomInfoRegistry { oos.close(); nameidstring += "\n"+dungeonRoomInfo.getName()+","+dungeonRoomInfo.getUuid() +","+dungeonRoomInfo.getProcessorId()+","+dungeonRoomInfo.getTotalSecrets(); + ids += "roomdata/"+dungeonRoomInfo.getUuid() +".roomdata\n"; } catch (Exception e) {e.printStackTrace();} } try { Files.write(nameidstring, new File(dir, "roomidmapping.csv"), Charset.defaultCharset()); + Files.write(ids, new File(dir, "datas.txt"), Charset.defaultCharset()); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java index f9e0ba5a..639643e9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java @@ -10,6 +10,7 @@ import kr.syeyoung.dungeonsguide.features.listener.*; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.*; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -161,7 +162,7 @@ public class FeatureListener { } } - @SubscribeEvent + @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGH) public void onGuiEvent(GuiScreenEvent.MouseInputEvent.Pre input) { try { SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java index 175da78a..d6a6d7c4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java @@ -46,7 +46,7 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList check = true; } - public static int getPrice(ItemStack itemStack) { + public static long getPrice(ItemStack itemStack) { if (itemStack == null) return 0; NBTTagCompound compound = itemStack.getTagCompound(); if (compound == null) @@ -61,14 +61,14 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList public int compare(String o1, String o2) { String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - int price1 = (auctionData == null) ? 0 : auctionData.lowestBin; + long price1 = (auctionData == null) ? 0 : auctionData.lowestBin; String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); - int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; + long price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); } - public int compare2(int y, int x) { + public int compare2(long y, long x) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } }); @@ -88,7 +88,7 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList if (auctionData.sellPrice == -1 && auctionData.lowestBin != -1) return auctionData.lowestBin; else if (auctionData.sellPrice != -1 && auctionData.lowestBin == -1) return auctionData.sellPrice; else { - int ahPrice = auctionData.lowestBin; + long ahPrice = auctionData.lowestBin; if (ahPrice > auctionData.sellPrice) return ahPrice; else return auctionData.sellPrice; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java index eebb934b..91a7bc6d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java @@ -45,14 +45,14 @@ public class FeatureTooltipPrice extends SimpleFeature implements TooltipListene public int compare(String o1, String o2) { String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - int price1 = (auctionData == null) ? 0 : auctionData.lowestBin; + long price1 = (auctionData == null) ? 0 : auctionData.lowestBin; String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); - int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; + long price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); } - public int compare2(int y, int x) { + public int compare2(long y, long x) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } }); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java index 4629e0c9..5b9bfa98 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java @@ -12,6 +12,7 @@ import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; +import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener; import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; @@ -36,7 +37,7 @@ import java.util.ArrayList; import java.util.Map; import java.util.Set; -public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderListener, GuiClickListener, WorldRenderListener { +public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderListener, GuiClickListener, WorldRenderListener { public FeatureMechanicBrowse() { super("Secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); @@ -86,7 +87,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi } @Override - public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { + public void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered) { if (Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig || Minecraft.getMinecraft().currentScreen instanceof GuiConfig || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit @@ -108,7 +109,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi int height = scaledResolution.getScaledHeight(); int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - + GlStateManager.pushMatrix(); GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor(); @@ -171,6 +172,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi } } GL11.glDisable(GL11.GL_SCISSOR_TEST); + + GlStateManager.popMatrix(); } private void clip(ScaledResolution resolution, int x, int y, int width, int height) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java index 8fc660ce..9e138ed9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java @@ -55,7 +55,10 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { IBlockState state = entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ)); if (state.getBlock() == Blocks.air || state.getBlock() == Blocks.water || state.getBlock() == Blocks.lava || state.getBlock() == Blocks.flowing_water || state.getBlock() == Blocks.flowing_lava - || state.getBlock() == Blocks.vine) { + || state.getBlock() == Blocks.vine || state.getBlock() == Blocks.ladder + || state.getBlock() == Blocks.standing_sign || state.getBlock() == Blocks.wall_sign + || state.getBlock() == Blocks.trapdoor || state.getBlock() == Blocks.iron_trapdoor + || (state == Blocks.stone.getStateFromMeta(2))) { PathPoint pt = openPoint(newX, newY, newZ); if (pt.visited) continue; pathOptions[i++] = pt; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index b795472f..f7b26a1e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -197,7 +197,7 @@ public class GeneralRoomProcessor implements RoomProcessor { EntitySpawnManager.getSpawnLocation().get(deathEvent.entity.getEntityId()) )); ((GuiDungeonRoomEdit) screen).getSep().createNewMechanic("BAT-"+UUID.randomUUID().toString(), - new DungeonSecret()); + secret); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java index 64448edc..f9c41cbf 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java @@ -58,7 +58,7 @@ public class BossfightProcessorLivid extends GeneralBossfightProcessor { health = TextUtils.reverseFormat(healthPart.substring(0, healthPart.length() - 1)); } catch (Exception e) {e.printStackTrace();} } - healths.add(new HealthData(realLividName, (int) health,7000000 , true)); + healths.add(new HealthData(realLividName == null ? "unknown" : realLividName, (int) health,7000000 , true)); return healths; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java index a1f1cbcb..b09d9ebc 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java @@ -74,7 +74,7 @@ public class AhUtils { public static class AuctionData { public String id; - public int lowestBin = -1; + public long lowestBin = -1; public int sellPrice = -1; -- cgit