From 57fa3552e1ebbd39940343a4db12968d5f9931b9 Mon Sep 17 00:00:00 2001 From: syeyoung <42869671+cyoung06@users.noreply.github.com> Date: Sun, 22 Nov 2020 00:20:31 +0900 Subject: map analysis base --- .../kr/syeyoung/dungeonsguide/EventListener.java | 1 + .../dungeonsguide/dungeon/DungeonContext.java | 31 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java index 2700b6bf..d80a474d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java @@ -14,6 +14,7 @@ public class EventListener { if (timerTick % 5 == 0) { SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); boolean isOnDungeon = skyblockStatus.isOnDungeon(); +// System.out.println(isOnDungeon); skyblockStatus.updateStatus(); if (!skyblockStatus.isOnDungeon()) { skyblockStatus.setContext(null); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index b7592eb8..104225f3 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -1,17 +1,48 @@ package kr.syeyoung.dungeonsguide.dungeon; import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Items; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.storage.MapData; public class DungeonContext { @Getter private World world; + private byte[] lastMapData; + public DungeonContext(World world) { this.world = world; } + public void tick() { + mapTick(); + } + + private void buildMap(byte[] mapData) { + + } + private void processMap(byte[] mapData) { + + } + + private void mapTick() { + ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(8); + byte[] mapData; + if (stack == null || !(stack.getItem() instanceof ItemMap)) { + mapData = lastMapData; + } else { + MapData mapData1 = ((ItemMap)stack.getItem()).getMapData(stack, world); + mapData = mapData1.colors; + } + + if (lastMapData == null && mapData != null) buildMap(mapData); + processMap(mapData); + lastMapData = mapData; } } -- cgit