diff options
author | syeyoung <cyong06@naver.com> | 2021-02-20 02:29:09 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-20 02:29:09 +0900 |
commit | 16bbf7aadb8352090005f4fb0e68b2121bceb12e (patch) | |
tree | c781c7d2885f62e36d8c3f18598bcf2c14da80f4 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java | |
parent | 8d78c44b5a389981b7e80eb758ed7dced69e8d88 (diff) | |
download | Skyblock-Dungeons-Guide-16bbf7aadb8352090005f4fb0e68b2121bceb12e.tar.gz Skyblock-Dungeons-Guide-16bbf7aadb8352090005f4fb0e68b2121bceb12e.tar.bz2 Skyblock-Dungeons-Guide-16bbf7aadb8352090005f4fb0e68b2121bceb12e.zip |
secret finder qols
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java index abedc705..05a2a7c1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -6,16 +6,20 @@ import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateBat; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom; import kr.syeyoung.dungeonsguide.roomedit.panes.SecretEditPane; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraft.util.Vector3d; import java.awt.*; import java.util.*; @@ -47,8 +51,11 @@ public class DungeonSecret implements DungeonMechanic { BlockPos pos = secretPoint.getBlockPos(dungeonRoom); IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); if (blockState.getBlock() == Blocks.skull) { + dungeonRoom.getRoomContext().put("e-"+pos.toString(), true); return SecretStatus.DEFINITELY_NOT; } else { + if (dungeonRoom.getRoomContext().containsKey("e-"+pos.toString())) + return SecretStatus.FOUND; return SecretStatus.NOT_SURE; } } else if (secretType == SecretType.BAT) { @@ -61,6 +68,21 @@ public class DungeonSecret implements DungeonMechanic { } return SecretStatus.NOT_SURE; } else { + Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom)); + if (dungeonRoom.getRoomContext().containsKey("i-"+pos.toString())) + return SecretStatus.FOUND; + Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); + if (player.squareDistanceTo(pos) < 16) { + Vec3 vec3 = pos.subtract(player).normalize(); + for (int i = 0; i < player.distanceTo(pos); i++) { + Vec3 vec = player.addVector(vec3.xCoord * i, vec3.yCoord * i, vec3.zCoord * i); + BlockPos bpos = new BlockPos(vec); + IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(bpos); + if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) + return SecretStatus.NOT_SURE; + } + dungeonRoom.getRoomContext().put("i-" + pos.toString(), true); + } return SecretStatus.NOT_SURE; } } |