aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-10 22:46:37 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-10 22:46:37 +0900
commit75aa91678c2dfdf844ecfcbb68bcf9389028ca4e (patch)
tree45757cabbc6e4c9b050f23102114ce89b10ea78d /src
parentcbd22473c62d076b25543611894da001685f5e21 (diff)
downloadSkyblock-Dungeons-Guide-75aa91678c2dfdf844ecfcbb68bcf9389028ca4e.tar.gz
Skyblock-Dungeons-Guide-75aa91678c2dfdf844ecfcbb68bcf9389028ca4e.tar.bz2
Skyblock-Dungeons-Guide-75aa91678c2dfdf844ecfcbb68bcf9389028ca4e.zip
secretz
Diffstat (limited to 'src')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java15
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/EventListener.java29
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java10
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java79
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandToggleDebug.java28
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandWhatYearIsIt.java40
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java10
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKey.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKeyPlacement.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java38
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonWeakWall.java9
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggered.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggering.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MOffsetPoint.java)20
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java14
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonOffsetPointEdit.java)126
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java102
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java9
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java131
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ActuallyClonable.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java32
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java4
32 files changed, 461 insertions, 340 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
index 55785a95..95b9ebba 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
@@ -1,18 +1,12 @@
package kr.syeyoung.dungeonsguide;
-import com.mojang.authlib.exceptions.AuthenticationException;
import kr.syeyoung.dungeonsguide.commands.*;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry;
import lombok.Getter;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiErrorScreen;
-import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException;
-import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@@ -31,7 +25,7 @@ public class DungeonsGuide implements DungeonsGuideInterface {
private static DungeonsGuide dungeonsGuide;
- public static boolean DEBUG = false;
+ public static boolean DEBUG = true;
@Getter
private Authenticator authenticator;
@@ -50,13 +44,8 @@ public class DungeonsGuide implements DungeonsGuideInterface {
skyblockStatus = new SkyblockStatus();
MinecraftForge.EVENT_BUS.register(new EventListener());
- CommandEditRoom cc = new CommandEditRoom();
- ClientCommandHandler.instance.registerCommand(cc);
- MinecraftForge.EVENT_BUS.register(cc);
ClientCommandHandler.instance.registerCommand(new CommandLoadData());
ClientCommandHandler.instance.registerCommand(new CommandSaveData());
- ClientCommandHandler.instance.registerCommand(new CommandToggleDebug());
- ClientCommandHandler.instance.registerCommand(new CommandWhatYearIsIt());
try {
DungeonRoomInfoRegistry.loadAll();
@@ -86,7 +75,7 @@ public class DungeonsGuide implements DungeonsGuideInterface {
private File configDir;
- public Object getSkyblockStatus() {
+ public SkyblockStatus getSkyblockStatus() {
return (SkyblockStatus) skyblockStatus;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
index 72bafb25..592049e7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
@@ -5,8 +5,8 @@ import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet;
-import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonOffsetPointEdit;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit;
+import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor;
import kr.syeyoung.dungeonsguide.utils.MapUtils;
@@ -203,10 +203,31 @@ public class EventListener {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent keyInputEvent) {
- if (Keybinds.opengui.isKeyDown()){
+ if (DungeonsGuide.DEBUG &&Keybinds.editingSession.isKeyDown() ){
EditingContext ec = EditingContext.getEditingContext();
- if (ec == null) DungeonsGuide.sendDebugChat(new ChatComponentText("No Editing session is open right now"));
- else ec.reopen();
+ if (ec == null) {
+ DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext();
+ if (context == null) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Not in dungeons"));
+ return;
+ }
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+
+ if (dungeonRoom == null) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Can't determine the dungeon room you're in"));
+ return;
+ }
+
+ if (EditingContext.getEditingContext() != null) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("There is an editing session currently open."));
+ return;
+ }
+
+ EditingContext.createEditingContext(dungeonRoom);
+ EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dungeonRoom));
+ } else ec.reopen();
}
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java
index 17d0ccaa..14cd6a9a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java
@@ -6,12 +6,14 @@ import org.lwjgl.input.Keyboard;
public class Keybinds
{
- public static KeyBinding opengui;
+ public static KeyBinding editingSession;
+ public static KeyBinding ringMenuForSecretEdit;
public static void register()
{
- opengui = new KeyBinding("ay", Keyboard.KEY_R, "key.categories.misc");
-
- ClientRegistry.registerKeyBinding(opengui);
+ if (DungeonsGuide.DEBUG) {
+ editingSession = new KeyBinding("start editing session", Keyboard.KEY_R, "key.categories.misc");
+ ClientRegistry.registerKeyBinding(editingSession);
+ }
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
deleted file mode 100644
index 18f37b09..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandEditRoom.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package kr.syeyoung.dungeonsguide.commands;
-
-import kr.syeyoung.dungeonsguide.DungeonsGuide;
-import kr.syeyoung.dungeonsguide.SkyblockStatus;
-import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
-import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit;
-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;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-import net.minecraftforge.fml.relauncher.Side;
-
-import java.awt.*;
-
-public class CommandEditRoom extends CommandBase {
- @Override
- public String getCommandName() {
- return "editsession";
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "editsession";
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- SkyblockStatus skyblockStatus = (SkyblockStatus) DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
- if (!skyblockStatus.isOnDungeon()) {
- sender.addChatMessage(new ChatComponentText("You're not in dungeons"));
- return;
- }
-
- if (skyblockStatus.getContext() == null) {
- sender.addChatMessage(new ChatComponentText("Dungeon Context is null"));
- return;
- }
-
-
- DungeonContext context = skyblockStatus.getContext();
- EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
- Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
- DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
-
- if (dungeonRoom == null) {
- sender.addChatMessage(new ChatComponentText("Can't determine the dungeon room you're in"));
- return;
- }
-
- if (EditingContext.getEditingContext() != null) {
- sender.addChatMessage(new ChatComponentText("There is an editing session currently open."));
- return;
- }
-
- EditingContext.createEditingContext(dungeonRoom);
- openGuiReq = true;
- }
-
- private boolean openGuiReq = false;
-
- @SubscribeEvent
- public void tick(TickEvent.ClientTickEvent tick){
- if ( openGuiReq &&tick.phase == TickEvent.Phase.END && tick.side == Side.CLIENT && tick.type == TickEvent.Type.CLIENT) {
- DungeonRoom dr = EditingContext.getEditingContext().getRoom();
- EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dr));
- openGuiReq = false;
- }
- }
-
- @Override
- public int getRequiredPermissionLevel() {
- return 0;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandToggleDebug.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandToggleDebug.java
deleted file mode 100644
index cf1ff459..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandToggleDebug.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package kr.syeyoung.dungeonsguide.commands;
-
-import kr.syeyoung.dungeonsguide.DungeonsGuide;
-import net.minecraft.command.CommandBase;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-
-public class CommandToggleDebug extends CommandBase {
- @Override
- public String getCommandName() {
- return "debugtoggle";
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "debugtoggle";
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- DungeonsGuide.DEBUG = !DungeonsGuide.DEBUG;
- sender.addChatMessage(new ChatComponentText("Toggled Debug mode to "+ DungeonsGuide.DEBUG));
- }
- @Override
- public int getRequiredPermissionLevel() {
- return 0;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandWhatYearIsIt.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandWhatYearIsIt.java
deleted file mode 100644
index d5da1c7f..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandWhatYearIsIt.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package kr.syeyoung.dungeonsguide.commands;
-
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import kr.syeyoung.dungeonsguide.utils.SkyblockUtils;
-import net.minecraft.command.CommandBase;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.util.ChatComponentText;
-
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-public class CommandWhatYearIsIt extends CommandBase {
- @Override
- public String getCommandName() {
- return "tellmeyear";
- }
-
- @Override
- public String getCommandUsage(ICommandSender sender) {
- return "tellmeyear";
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) {
- try {
-
-
-
- sender.addChatMessage(new ChatComponentText("Current year is "+ SkyblockUtils.getSkyblockYear()));
- } catch (Throwable throwable) {
- throwable.printStackTrace();
- }
- }
- @Override
- public int getRequiredPermissionLevel() {
- return 0;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java
index 06ca7877..a57e33b7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java
@@ -1,7 +1,6 @@
package kr.syeyoung.dungeonsguide.dungeon.data;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic;
-import kr.syeyoung.dungeonsguide.roomedit.valueedit.ActuallyClonable;
import lombok.Getter;
import lombok.Setter;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
deleted file mode 100644
index 01f001e0..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
-import lombok.Data;
-
-@Data
-public class DungeonDoor implements Triggered {
- private OffsetPointSet offsetPointSet = new OffsetPointSet();
- private Triggering triggering;
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKey.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKey.java
deleted file mode 100644
index 15ca98dd..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKey.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-
-public class DungeonKey implements DungeonMechanic {
- private OffsetPoint key;
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKeyPlacement.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKeyPlacement.java
deleted file mode 100644
index e2f20ba3..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonKeyPlacement.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import lombok.Data;
-
-@Data
-public class DungeonKeyPlacement implements DungeonMechanic, Triggering {
- private OffsetPoint keySlot;
- private DungeonKey dungeonKey;
-
- private Triggered triggered;
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
deleted file mode 100644
index d52982ad..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import lombok.Data;
-
-@Data
-public class DungeonLever implements DungeonMechanic {
- private OffsetPoint lever = new OffsetPoint(0,0,0);
-
- private Triggered triggered;
-}
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 4c3974fb..06992387 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -1,16 +1,54 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
+import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.util.BlockPos;
@Data
public class DungeonSecret implements DungeonMechanic {
private OffsetPoint secretPoint = new OffsetPoint(0,0,0);
private SecretType secretType = SecretType.CHEST;
+ public SecretStatus getSecretStatus(DungeonRoom dungeonRoom) {
+ if (secretType == SecretType.CHEST) {
+ BlockPos pos = secretPoint.getBlockPos(dungeonRoom);
+ IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos);
+ if (blockState.getBlock() == Blocks.air) {
+ return SecretStatus.DEFINITELY_NOT;
+ } else if (blockState.getBlock() != Blocks.chest && blockState.getBlock() != Blocks.trapped_chest) {
+ return SecretStatus.ERROR;
+ } else {
+ TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos);
+ if (chest.numPlayersUsing > 0) {
+ return SecretStatus.FOUND;
+ } else{
+ return SecretStatus.CREATED;
+ }
+ }
+ } else {
+ return SecretStatus.NOT_SURE;
+ }
+ }
+
public static enum SecretType {
BAT, CHEST, ITEM_DROP
}
+
+ public static enum SecretStatus {
+ DEFINITELY_NOT, NOT_SURE, CREATED, FOUND, ERROR
+ }
+
+ public DungeonSecret clone() throws CloneNotSupportedException {
+ DungeonSecret dungeonSecret = new DungeonSecret();
+ dungeonSecret.secretPoint = (OffsetPoint) secretPoint.clone();
+ dungeonSecret.secretType = secretType;
+ return dungeonSecret;
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonWeakWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonWeakWall.java
deleted file mode 100644
index e233c2fb..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonWeakWall.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
-import lombok.Data;
-
-@Data
-public class DungeonWeakWall implements DungeonMechanic {
- OffsetPointSet weakWalls = new OffsetPointSet();
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggered.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggered.java
deleted file mode 100644
index d32a76e4..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggered.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-public interface Triggered extends DungeonMechanic{
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggering.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggering.java
deleted file mode 100644
index 7d535d37..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/Triggering.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-public interface Triggering extends DungeonMechanic {
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java
index b9d7c488..4045503e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java
@@ -1,8 +1,10 @@
package kr.syeyoung.dungeonsguide.roomedit;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit;
import lombok.Data;
import lombok.Getter;
+import lombok.Setter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
@@ -37,10 +39,19 @@ public class EditingContext {
private Stack<GuiScreen> guiStack = new Stack<GuiScreen>();
+ public boolean isEditingSecrets() {
+ return guiDungeonRoomEdit.isEditingSelected();
+ }
+ public void endEditing() {
+ guiDungeonRoomEdit.endEditing();
+ }
+
+ private GuiDungeonRoomEdit guiDungeonRoomEdit;
@Getter
private GuiScreen current;
public void openGui(GuiScreen gui) {
+ if (gui instanceof GuiDungeonRoomEdit) guiDungeonRoomEdit = (GuiDungeonRoomEdit) gui;
guiStack.push(current);
this.current = gui;
Minecraft.getMinecraft().displayGuiScreen(gui);
@@ -52,6 +63,7 @@ public class EditingContext {
}
public void reopen() {
+ guiDungeonRoomEdit.endEditing();
Minecraft.getMinecraft().displayGuiScreen(current);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java
index 98b0a136..fea900ba 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java
@@ -1,6 +1,5 @@
package kr.syeyoung.dungeonsguide.roomedit;
-import kr.syeyoung.dungeonsguide.roomedit.valueedit.ActuallyClonable;
import lombok.AllArgsConstructor;
import lombok.Data;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java
index be6c4303..fef77a25 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MParameter.java
@@ -4,7 +4,7 @@ import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit;
-import kr.syeyoung.dungeonsguide.roomedit.panes.ProcessorParameterEditPane;
+import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
@@ -20,9 +20,9 @@ public class MParameter extends MPanel {
@Getter @Setter
private Parameter parameter;
- private ProcessorParameterEditPane processorParameterEditPane;
+ private DynamicEditor processorParameterEditPane;
- public MParameter(final Parameter parameter, ProcessorParameterEditPane processorParameterEditPane) {
+ public MParameter(final Parameter parameter, DynamicEditor processorParameterEditPane) {
this.processorParameterEditPane = processorParameterEditPane;
this.add(this.label = new MLabel() {
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MOffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java
index 3143f42a..9c733fd6 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MOffsetPoint.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MValue.java
@@ -3,29 +3,29 @@ package kr.syeyoung.dungeonsguide.roomedit.elements;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
-import kr.syeyoung.dungeonsguide.roomedit.Parameter;
-import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonOffsetPointEdit;
-import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit;
-import kr.syeyoung.dungeonsguide.roomedit.panes.ProcessorParameterEditPane;
+import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
+import scala.actors.threadpool.Arrays;
import java.awt.*;
-
-public class MOffsetPoint extends MPanel {
+import java.util.ArrayList;
+import java.util.List;
+public class MValue<T> extends MPanel {
@Getter
- private OffsetPoint data;
+ private T data;
private ValueEditOffsetPointSet valueEditOffsetPointSet;
private MLabel dataLab;
@Getter @Setter
private Color hover = Color.gray;
+ private List<MPanel> addons;
- public MOffsetPoint(ValueEditOffsetPointSet valueEditOffsetPointSet, final OffsetPoint parameter) {
- this.valueEditOffsetPointSet = valueEditOffsetPointSet;
+ public MValue(final T parameter, List<MPanel> addons) {
+ this.addons = addons;
this.add(this.dataLab = new MLabel() {
@Override
public String getText() {
@@ -47,7 +47,7 @@ public class MOffsetPoint extends MPanel {
@Override
public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
if (this.bounds.x > -20 && new Rectangle(new Point(0,0),bounds.getSize()).contains(relMouseX, relMouseY)) {
- EditingContext.getEditingContext().openGui(new GuiDungeonOffsetPointEdit(valueEditOffsetPointSet, data));
+ EditingContext.getEditingContext().openGui(new GuiDungeonValueEdit(data, addons));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java
index a0496b47..2498888f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java
@@ -10,13 +10,13 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.BlockPos;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
public class GuiDungeonAddSet extends GuiScreen {
@@ -71,12 +71,12 @@ public class GuiDungeonAddSet extends GuiScreen {
end = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition());
}
{
- MOffsetPoint mOffsetPoint = new MOffsetPoint(null,start);
- mOffsetPoint.setBounds(new Rectangle(0,0,150,20));
- mainPanel.add(mOffsetPoint);
- MOffsetPoint mOffsetPoint2 = new MOffsetPoint(null,end);
- mOffsetPoint2.setBounds(new Rectangle(0,20,150,20));
- mainPanel.add(mOffsetPoint2);
+ MValue mValue = new MValue(start, Collections.emptyList());
+ mValue.setBounds(new Rectangle(0,0,150,20));
+ mainPanel.add(mValue);
+ MValue mValue2 = new MValue(end,Collections.emptyList());
+ mValue2.setBounds(new Rectangle(0,20,150,20));
+ mainPanel.add(mValue2);
}
{
add = new MButton() {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java
index 26ebbe5b..21b05bfd 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java
@@ -1,15 +1,11 @@
package kr.syeyoung.dungeonsguide.roomedit.gui;
-import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
-import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
import kr.syeyoung.dungeonsguide.roomedit.elements.*;
-import kr.syeyoung.dungeonsguide.roomedit.panes.GeneralEditPane;
-import kr.syeyoung.dungeonsguide.roomedit.panes.ProcessorParameterEditPane;
-import kr.syeyoung.dungeonsguide.roomedit.panes.RoomDataDisplayPane;
+import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry;
@@ -23,7 +19,6 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
-import java.util.UUID;
public class GuiDungeonParameterEdit extends GuiScreen {
@@ -42,7 +37,7 @@ public class GuiDungeonParameterEdit extends GuiScreen {
@Getter
private ValueEdit valueEdit;
- public GuiDungeonParameterEdit(final MParameter parameter2, final ProcessorParameterEditPane processorParameterEditPane) {
+ public GuiDungeonParameterEdit(final MParameter parameter2, final DynamicEditor processorParameterEditPane) {
dungeonRoom = EditingContext.getEditingContext().getRoom();
mainPanel.setBackgroundColor(new Color(17, 17, 17, 179));
this.parameter = parameter2.getParameter();
@@ -61,7 +56,7 @@ public class GuiDungeonParameterEdit extends GuiScreen {
}
{
classSelection = parameter.getNewData() == null ?"null" : parameter.getNewData().getClass().getName();
- final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(ValueEditRegistry.getClassesSupported(), classSelection) {
+ final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(processorParameterEditPane.allowedClass(), classSelection) {
@Override
public void resize(int parentWidth, int parentHeight) {
setBounds(new Rectangle(0, 20, parentWidth,20));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java
index 6ca1b3c9..c332dd20 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java
@@ -9,6 +9,7 @@ import kr.syeyoung.dungeonsguide.roomedit.elements.MTextField;
import kr.syeyoung.dungeonsguide.roomedit.panes.GeneralEditPane;
import kr.syeyoung.dungeonsguide.roomedit.panes.ProcessorParameterEditPane;
import kr.syeyoung.dungeonsguide.roomedit.panes.RoomDataDisplayPane;
+import kr.syeyoung.dungeonsguide.roomedit.panes.SecretEditPane;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
@@ -25,6 +26,8 @@ public class GuiDungeonRoomEdit extends GuiScreen {
private DungeonRoom room;
+ private MTabbedPane tabbedPane;
+
public GuiDungeonRoomEdit(DungeonRoom room) {
this.room = room;
@@ -35,7 +38,16 @@ public class GuiDungeonRoomEdit extends GuiScreen {
tabbedPane.addTab("General", new GeneralEditPane(room));
tabbedPane.addTab("Match", new RoomDataDisplayPane(room));
+ tabbedPane.addTab("Secrets", new SecretEditPane(room));
tabbedPane.addTab("Proc.Params", new ProcessorParameterEditPane(room));
+ this.tabbedPane = tabbedPane;
+ }
+
+ public boolean isEditingSelected() {
+ return "Secrets".equals(tabbedPane.getSelectedKey());
+ }
+ public void endEditing() {
+ tabbedPane.setSelectedKey("General");
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonOffsetPointEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java
index ba96eb05..b7605542 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonOffsetPointEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java
@@ -1,12 +1,13 @@
package kr.syeyoung.dungeonsguide.roomedit.gui;
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
-import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.*;
+import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
-import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry;
import lombok.Getter;
import net.minecraft.client.Minecraft;
@@ -17,85 +18,57 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
+import java.util.List;
import java.io.IOException;
-public class GuiDungeonOffsetPointEdit extends GuiScreen {
- private MPanel mainPanel = new MPanel();
- @Getter
- private OffsetPoint offsetPoint;
- private MButton save;
- private MButton delete;
+public class GuiDungeonValueEdit extends GuiScreen {
- @Getter
- private ValueEdit valueEdit;
+ private MPanel mainPanel = new MPanel() {
+ @Override
+ public void onBoundsUpdate() {
+ for (int i = 0; i < addons.size(); i++) {
+ addons.get(i).setBounds(new Rectangle(0, bounds.height - (i+1) * 20 - 20, bounds.width, 20));
+ }
+ }
+ };
- public GuiDungeonOffsetPointEdit(final ValueEditOffsetPointSet valueEditOffsetPointSet, final OffsetPoint offsetPoint) {
- this.offsetPoint = offsetPoint;
- mainPanel.setBackgroundColor(new Color(17, 17, 17, 179));
- {
- MPanel thing = (MPanel) ValueEditRegistry.getValueEditMap(OffsetPoint.class.getName()).createValueEdit(new Parameter(null, null, null) {
- @Override
- public Object getPreviousData() {
- return offsetPoint;
- }
+ private DungeonRoom dungeonRoom;
- @Override
- public Object getNewData() {
- return offsetPoint;
- }
- @Override
- public String getName() {
- return "";
- }
+ private MPanel currentValueEdit;
- @Override
- public void setName(String name) {
- return;
- }
+ private MButton save;
- @Override
- public void setPreviousData(Object previousData) {
- return;
- }
+ @Getter
+ private ValueEdit valueEdit;
- @Override
- public void setNewData(Object newData) {
- return;
- }
- });
- valueEdit = (ValueEdit) thing;
- MPanel wrapper = new MPanel() {
- @Override
- public void resize(int parentWidth, int parentHeight) {
- setBounds(new Rectangle(0, 0, parentWidth,parentHeight - 20));
- }
- };
- wrapper.add(thing);
- mainPanel.add(wrapper);
- }
+ private List<MPanel> addons;
+
+ private Object editingObj;
+
+ public GuiDungeonValueEdit(final Object object, final List<MPanel> addons) {
+ dungeonRoom = EditingContext.getEditingContext().getRoom();
+ this.addons = addons;
+ this.editingObj = object;
+ mainPanel.setBackgroundColor(new Color(17, 17, 17, 179));
{
- delete = new MButton() {
+ currentValueEdit = new MPanel(){
@Override
public void resize(int parentWidth, int parentHeight) {
- setBounds(new Rectangle(0,parentHeight - 20, parentWidth / 2, 20));
+ setBounds(new Rectangle(0, 0, parentWidth,parentHeight - 20 - addons.size() * 20));
}
};
- delete.setText("Delete");
- delete.setBackgroundColor(Color.red);
- delete.setOnActionPerformed(new Runnable() {
- @Override
- public void run() {
- if (valueEditOffsetPointSet != null)
- valueEditOffsetPointSet.delete(offsetPoint);
- EditingContext.getEditingContext().goBack();
- }
- });
+ mainPanel.add(currentValueEdit);
+ }
+ for (MPanel addon : addons) {
+ mainPanel.add(addon);
+ }
+ {
save = new MButton(){
@Override
public void resize(int parentWidth, int parentHeight) {
- setBounds(new Rectangle(parentWidth / 2,parentHeight - 20, parentWidth / 2, 20));
+ setBounds(new Rectangle(parentWidth ,parentHeight - 20, parentWidth, 20));
}
};
save.setText("Go back");
@@ -106,11 +79,34 @@ public class GuiDungeonOffsetPointEdit extends GuiScreen {
EditingContext.getEditingContext().goBack();
}
});
- mainPanel.add(delete);
mainPanel.add(save);
}
+ updateClassSelection();
}
+ public void updateClassSelection() {
+ currentValueEdit.getChildComponents().clear();
+
+ ValueEditCreator valueEditCreator = ValueEditRegistry.getValueEditMap(editingObj == null ?"null":editingObj.getClass().getName());
+
+ MPanel valueEdit = (MPanel) valueEditCreator.createValueEdit(new Parameter("", editingObj, editingObj));
+ if (valueEdit == null) {
+ MLabel valueEdit2 = new MLabel() {
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ setBounds(new Rectangle(0, 0, parentWidth,20));
+ }
+ };
+ valueEdit2.setText("No Value Edit");
+ valueEdit2.setBounds(new Rectangle(0,0,150,20));
+ valueEdit = valueEdit2;
+ this.valueEdit = null;
+ } else{
+ this.valueEdit = (ValueEdit) valueEdit;
+ }
+ valueEdit.resize0(currentValueEdit.getBounds().width, currentValueEdit.getBounds().height);
+ currentValueEdit.add(valueEdit);
+ }
@Override
public void initGui() {
super.initGui();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java
new file mode 100644
index 00000000..368bf376
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java
@@ -0,0 +1,102 @@
+package kr.syeyoung.dungeonsguide.roomedit.mechanicedit;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret;
+import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MLabel;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MStringSelectionButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MValue;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import net.minecraft.util.BlockPos;
+import scala.actors.threadpool.Arrays;
+
+import java.awt.*;
+import java.util.Collections;
+
+public class ValueEditSecret extends MPanel implements ValueEdit<DungeonSecret> {
+ private Parameter parameter;
+
+ // scroll pane
+ // just create
+ // add set
+ private DungeonSecret dungeonSecret;
+
+ private MLabel label;
+ private MValue<OffsetPoint> value;
+ private MStringSelectionButton selectionButton;
+
+ public ValueEditSecret(final Parameter parameter2) {
+ this.parameter = parameter2;
+ this.dungeonSecret = (DungeonSecret) parameter2.getNewData();
+
+
+ label = new MLabel();
+ label.setText("Secret Point");
+ label.setAlignment(MLabel.Alignment.LEFT);
+ add(label);
+
+ value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList());
+ add(value);
+
+ selectionButton = new MStringSelectionButton(Arrays.asList(new String[] {"CHEST", "BAT", "ITEM_DROP"}), "CHEST");
+ selectionButton.setOnUpdate(new Runnable() {
+ @Override
+ public void run() {
+ dungeonSecret.setSecretType(DungeonSecret.SecretType.valueOf(selectionButton.getSelected()));
+ }
+ });
+ add(selectionButton);
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ label.setBounds(new Rectangle(0,0,bounds.width, 20));
+ value.setBounds(new Rectangle(0,20,bounds.width, 20));
+ selectionButton.setBounds(new Rectangle(0,40,bounds.width, 20));
+ }
+
+ @Override
+ public void setParameter(Parameter parameter) {
+ this.parameter = parameter;
+ }
+
+ @Override
+ public void renderWorld(float partialTicks) {
+ BlockPos pos = dungeonSecret.getSecretPoint().getBlockPos(EditingContext.getEditingContext().getRoom());
+ RenderUtils.highlightBlock(pos, new Color(0,255,0,50),partialTicks);
+ RenderUtils.drawTextAtWorld(dungeonSecret.getSecretType().name(), pos.getX() +0.5f, pos.getY()+0.5f, pos.getZ()+0.5f, 0xFF000000, 0.5f, false, false, partialTicks);
+ }
+
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setBounds(new Rectangle(0,0,parentWidth, parentHeight));
+ }
+
+ public static class Generator implements ValueEditCreator<ValueEditSecret> {
+
+ @Override
+ public ValueEditSecret createValueEdit(Parameter parameter) {
+ return new ValueEditSecret(parameter);
+ }
+
+ @Override
+ public Object createDefaultValue(Parameter parameter) {
+ return new DungeonSecret();
+ }
+
+ @Override
+ public Object cloneObj(Object object) {
+ try {
+ return ((DungeonSecret)object).clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ assert false;
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java
new file mode 100644
index 00000000..f1b78cb2
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java
@@ -0,0 +1,12 @@
+package kr.syeyoung.dungeonsguide.roomedit.panes;
+
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MParameter;
+
+import java.util.List;
+
+public interface DynamicEditor {
+ void delete(MParameter parameter);
+
+ List<String> allowedClass();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java
index a6606a0f..8f5d742a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java
@@ -5,9 +5,7 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
-import kr.syeyoung.dungeonsguide.roomedit.elements.MLabelAndElement;
import kr.syeyoung.dungeonsguide.roomedit.elements.MParameter;
-import kr.syeyoung.dungeonsguide.roomedit.valueedit.ActuallyClonable;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry;
@@ -17,7 +15,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-public class ProcessorParameterEditPane extends MPanel {
+public class ProcessorParameterEditPane extends MPanel implements DynamicEditor {
private DungeonRoom dungeonRoom;
private MButton save;
@@ -92,6 +90,11 @@ public class ProcessorParameterEditPane extends MPanel {
parameters.remove(parameter);
}
+ @Override
+ public List<String> allowedClass() {
+ return ValueEditRegistry.getClassesSupported();
+ }
+
@Override
public List<MPanel> getChildComponents() {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java
new file mode 100644
index 00000000..33dcdc00
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java
@@ -0,0 +1,131 @@
+package kr.syeyoung.dungeonsguide.roomedit.panes;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.roomedit.MPanel;
+import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MParameter;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator;
+import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+public class SecretEditPane extends MPanel implements DynamicEditor {
+ private DungeonRoom dungeonRoom;
+
+ private MButton save;
+ private MButton create;
+ private List<MParameter> parameters = new ArrayList<MParameter>();
+
+ private List<String> allowedClasses = new ArrayList<String>();
+
+ public SecretEditPane(DungeonRoom dungeonRoom) {
+ this.dungeonRoom = dungeonRoom;
+ buildElements();
+
+ for (String clazz : ValueEditRegistry.getClassesSupported()) {
+ if (clazz.contains("mechanics") || clazz.equals("null")) {
+ allowedClasses.add(clazz);
+ }
+ }
+ }
+
+ public void buildElements() {
+ {
+ create = new MButton();
+ create.setText("Create New Mechanic");
+ create.setBackgroundColor(Color.cyan);
+ create.setBounds(new Rectangle(0,0,100,20));
+ create.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ MParameter parameter;
+ parameters.add(parameter = new MParameter(new Parameter(UUID.randomUUID().toString(), null, null), SecretEditPane.this));
+ parameter.setBounds(new Rectangle(0,0,bounds.width, 20));
+ }
+ });
+
+ save = new MButton();
+ save.setText("Save");
+ save.setBackgroundColor(Color.green);
+ save.setBounds(new Rectangle(0,0,100,20));
+ save.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ DungeonRoomInfo dungeonRoomInfo = dungeonRoom.getDungeonRoomInfo();
+ dungeonRoomInfo.getProperties().clear();
+
+ for (MParameter parameter : parameters) {
+ Parameter real = parameter.getParameter();
+
+ ValueEditCreator vec = ValueEditRegistry.getValueEditMap(real.getNewData() == null ? "null" :real.getNewData().getClass().getName());
+
+ real.setPreviousData(vec.cloneObj(real.getNewData()));
+ dungeonRoomInfo.getMechanics().put(real.getName(), (DungeonMechanic) real.getNewData());
+ }
+ }
+ });
+ }
+ {
+ for (Map.Entry<String, DungeonMechanic> en : dungeonRoom.getDungeonRoomInfo().getMechanics().entrySet()) {
+ ValueEditCreator vec = ValueEditRegistry.getValueEditMap(en.getValue() == null ? "null" :en.getValue().getClass().getName());
+
+ MParameter mParameter = new MParameter(new Parameter(en.getKey(), vec.cloneObj(en.getValue()), vec.cloneObj(en.getValue())), this);
+ mParameter.setBounds(new Rectangle(0,0,bounds.width,20));
+ parameters.add(mParameter);
+ }
+ }
+ }
+
+ @Override
+ public void onBoundsUpdate() {
+ for (MPanel panel :getChildComponents()){
+ panel.setSize(new Dimension(bounds.width, 20));
+ }
+ }
+ @Override
+ public void resize(int parentWidth, int parentHeight) {
+ this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10));
+ }
+
+
+ public void delete(MParameter parameter) {
+ parameters.remove(parameter);
+ }
+
+ @Override
+ public List<String> allowedClass() {
+ return allowedClasses;
+ }
+
+ @Override
+ public List<MPanel> getChildComponents() {
+ ArrayList<MPanel> panels = new ArrayList<MPanel>(parameters);
+ panels.add(create);
+ panels.add(save);
+ return panels;
+ }
+
+ private int offsetY = 0;
+ @Override
+ public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
+ int heights = 0;
+ for (MPanel panel:getChildComponents()) {
+ panel.setPosition(new Point(0, -offsetY + heights));
+ heights += panel.getBounds().height;
+ }
+ }
+
+ @Override
+ public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) {
+ if (scrollAmount > 0) offsetY -= 20;
+ else if (scrollAmount < 0) offsetY += 20;
+ if (offsetY < 0) offsetY = 0;
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ActuallyClonable.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ActuallyClonable.java
deleted file mode 100644
index 4473954e..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ActuallyClonable.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package kr.syeyoung.dungeonsguide.roomedit.valueedit;
-
-public interface ActuallyClonable extends Cloneable {
- public ActuallyClonable clone();
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java
index d71ebc88..5caf8af9 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java
@@ -9,7 +9,7 @@ public class ValueEditNull implements ValueEditCreator {
}
@Override
- public ActuallyClonable createDefaultValue(Parameter parameter) {
+ public Cloneable createDefaultValue(Parameter parameter) {
return null;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java
index 6eadbff7..df6c3f1f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java
@@ -6,8 +6,7 @@ import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.MPanel;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
import kr.syeyoung.dungeonsguide.roomedit.elements.MButton;
-import kr.syeyoung.dungeonsguide.roomedit.elements.MOffsetPoint;
-import kr.syeyoung.dungeonsguide.roomedit.elements.MParameter;
+import kr.syeyoung.dungeonsguide.roomedit.elements.MValue;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Getter;
@@ -17,7 +16,6 @@ import java.awt.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.UUID;
public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetPointSet> {
private Parameter parameter;
@@ -36,7 +34,7 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP
((OffsetPointSet)parameter.getNewData()).getOffsetPointList().remove(offsetPoint);
Iterator<MPanel> iterator = MParameters.iterator();
while (iterator.hasNext()) {
- MOffsetPoint panel = (MOffsetPoint) iterator.next();
+ MValue panel = (MValue) iterator.next();
if (panel.getData() == offsetPoint) {
iterator.remove();
break;
@@ -131,10 +129,10 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP
@Override
public void run() {
OffsetPoint offsetPoint = new OffsetPoint(EditingContext.getEditingContext().getRoom(), Minecraft.getMinecraft().thePlayer.getPosition());
- MOffsetPoint mOffsetPoint;
- MParameters.add(mOffsetPoint = new MOffsetPoint(ValueEditOffsetPointSet.this, offsetPoint));
+ MValue mValue;
+ MParameters.add(mValue = new MValue(offsetPoint, buildAddonsFor(offsetPoint)));
((OffsetPointSet)parameter.getNewData()).getOffsetPointList().add(offsetPoint);
- mOffsetPoint.setSize(new Dimension(bounds.width, 20));
+ mValue.setSize(new Dimension(bounds.width, 20));
}
});
@@ -156,10 +154,26 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP
add(addSet);
}
for (OffsetPoint offsetPoint : ((OffsetPointSet)parameter.getNewData()).getOffsetPointList()) {
- MParameters.add(new MOffsetPoint(this, offsetPoint));
+ MParameters.add(new MValue(offsetPoint, buildAddonsFor(offsetPoint)));
}
}
+ public List<MPanel> buildAddonsFor(final OffsetPoint offsetPoint) {
+ ArrayList<MPanel> panels = new ArrayList<MPanel>();
+ MButton mButton = new MButton();
+ mButton.setText("Delete");
+ mButton.setForeground(Color.white);
+ mButton.setBackgroundColor(Color.red);
+ mButton.setOnActionPerformed(new Runnable() {
+ @Override
+ public void run() {
+ delete(offsetPoint);
+ }
+ });
+ panels.add(mButton);
+ return panels;
+ }
+
@Override
public void onBoundsUpdate() {
scroll.setBounds(new Rectangle(0,0,bounds.width, bounds.height-20));
@@ -187,7 +201,7 @@ public class ValueEditOffsetPointSet extends MPanel implements ValueEdit<OffsetP
public void addAll(List<OffsetPoint> blockPoses) {
((OffsetPointSet)parameter.getNewData()).getOffsetPointList().addAll(blockPoses);
for (OffsetPoint blockPose : blockPoses) {
- MParameters.add(new MOffsetPoint(this, blockPose));
+ MParameters.add(new MValue(blockPose, buildAddonsFor(blockPose)));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
index 9ceef61e..ef2a7b0d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java
@@ -2,6 +2,8 @@ package kr.syeyoung.dungeonsguide.roomedit.valueedit;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret;
+import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.ValueEditSecret;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,5 +28,8 @@ public class ValueEditRegistry {
valueEditMap.put(Integer.class.getName(), new ValueEditInteger.Generator());
valueEditMap.put(OffsetPoint.class.getName(), new ValueEditOffsetPoint.Generator());
valueEditMap.put(OffsetPointSet.class.getName(), new ValueEditOffsetPointSet.Generator());
+
+
+ valueEditMap.put(DungeonSecret.class.getName(), new ValueEditSecret.Generator());
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java
index 117327d1..fbcdb244 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java
@@ -79,8 +79,8 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor {
super.drawWorld(partialTicks);
if (next == null) return;
Vec3 pos = next.getPositionEyes(partialTicks);
- RenderUtils.drawTextAtWorld("NEXT", (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, 0xFF00ff00, 0.5f, true, false, partialTicks);
- RenderUtils.highlightBox(next, new Color(0,255,0,50), partialTicks, false);
+ RenderUtils.highlightBox(next, new Color(0,255,0,100), partialTicks, false);
+ RenderUtils.drawTextAtWorld("NEXT", (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, 0xFFFF0000, 0.5f, true, false, partialTicks);
}
public static class Generator implements RoomProcessorGenerator<RoomProcessorBlazeSolver> {