diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
8 files changed, 66 insertions, 22 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonActionManager.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonActionManager.java new file mode 100644 index 00000000..d69303ea --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonActionManager.java @@ -0,0 +1,20 @@ +package kr.syeyoung.dungeonsguide.dungeon; + +import lombok.Getter; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DungeonActionManager { + @Getter + private static final Map<Integer , Vec3> spawnLocation = new HashMap<Integer, Vec3>(); + + @Getter + private static final List<Integer> killeds = new ArrayList<Integer>(); +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java deleted file mode 100644 index 7bdf13cc..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java +++ /dev/null @@ -1,12 +0,0 @@ -package kr.syeyoung.dungeonsguide.dungeon; - -import lombok.Getter; -import net.minecraft.util.Vec3; - -import java.util.HashMap; -import java.util.Map; - -public class EntitySpawnManager { - @Getter - private static final Map<Integer , Vec3> spawnLocation = new HashMap<Integer, Vec3>(); -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java index 96b4e874..2d1912c5 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java @@ -2,7 +2,7 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager; +import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; @@ -43,7 +43,7 @@ public class ActionInteract extends AbstractAction { System.out.println("eve"); if (interacted) return; - Vec3 spawnLoc = EntitySpawnManager.getSpawnLocation().get(event.getEntity().getEntityId()); + Vec3 spawnLoc = DungeonActionManager.getSpawnLocation().get(event.getEntity().getEntityId()); if (spawnLoc == null) return; if (target.getBlockPos(dungeonRoom).distanceSq(spawnLoc.xCoord, spawnLoc.yCoord, spawnLoc.zCoord) > radius * radius) return; if (!predicate.apply(event.getEntity())) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java index 7d7c0488..b11cce84 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java @@ -2,13 +2,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager; +import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; -import lombok.EqualsAndHashCode; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; @@ -44,7 +42,7 @@ public class ActionKill extends AbstractAction { public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event) { if (killed) return; - Vec3 spawnLoc = EntitySpawnManager.getSpawnLocation().get(event.entity.getEntityId()); + Vec3 spawnLoc = DungeonActionManager.getSpawnLocation().get(event.entity.getEntityId()); if (spawnLoc == null) return; if (target.getBlockPos(dungeonRoom).distanceSq(spawnLoc.xCoord, spawnLoc.yCoord, spawnLoc.zCoord) > radius * radius) return; if (!predicate.apply(event.entity)) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java index e2d6b318..5079f4c9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -32,7 +32,7 @@ public class ActionMove extends AbstractAction { @Override public boolean isComplete(DungeonRoom dungeonRoom) { - return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10; + return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 25; } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java index 19a515a0..994c7a7d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -32,7 +32,7 @@ public class ActionMoveNearestAir extends AbstractAction { @Override public boolean isComplete(DungeonRoom dungeonRoom) { - return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10; + return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 25; } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java index 5ba3f21c..5fa994e0 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -27,7 +27,16 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { if (state.equalsIgnoreCase("navigate")) { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + + int leastY = Integer.MAX_VALUE; + OffsetPoint thatPt = null; + for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { + if (offsetPoint.getY() < leastY) { + thatPt = offsetPoint; + leastY = offsetPoint.getY(); + } + } + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(thatPt); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); for (String str : preRequisite) { @@ -50,7 +59,16 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { preRequisites = actionClick.getPreRequisite(); } { - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + + int leastY = Integer.MAX_VALUE; + OffsetPoint thatPt = null; + for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { + if (offsetPoint.getY() < leastY) { + thatPt = offsetPoint; + leastY = offsetPoint.getY(); + } + } + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(thatPt); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); } 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 182e0201..abedc705 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -1,10 +1,12 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; 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.roomedit.panes.SecretEditPane; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -13,6 +15,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; import java.awt.*; import java.util.*; @@ -40,6 +43,23 @@ public class DungeonSecret implements DungeonMechanic { return SecretStatus.CREATED; } } + } else if (secretType == SecretType.ESSENCE) { + BlockPos pos = secretPoint.getBlockPos(dungeonRoom); + IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); + if (blockState.getBlock() == Blocks.skull) { + return SecretStatus.DEFINITELY_NOT; + } else { + return SecretStatus.NOT_SURE; + } + } else if (secretType == SecretType.BAT) { + Vec3 spawn = new Vec3(secretPoint.getBlockPos(dungeonRoom)); + for (Integer killed : DungeonActionManager.getKilleds()) { + if (DungeonActionManager.getSpawnLocation().get(killed) == null) continue; + if (DungeonActionManager.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) { + return SecretStatus.FOUND; + } + } + return SecretStatus.NOT_SURE; } else { return SecretStatus.NOT_SURE; } |