From 94a710964f164873a7238abb2e094d179deb331b Mon Sep 17 00:00:00 2001 From: syeyoung <42869671+cyoung06@users.noreply.github.com> Date: Sat, 21 Nov 2020 23:22:54 +0900 Subject: Dungeon Context --- .../java/kr/syeyoung/dungeonsguide/EventListener.java | 9 ++++++++- .../java/kr/syeyoung/dungeonsguide/SkyblockStatus.java | 8 ++++++++ .../syeyoung/dungeonsguide/dungeon/DungeonContext.java | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java index 68e55147..071cc6d5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java @@ -1,5 +1,7 @@ package kr.syeyoung.dungeonsguide; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -10,7 +12,12 @@ public class EventListener { if (e.phase == TickEvent.Phase.START) { timerTick ++; if (timerTick % 5 == 0) { - DungeonsGuide.getDungeonsGuide().getSkyblockStatus().updateStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + boolean isOnDungeon = skyblockStatus.isOnDungeon(); + skyblockStatus.updateStatus(); + if (!skyblockStatus.isOnDungeon()) return; + if (isOnDungeon) skyblockStatus.getContext().tick(); + else skyblockStatus.setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj)); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java index 45bac7e2..bb7c0a99 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java @@ -1,8 +1,10 @@ package kr.syeyoung.dungeonsguide; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.utils.TextUtils; import lombok.Getter; +import lombok.Setter; import net.minecraft.client.Minecraft; import net.minecraft.scoreboard.*; @@ -17,8 +19,14 @@ public class SkyblockStatus { @Getter private boolean isOnDungeon; + @Getter + @Setter + private DungeonContext context; + private final Pattern SERVER_BRAND_PATTERN = Pattern.compile("(.+) <- (?:.+)"); + + public boolean isOnHypixel() { Minecraft mc = Minecraft.getMinecraft(); if (mc == null || mc.thePlayer == null) return false; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java new file mode 100644 index 00000000..b7592eb8 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -0,0 +1,17 @@ +package kr.syeyoung.dungeonsguide.dungeon; + +import lombok.Getter; +import net.minecraft.world.World; + +public class DungeonContext { + @Getter + private World world; + + public DungeonContext(World world) { + this.world = world; + } + + public void tick() { + + } +} -- cgit