diff options
author | syeyoung <cyong06@naver.com> | 2021-01-22 12:59:23 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-22 12:59:23 +0900 |
commit | 1ce6ac3c20768422b05f9e861ed0a41bd2f0c8d2 (patch) | |
tree | 39b3b4abb8fda7515e55978d73d196fc880ff24e /src | |
parent | 35202074c907920f7d3cb41575db7db1e1e664f3 (diff) | |
download | Skyblock-Dungeons-Guide-1ce6ac3c20768422b05f9e861ed0a41bd2f0c8d2.tar.gz Skyblock-Dungeons-Guide-1ce6ac3c20768422b05f9e861ed0a41bd2f0c8d2.tar.bz2 Skyblock-Dungeons-Guide-1ce6ac3c20768422b05f9e861ed0a41bd2f0c8d2.zip |
ahm
Diffstat (limited to 'src')
7 files changed, 116 insertions, 4 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java index 489925b2..c4de63e7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java @@ -42,7 +42,7 @@ public class SkyblockStatus { @Getter private String dungeonName; - private final Pattern SERVER_BRAND_PATTERN = Pattern.compile("(.+) <- (?:.+)"); + private final Pattern SERVER_BRAND_PATTERN = Pattern.compile("Hypixel BungeeCord \\(\\d\\.\\d\\.\\d\\)"); public boolean isOnHypixel() { @@ -50,9 +50,7 @@ public class SkyblockStatus { if (mc == null || mc.thePlayer == null) return false; if (!mc.isSingleplayer() && mc.thePlayer.getClientBrand() != null) { Matcher matcher = SERVER_BRAND_PATTERN.matcher(mc.thePlayer.getClientBrand()); - if (matcher.find()) - return matcher.group(1).equals("BungeeCord (Hypixel)"); - return false; + if (matcher.matches()) return true; } return false; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java index 6532fdf7..c5ffe777 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -4,6 +4,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Sets; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.GeneralBossfightProcessor; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.init.Blocks; @@ -167,6 +168,14 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { .signatureMsg("§r§c[BOSS] The Professor§r§f: What?! My Guardian power is unbeatable!§r").build() ); return bossfightProcessor; + } else if (floor.equals("F4")) { + GeneralBossfightProcessor bossfightProcessor = new GeneralBossfightProcessor(); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight").build() + ); + return bossfightProcessor; + } else if (floor.equals("F5")) { + return new BossfightProcessorLivid(); } return null; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 6f4f2e10..7995d09d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -24,12 +24,15 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.entity.EntityLiving; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; @@ -42,6 +45,49 @@ import java.awt.*; public class DungeonListener { @SubscribeEvent + public void onPostDraw(GuiScreenEvent.DrawScreenEvent.Post e) { + try { + SkyblockStatus skyblockStatus = (SkyblockStatus) kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus(); + + if (!skyblockStatus.isOnDungeon()) return; + + if (skyblockStatus.getContext() != null) { + DungeonContext context = skyblockStatus.getContext(); + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) return; + if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onPostGuiRender(e); + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onPostGuiRender(e); + } + } + } catch (Throwable e2) {e2.printStackTrace();} + } + @SubscribeEvent + public void onEntityUpdate(LivingEvent.LivingUpdateEvent e) { + try { + SkyblockStatus skyblockStatus = (SkyblockStatus) kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus(); + + if (!skyblockStatus.isOnDungeon()) return; + + if (skyblockStatus.getContext() != null) { + DungeonContext context = skyblockStatus.getContext(); + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) return; + if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onEntitySpawn(e); + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onEntitySpawn(e); + } + } + } catch (Throwable e2) {e2.printStackTrace();} + } + + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent e) { try { if (e.phase == TickEvent.Phase.START) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index c435b331..2700b1d9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -15,6 +15,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.event.entity.living.LivingEvent; import java.awt.*; import java.util.Map; @@ -105,6 +107,16 @@ public class GeneralRoomProcessor implements RoomProcessor { return false; } + @Override + public void onPostGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) { + + } + + @Override + public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) { + + } + public static class Generator implements RoomProcessorGenerator<GeneralRoomProcessor> { @Override public GeneralRoomProcessor createNew(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java index e922cfd1..aae86a48 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java @@ -2,6 +2,8 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.event.entity.living.LivingEvent; public interface RoomProcessor { void tick(); @@ -11,4 +13,7 @@ public interface RoomProcessor { void actionbarReceived(IChatComponent chat); boolean readGlobalChat(); + + void onPostGuiRender(GuiScreenEvent.DrawScreenEvent.Post event); + void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent); }
\ No newline at end of file diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java new file mode 100644 index 00000000..3cb85642 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java @@ -0,0 +1,30 @@ +package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; + +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraftforge.event.entity.living.LivingEvent; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Set; + +public class BossfightProcessorLivid extends GeneralBossfightProcessor { + private String realLividName; + + private Set<String> knownLivids = new HashSet<String>(); + + public BossfightProcessorLivid() { + addPhase(PhaseData.builder().phase("start").build()); + } + + @Override + public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) { + if (updateEvent.entityLiving.getName().endsWith("Livid") && updateEvent.entityLiving instanceof EntityOtherPlayerMP) { + if (!knownLivids.contains(updateEvent.entityLiving.getName())) { + knownLivids.add(updateEvent.entityLiving.getName()); + realLividName = updateEvent.entityLiving.getName(); + System.out.println("Think real livid is "+realLividName); + } + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java index 45c38697..5b71d406 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java @@ -4,6 +4,8 @@ import lombok.Builder; import lombok.Data; import lombok.Singular; import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.event.entity.living.LivingEvent; import java.util.*; @@ -67,6 +69,16 @@ public class GeneralBossfightProcessor implements BossfightProcessor { @Override public boolean readGlobalChat() {return true;} + @Override + public void onPostGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) { + + } + + @Override + public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) { + + } + public void onPhaseChange() {} @Data |