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 | |
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')
3 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java index 7e074009..49026db9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.dungeon.actions.Action; import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; import kr.syeyoung.dungeonsguide.dungeon.actions.ActionComplete; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import lombok.Getter; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -70,7 +71,13 @@ public class ActionRoute { current.onTick(dungeonRoom); + if (dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanic).getCurrentState(dungeonRoom).equals(state)) { + this.current = actions.size() - 1; + } + if (current.isComplete(dungeonRoom)) next(); } + + public void onLivingInteract(PlayerInteractEntityEvent event) { getCurrentAction().onLivingInteract(dungeonRoom, event); } } 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; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java index 8c5376d7..eb6e3934 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java @@ -50,6 +50,9 @@ public class DungeonRoom { @Getter private NodeProcessorDungeonRoom nodeProcessorDungeonRoom; + @Getter + private final Map<String, Object> roomContext = new HashMap<String, Object>(); + @AllArgsConstructor @Getter public static enum RoomState { |