aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java32
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java10
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java44
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java10
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java19
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java22
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java17
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java23
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java7
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java63
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java7
24 files changed, 284 insertions, 32 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java
new file mode 100644
index 00000000..7bdf13cc
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/EntitySpawnManager.java
@@ -0,0 +1,12 @@
+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/AbstractAction.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
new file mode 100644
index 00000000..16cd7ab0
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
@@ -0,0 +1,32 @@
+package kr.syeyoung.dungeonsguide.dungeon.actions;
+
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+
+public abstract class AbstractAction implements Action {
+ @Override
+ public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event) {
+
+ }
+
+ @Override
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+
+ }
+
+ @Override
+ public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event) {
+
+ }
+
+ @Override
+ public void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks) {
+
+ }
+
+ @Override
+ public void onTick(DungeonRoom dungeonRoom) {
+
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
index 7e3318c7..496439b8 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
@@ -1,9 +1,19 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import java.util.Set;
public interface Action {
Set<Action> getPreRequisites(DungeonRoom dungeonRoom);
+
+ void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event);
+ void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event);
+ void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks);
+ void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks);
+ void onTick(DungeonRoom dungeonRoom);
+
+ boolean isComplete(DungeonRoom dungeonRoom);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java
new file mode 100755
index 00000000..b4986736
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java
@@ -0,0 +1,44 @@
+package kr.syeyoung.dungeonsguide.dungeon.actions;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import lombok.Data;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+
+import java.awt.*;
+import java.util.HashSet;
+import java.util.Set;
+
+@Data
+public class ActionBreakWithSuperBoom extends AbstractAction {
+ private Set<Action> preRequisite = new HashSet<Action>();
+ private OffsetPoint target;
+
+ public ActionBreakWithSuperBoom(OffsetPoint target) {
+ this.target = target;
+ }
+
+ @Override
+ public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) {
+ return preRequisite;
+ }
+
+ @Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return target.getBlock(dungeonRoom) == Blocks.air;
+ }
+
+ @Override
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,255),partialTicks, true);
+ }
+
+ @Override
+ public String toString() {
+ return "Click\n- target: "+target.toString();
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
index 37acd018..08246c2a 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
@@ -9,7 +9,7 @@ import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionChangeState implements Action{
+public class ActionChangeState extends AbstractAction{
@EqualsAndHashCode.Exclude
private Set<Action> preRequisite2 = new HashSet<Action>();
@@ -34,4 +34,12 @@ public class ActionChangeState implements Action{
public String toString() {
return "ChangeState\n- target: "+mechanicName+"\n- state: "+state;
}
+
+ @Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanicName);
+ if (mechanic== null)
+ return false;
+ return mechanic.getCurrentState(dungeonRoom).equalsIgnoreCase(state);
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java
index 8c745385..d062cdd9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java
@@ -7,16 +7,19 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionClick implements Action {
+public class ActionClick extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
private OffsetPoint target;
private Predicate<ItemStack> predicate = Predicates.alwaysTrue();
+ private boolean clicked = false;
+
public ActionClick(OffsetPoint target) {
this.target = target;
}
@@ -27,6 +30,20 @@ public class ActionClick implements Action {
}
@Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return clicked;
+ }
+
+ @Override
+ public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event) {
+ if (clicked) return;
+ if (target.getBlockPos(dungeonRoom).equals(event.pos) &&
+ (predicate == null || predicate.apply(event.entityLiving.getHeldItem()))) {
+ clicked = true;
+ }
+ }
+
+ @Override
public String toString() {
return "Click\n- target: "+target.toString()+"\n- predicate: "+predicate.getClass().getSimpleName();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java
index 0aea2d97..8fd82501 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java
@@ -2,17 +2,19 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionClickSet implements Action {
+public class ActionClickSet extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
private OffsetPointSet target;
private Predicate<ItemStack> predicate = Predicates.alwaysTrue();
@@ -30,4 +32,22 @@ public class ActionClickSet implements Action {
public String toString() {
return "ClickSet\n- targets size: "+target.getOffsetPointList().size()+"\n- predicate: "+predicate.getClass().getSimpleName();
}
+
+ private boolean clicked = false;
+ @Override
+ public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event) {
+ if (clicked) return;
+ for (OffsetPoint pt2: target.getOffsetPointList()) {
+ if (pt2.getBlockPos(dungeonRoom).equals(event.pos) &&
+ (predicate == null || predicate.apply(event.entityLiving.getHeldItem()))) {
+ clicked = true;
+ }
+ }
+
+ }
+
+ @Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return clicked;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java
index 80a39564..9fa87dad 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java
@@ -6,16 +6,20 @@ import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.BlockPos;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
@Data
-public class ActionDropItem implements Action {
+public class ActionDropItem extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
private OffsetPoint target;
- private Predicate<ItemStack> predicate = Predicates.alwaysTrue();
+ private Predicate<EntityItem> predicate = Predicates.alwaysTrue();
public ActionDropItem(OffsetPoint target) {
this.target = target;
@@ -27,6 +31,15 @@ public class ActionDropItem implements Action {
}
@Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ BlockPos pos = target.getBlockPos(dungeonRoom);
+ List<EntityItem> item = dungeonRoom.getContext().getWorld().getEntitiesWithinAABB(EntityItem.class,
+ AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1, pos.getY() + 1, pos.getZ() + 1));
+ if (item.size() == 0) return false;
+ return (predicate == null || predicate.apply(item.get(0)));
+ }
+
+ @Override
public String toString() {
return "DropItem\n- target: "+target.toString()+"\n- predicate: "+predicate.getClass().getSimpleName();
}
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 ff26fe20..26046201 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java
@@ -2,17 +2,21 @@ 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.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.e;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.minecraft.entity.Entity;
+import net.minecraft.util.Vec3;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionKill implements Action {
+public class ActionKill extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
private OffsetPoint target;
private Predicate<Entity> predicate = Predicates.alwaysFalse();
@@ -28,6 +32,23 @@ public class ActionKill implements Action {
}
@Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return killed;
+ }
+
+ private boolean killed = false;
+ @Override
+ public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event) {
+ if (killed) return;
+
+ Vec3 spawnLoc = EntitySpawnManager.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;
+ killed = true;
+ }
+
+ @Override
public String toString() {
return "KillEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate == null ? "null" : predicate.getClass().getSimpleName());
}
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 a2aee8da..0eb1906a 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
@@ -3,12 +3,13 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import lombok.Data;
+import net.minecraft.client.Minecraft;
import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionMove implements Action {
+public class ActionMove extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
private OffsetPoint target;
@@ -21,6 +22,11 @@ public class ActionMove implements Action {
return preRequisite;
}
+ @Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10;
+ }
+
@Override
public String toString() {
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 91bd79e7..52a63dba 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
@@ -3,12 +3,13 @@ package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import lombok.Data;
+import net.minecraft.client.Minecraft;
import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionMoveNearestAir implements Action {
+public class ActionMoveNearestAir extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
private OffsetPoint target;
@@ -22,6 +23,11 @@ public class ActionMoveNearestAir implements Action {
}
@Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10;
+ }
+
+ @Override
public String toString() {
return "MoveNearestAir\n- target: "+target.toString();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java
index 3d625371..f1228e81 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java
@@ -7,7 +7,7 @@ import java.util.HashSet;
import java.util.Set;
@Data
-public class ActionRoot implements Action {
+public class ActionRoot extends AbstractAction {
private Set<Action> preRequisite = new HashSet<Action>();
public ActionRoot() {
@@ -19,6 +19,11 @@ public class ActionRoot implements Action {
}
@Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return true;
+ }
+
+ @Override
public String toString() {
return "Action Root";
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
index d75b232a..e97c08c0 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
@@ -1,11 +1,11 @@
package kr.syeyoung.dungeonsguide.eventlistener;
import com.google.gson.JsonObject;
-import kr.syeyoung.dungeonsguide.a;
import kr.syeyoung.dungeonsguide.config.Config;
import kr.syeyoung.dungeonsguide.Keybinds;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.e;
@@ -20,23 +20,23 @@ import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor;
import kr.syeyoung.dungeonsguide.utils.MapUtils;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiErrorScreen;
import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.texture.DynamicTexture;
-import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.Vec3;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
+import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException;
@@ -44,11 +44,12 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
-import org.apache.commons.lang3.StringUtils;
-import org.lwjgl.opengl.GL11;
+import javax.swing.text.html.parser.Entity;
import java.awt.*;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
public class DungeonListener {
@SubscribeEvent
@@ -58,6 +59,7 @@ public class DungeonListener {
} catch (IOException e) {
e.printStackTrace();
}
+ EntitySpawnManager.getSpawnLocation().clear();
}
@SubscribeEvent
@@ -92,12 +94,12 @@ public class DungeonListener {
DungeonContext context = skyblockStatus.getContext();
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
if (thePlayer == null) return;
- if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onEntitySpawn(e);
+ if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onEntityUpdate(e);
Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) {
- dungeonRoom.getRoomProcessor().onEntitySpawn(e);
+ dungeonRoom.getRoomProcessor().onEntityUpdate(e);
}
}
} catch (Throwable e2) {e2.printStackTrace();}
@@ -466,4 +468,47 @@ public class DungeonListener {
e.printStackTrace();
}
}
+
+ @Getter
+ private Map<Integer, Vec3> entityIdToPosMap = new HashMap<Integer, Vec3>();
+ @SubscribeEvent
+ public void onEntitySpawn(LivingSpawnEvent spawn) {
+ EntitySpawnManager.getSpawnLocation().put(spawn.entity.getEntityId(), new Vec3(spawn.x, spawn.y, spawn.z));
+ }
+
+
+ @SubscribeEvent
+ public void onEntityDeSpawn(LivingDeathEvent deathEvent) {
+ try {
+ SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus();
+ if (!skyblockStatus.isOnDungeon()) return;
+
+ DungeonContext context = skyblockStatus.getContext();
+
+ if (skyblockStatus.getContext() != null) {
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+
+ if (context.getBossfightProcessor() != null) {
+ context.getBossfightProcessor().onEntityDeath(deathEvent);
+ }
+ RoomProcessor roomProcessor = null;
+ try {
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+ if (dungeonRoom != null) {
+ if (dungeonRoom.getRoomProcessor() != null) {
+ dungeonRoom.getRoomProcessor().onEntityDeath(deathEvent);
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+
+ EntitySpawnManager.getSpawnLocation().remove(deathEvent.entity.getEntityId());
+ }
+
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
index 68a43b36..9b86c36f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
@@ -20,6 +20,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -119,7 +120,7 @@ public class GeneralRoomProcessor implements RoomProcessor {
}
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
}
@Override
@@ -136,6 +137,11 @@ public class GeneralRoomProcessor implements RoomProcessor {
}
+ @Override
+ public void onEntityDeath(LivingDeathEvent deathEvent) {
+
+ }
+
public static class Generator implements RoomProcessorGenerator<GeneralRoomProcessor> {
@Override
public GeneralRoomProcessor createNew(DungeonRoom dungeonRoom) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java
index c3d50e06..ff3b0ae3 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java
@@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -19,7 +20,8 @@ public interface RoomProcessor {
boolean readGlobalChat();
void onPostGuiRender(GuiScreenEvent.DrawScreenEvent.Post event);
- void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent);
+ void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent);
+ void onEntityDeath(LivingDeathEvent deathEvent);
void onKeyPress(InputEvent.KeyInputEvent keyInputEvent);
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 4333be0a..c1db6045 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java
@@ -313,8 +313,8 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor {
}
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
- super.onEntitySpawn(updateEvent);
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
+ super.onEntityUpdate(updateEvent);
if (bugged) return;
BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition();
@@ -322,12 +322,12 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor {
for (ChamberSet ch:chambers) {
if (ch.getLeft() != null && ch.getLeft().getProcessor() != null) {
if (ch.getLeft().getChamberBlocks().getOffsetPointList().contains(offsetPoint)) {
- ch.getLeft().getProcessor().onEntitySpawn(updateEvent);
+ ch.getLeft().getProcessor().onEntityUpdate(updateEvent);
}
}
if (ch.getRight() != null && ch.getRight().getProcessor() != null) {
// if (ch.getRight().getChamberBlocks().getOffsetPointList().contains(offsetPoint)) {
- ch.getRight().getProcessor().onEntitySpawn(updateEvent);
+ ch.getRight().getProcessor().onEntityUpdate(updateEvent);
// }
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java
index 8069e3bc..41dde1fe 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java
@@ -69,7 +69,7 @@ public abstract class GeneralDefuseChamberProcessor implements ChamberProcessor
}
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java
index 60a8411b..2932b5a9 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java
@@ -54,7 +54,7 @@ public class BossfightProcessorBonzo extends GeneralBossfightProcessor {
@Override
// §e﴾ §c§lBonzo§r §e71k§c❤ §e﴿
// §e﴾ §c§lBonzo§r §a250k§c❤ §e﴿
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
if (updateEvent.entityLiving.getName().startsWith("§e﴾ §c§lBonzo§r ") && updateEvent.entityLiving instanceof EntityArmorStand) {
bonzoStand = (EntityArmorStand) updateEvent.entityLiving;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java
index b518fc07..64448edc 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java
@@ -31,7 +31,7 @@ public class BossfightProcessorLivid extends GeneralBossfightProcessor {
put("Arcade", "§e");
}};
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
if (updateEvent.entityLiving.getName().endsWith("Livid") && updateEvent.entityLiving instanceof EntityOtherPlayerMP) {
if (!knownLivids.contains(updateEvent.entityLiving.getName())) {
knownLivids.add(updateEvent.entityLiving.getName());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java
index 85277e76..8988a29e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java
@@ -53,7 +53,7 @@ public class BossfightProcessorNecron extends GeneralBossfightProcessor {
@Override
// §e﴾ §c§lBonzo§r §e71k§c❤ §e﴿
// §e﴾ §c§lBonzo§r §a250k§c❤ §e﴿
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
if (updateEvent.entityLiving.getName().contains("❤") && updateEvent.entityLiving instanceof EntityArmorStand) {
System.out.println(updateEvent.entityLiving.getName());
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java
index e45c4c02..2bb269f6 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java
@@ -104,7 +104,7 @@ public class BossfightProcessorProf extends GeneralBossfightProcessor {
private EntityArmorStand reinforcedGuard;
private EntityArmorStand healthyGuard;
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
if (updateEvent.entityLiving instanceof EntityArmorStand) {
if (updateEvent.entityLiving.getName().startsWith("§e﴾ §c§lThe Professor§r "))
profStand = (EntityArmorStand) updateEvent.entityLiving;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java
index f38d6c02..60908de4 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java
@@ -104,7 +104,7 @@ public class BossfightProcessorSadan extends GeneralBossfightProcessor {
private EntityArmorStand bigfootGiant;
private EntityArmorStand boulderGiant;
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
if (updateEvent.entityLiving instanceof EntityArmorStand) {
if (updateEvent.entityLiving.getName().startsWith("§e﴾ §c§lSadan§r "))
sadanStand = (EntityArmorStand) updateEvent.entityLiving;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java
index f6be7b52..a1ee7af2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java
@@ -94,7 +94,7 @@ public class BossfightProcessorScarf extends GeneralBossfightProcessor {
private EntityArmorStand berserkStand;
private EntityArmorStand archerStand;
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
if (updateEvent.entityLiving instanceof EntityArmorStand) {
if (updateEvent.entityLiving.getName().startsWith("§e﴾ §c§lScarf§r "))
scarfStand = (EntityArmorStand) updateEvent.entityLiving;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java
index 511bc62d..652206c2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java
@@ -7,6 +7,7 @@ import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
@@ -86,7 +87,7 @@ public abstract class GeneralBossfightProcessor implements BossfightProcessor {
}
@Override
- public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) {
+ public void onEntityUpdate(LivingEvent.LivingUpdateEvent updateEvent) {
}
@@ -104,6 +105,10 @@ public abstract class GeneralBossfightProcessor implements BossfightProcessor {
public void onInteractBlock(PlayerInteractEvent event) {
}
+ @Override
+ public void onEntityDeath(LivingDeathEvent deathEvent) {
+
+ }
public void onPhaseChange() {}