aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java7
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java22
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java38
7 files changed, 56 insertions, 20 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 {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
index adebf9d6..1d042a3b 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
@@ -514,6 +514,7 @@ public class DungeonListener {
e.printStackTrace();
}
+ if (!(deathEvent.entityLiving instanceof EntityBat))
DungeonActionManager.getSpawnLocation().remove(deathEvent.entity.getEntityId());
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
index 5ec6c84d..ae5cf458 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
@@ -81,7 +81,7 @@ public class NodeProcessorDungeonRoom extends NodeProcessor {
return i;
}
- private boolean isValidBlock(IBlockState state) {
+ public static boolean isValidBlock(IBlockState state) {
return state.getBlock() == Blocks.air || state.getBlock() == Blocks.water || state.getBlock() == Blocks.lava
|| state.getBlock() == Blocks.flowing_water || state.getBlock() == Blocks.flowing_lava
|| state.getBlock() == Blocks.vine || state.getBlock() == Blocks.ladder
@@ -91,6 +91,7 @@ public class NodeProcessorDungeonRoom extends NodeProcessor {
|| state.getBlock() == Blocks.fire || state.getBlock() == Blocks.torch
|| state.getBlock() == Blocks.rail || state.getBlock() == Blocks.golden_rail
|| state.getBlock() == Blocks.activator_rail || state.getBlock() == Blocks.activator_rail
+ || state.getBlock() == Blocks.carpet
|| (state == Blocks.stone.getStateFromMeta(2));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
index 953de255..ad8f866e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
@@ -182,7 +182,7 @@ public class GeneralRoomProcessor implements RoomProcessor {
@Override
public void onInteract(PlayerInteractEntityEvent event) {
- if (path != null) path.getCurrentAction().onLivingInteract(getDungeonRoom(), event);
+ if (path != null) path.onLivingInteract(event);
}
private boolean last = false;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java
index 3e287802..c02fb660 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java
@@ -221,25 +221,27 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor {
if (bugged) return;
BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition();
OffsetPoint offsetPoint = new OffsetPoint(getDungeonRoom(), new BlockPos(player.getX(), 68, player.getZ()));
- for (ChamberSet ch:chambers) {
- if (ch.getChamberGen() == null)continue;
- if (ch.getLeft() != null && ch.getLeft().getProcessor() != null) {
- if (ch.getLeft().getChamberBlocks().getOffsetPointList().contains(offsetPoint)) {
- ch.getLeft().getProcessor().drawScreen(partialTicks);
-
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- String str = "Current: "+ch.getChamberGen().getName() + " Specific: "+ch.getLeft().getProcessor().getName();
- fr.drawString(str,0,0, 0xFFFFFFFF);
+ if (FeatureRegistry.DEBUG.isEnabled()) {
+ for (ChamberSet ch : chambers) {
+ if (ch.getChamberGen() == null) continue;
+ if (ch.getLeft() != null && ch.getLeft().getProcessor() != null) {
+ if (ch.getLeft().getChamberBlocks().getOffsetPointList().contains(offsetPoint)) {
+ ch.getLeft().getProcessor().drawScreen(partialTicks);
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ String str = "Current: " + ch.getChamberGen().getName() + " Specific: " + ch.getLeft().getProcessor().getName();
+ fr.drawString(str, 0, 0, 0xFFFFFFFF);
+ }
}
- }
- if (ch.getRight() != null && ch.getRight().getProcessor() != null) {
- if (ch.getRight().getChamberBlocks().getOffsetPointList().contains(offsetPoint)) {
- ch.getRight().getProcessor().drawScreen(partialTicks);
-
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- if (ch.getChamberGen() == null || ch.getRight().getProcessor() == null) continue;
- String str = "Current: "+ch.getChamberGen().getName() + " Specific: "+ch.getRight().getProcessor().getName();
- fr.drawString(str,0,0, 0xFFFFFFFF);
+ if (ch.getRight() != null && ch.getRight().getProcessor() != null) {
+ if (ch.getRight().getChamberBlocks().getOffsetPointList().contains(offsetPoint)) {
+ ch.getRight().getProcessor().drawScreen(partialTicks);
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ if (ch.getChamberGen() == null || ch.getRight().getProcessor() == null) continue;
+ String str = "Current: " + ch.getChamberGen().getName() + " Specific: " + ch.getRight().getProcessor().getName();
+ fr.drawString(str, 0, 0, 0xFFFFFFFF);
+ }
}
}
}