diff options
17 files changed, 168 insertions, 21 deletions
diff --git a/options.txt b/options.txt index 14aabd4e..c519b65a 100755 --- a/options.txt +++ b/options.txt @@ -24,7 +24,7 @@ chatLinks:true chatLinksPrompt:true chatOpacity:1.0 snooperEnabled:true -fullscreen:false +fullscreen:true enableVsync:true useVbo:true hideServerAddress:false diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index a24d168c..b2b730e0 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -2,10 +2,14 @@ package kr.syeyoung.dungeonsguide.commands; import com.google.gson.JsonObject; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; import kr.syeyoung.dungeonsguide.utils.AhUtils; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; @@ -15,6 +19,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; +import java.awt.*; import java.io.IOException; import java.security.*; import java.security.cert.CertificateException; @@ -98,6 +103,20 @@ public class CommandDungeonsGuide extends CommandBase { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fBound to§7: §e" + obj.get("nickname").getAsString())); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fBound uuid§7: §e" + obj.get("uuid").getAsString())); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSession Expire§7: §e" + sdf.format(new Date(obj.get("exp").getAsLong() * 1000)))); + } else if (args[0].equalsIgnoreCase("pathfind")) { + try { + DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) return; + if (context.getBossfightProcessor() != null) context.getBossfightProcessor().tick(); + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor(); + grp.pathfind(args[1], args[2]); + } catch (Throwable t) { + t.printStackTrace(); + } } else { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java index b4986736..9ab52808 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java @@ -34,7 +34,7 @@ public class ActionBreakWithSuperBoom extends AbstractAction { @Override public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { - RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,255),partialTicks, true); + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,255),partialTicks, false); } @Override 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 d062cdd9..18467809 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java @@ -4,11 +4,13 @@ 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 lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -42,6 +44,11 @@ public class ActionClick extends AbstractAction { clicked = true; } } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 255,0,50),partialTicks, true); + } + @Override public String toString() { 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 8fd82501..7a3c99f4 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java @@ -5,11 +5,13 @@ 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 kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -47,6 +49,13 @@ public class ActionClickSet extends AbstractAction { } @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + for (OffsetPoint offsetPoint : target.getOffsetPointList()) { + RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), new Color(0, 255,0,50),partialTicks, true); + } + } + + @Override public boolean isComplete(DungeonRoom dungeonRoom) { return clicked; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java new file mode 100644 index 00000000..2a47f99b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java @@ -0,0 +1,23 @@ +package kr.syeyoung.dungeonsguide.dungeon.actions; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; + +import java.util.Collections; +import java.util.Set; + +public class ActionComplete extends AbstractAction { + @Override + public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + return Collections.emptySet(); + } + + @Override + public boolean isComplete(DungeonRoom dungeonRoom) { + return false; + } + + @Override + public String toString() { + return "Completed"; + } +} 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 9fa87dad..fb86c997 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java @@ -4,6 +4,7 @@ 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 lombok.EqualsAndHashCode; import net.minecraft.entity.item.EntityItem; @@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; +import java.awt.*; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -38,6 +40,10 @@ public class ActionDropItem extends AbstractAction { if (item.size() == 0) return false; return (predicate == null || predicate.apply(item.get(0))); } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 0,255,50),partialTicks, true); + } @Override public String toString() { 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 26046201..c43b2568 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java @@ -6,12 +6,14 @@ 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 kr.syeyoung.dungeonsguide.utils.RenderUtils; 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.awt.*; import java.util.HashSet; import java.util.Set; @@ -47,6 +49,10 @@ public class ActionKill extends AbstractAction { if (!predicate.apply(event.entity)) return; killed = true; } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,50),partialTicks, true); + } @Override public String toString() { 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 0eb1906a..591db2ca 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -2,9 +2,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; 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.client.Minecraft; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -27,6 +29,10 @@ public class ActionMove extends AbstractAction { return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10; } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 255,255,50),partialTicks, false); + } @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 52a63dba..fda4cd92 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -2,9 +2,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; 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.client.Minecraft; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -26,6 +28,10 @@ public class ActionMoveNearestAir extends AbstractAction { public boolean isComplete(DungeonRoom dungeonRoom) { return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10; } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 255,255,50),partialTicks, false); + } @Override public String toString() { 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 b60b8fb0..7e074009 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 @@ -1,19 +1,38 @@ package kr.syeyoung.dungeonsguide.dungeon.actions.tree; 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 lombok.Getter; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import java.util.List; public class ActionRoute { @Getter + private String mechanic; + @Getter + private String state; + + @Getter private int current; @Getter private List<Action> actions; - public ActionRoute(ActionTree tree) { + private DungeonRoom dungeonRoom; + + public ActionRoute(DungeonRoom dungeonRoom, String mechanic, String state) { + this.mechanic = mechanic; + this.state = state; + + ActionChangeState actionChangeState = new ActionChangeState(mechanic, state); + ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); actions = ActionTreeUtil.linearifyActionTree(tree); + actions.add(new ActionComplete()); current = 0; + this.dungeonRoom = dungeonRoom; } public Action next() { @@ -31,4 +50,27 @@ public class ActionRoute { public Action getCurrentAction() { return actions.get(current); } + + + + public void onPlayerInteract(PlayerInteractEvent event) { + getCurrentAction().onPlayerInteract(dungeonRoom, event); + } + public void onLivingDeath(LivingDeathEvent event) { + getCurrentAction().onLivingDeath(dungeonRoom, event); + } + public void onRenderWorld(float partialTicks) { + getCurrentAction().onRenderWorld(dungeonRoom, partialTicks); + }; + public void onRenderScreen(float partialTicks) { + getCurrentAction().onRenderScreen(dungeonRoom, partialTicks); + }; + public void onTick() { + Action current = getCurrentAction(); + + current.onTick(dungeonRoom); + + if (current.isComplete(dungeonRoom)) + next(); + } } 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 a6c1341b..19f711cb 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -1,12 +1,9 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClickSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; @@ -34,9 +31,8 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); { - ActionClickSet actionClick; - preRequisites.add(actionClick = new ActionClickSet(secretPoint)); - actionClick.setPredicate(PredicateSuperBoom.INSTANCE); + ActionBreakWithSuperBoom actionClick; + preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0))); preRequisites = actionClick.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 610ca94d..4e8d8658 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -58,6 +58,7 @@ public class DungeonSecret implements DungeonMechanic { ActionKill actionKill; preRequisites.add(actionKill = new ActionKill(secretPoint)); actionKill.setPredicate(PredicateBat.INSTANCE); + actionKill.setRadius(10); preRequisites = actionKill.getPreRequisite(); } { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java index 9b5a84fa..9fad7caf 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -1,10 +1,7 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClickSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom; @@ -34,9 +31,8 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); { - ActionClickSet actionClick; - preRequisites.add(actionClick = new ActionClickSet(secretPoint)); - actionClick.setPredicate(PredicateSuperBoom.INSTANCE); + ActionBreakWithSuperBoom actionClick; + preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0))); preRequisites = actionClick.getPreRequisite(); } { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index e97c08c0..728d0b5f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -27,8 +27,11 @@ 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.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySkull; import net.minecraft.util.ChatComponentText; import net.minecraft.util.Vec3; +import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -109,6 +112,8 @@ public class DungeonListener { public void onTick(TickEvent.ClientTickEvent ev) throws Throwable { try { if (ev.phase == TickEvent.Phase.START) { + + JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); if (!obj.get("uuid").getAsString().equals(Minecraft.getMinecraft().getSession().getProfile().getId().toString())) { if (Minecraft.getMinecraft().currentScreen instanceof GuiErrorScreen) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 9b86c36f..dc09f46d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -3,6 +3,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.e; @@ -40,21 +41,32 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void tick() { - + if (path != null) path.onTick(); } @Override public void drawScreen(float partialTicks) { + if (path != null) path.onRenderScreen(partialTicks); + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + if (path != null) { + fr.drawString("Pathfinding " + path.getMechanic() + ":" + path.getState(), 5, 5, 0xffffffff); + for (int i = 0; i < path.getActions().size(); i++) { + fr.drawString((i == path.getCurrent() ? ">" : " ") + " " + i + ". " + path.getActions().get(i), + 5, i * 8 + 13, 0xFF00FF00); + } + } } @Override public void drawWorld(float partialTicks) { - if (FeatureRegistry.DEBUG.isEnabled() && (EditingContext.getEditingContext() == null || EditingContext.getEditingContext().getCurrent() instanceof GuiDungeonRoomEdit)) { + if (FeatureRegistry.DEBUG.isEnabled() && (EditingContext.getEditingContext() != null && EditingContext.getEditingContext().getCurrent() instanceof GuiDungeonRoomEdit)) { for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getDungeonRoomInfo().getMechanics().entrySet()) { if (value.getValue() == null) continue;; value.getValue().highlight(new Color(0,255,255,50), value.getKey(), dungeonRoom, partialTicks); } } + if (path != null) path.onRenderWorld(partialTicks); } @Override @@ -115,8 +127,15 @@ public class GeneralRoomProcessor implements RoomProcessor { return false; } + private ActionRoute path; + + public void pathfind(String mechanic, String state) { + path = new ActionRoute(getDungeonRoom(), mechanic, state); + } + @Override public void onPostGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) { + } @Override @@ -134,12 +153,12 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void onInteractBlock(PlayerInteractEvent event) { - + if (path != null) path.onPlayerInteract(event); } @Override public void onEntityDeath(LivingDeathEvent deathEvent) { - + if (path != null) path.onLivingDeath(deathEvent); } public static class Generator implements RoomProcessorGenerator<GeneralRoomProcessor> { 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 41dde1fe..b64d11de 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 @@ -11,6 +11,7 @@ import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.nbt.NBTTagCompound; 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; @@ -54,6 +55,11 @@ public abstract class GeneralDefuseChamberProcessor implements ChamberProcessor } @Override + public void onEntityDeath(LivingDeathEvent deathEvent) { + + } + + @Override public void actionbarReceived(IChatComponent chat) { } |