From 1b8d2aed53fcffdace35fa55b4cdad91e9c2a14b Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Fri, 26 Jul 2013 01:57:18 -0400 Subject: [PATCH] Removed dd-create Requirement for Exporting Removed the code in DungeonHelper and CommandEndDungeonCreation that would force the player to use "override" with when exporting dungeons that DD did not recognized as having been built in custom dungeon pockets. This restriction is no longer necessary now that we don't need pockets with standardized orientations or Eternal Fabric boundaries. --- .../commands/CommandEndDungeonCreation.java | 48 ++++++------------- .../mod_pocketDim/helpers/DungeonHelper.java | 11 ----- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java index 9e1127c3..98ef5e5a 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java @@ -13,7 +13,7 @@ public class CommandEndDungeonCreation extends DDCommandBase private CommandEndDungeonCreation() { super("dd-export", new String[] { - " <'open' | 'closed'> [weight] ['override']", + " <'open' | 'closed'> [weight]", " override" } ); } @@ -29,11 +29,8 @@ public class CommandEndDungeonCreation extends DDCommandBase protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { /* - * There are two versions of this command. One version takes 3 to 5 arguments consisting - * of the information needed for a proper schematic name and an optional override argument. - * The override argument only allows the user to export any dimension, even if it wasn't - * meant for custom dungeon creation. It does not allow the user to export a dungeon with - * invalid tags. + * There are two versions of this command. One version takes 3 to 4 arguments consisting + * of the information needed for a proper schematic name. * * If the user wishes to name his schematic in a different format, then he will have to use * the 2-argument version of this command, which accepts a schematic name and a mandatory @@ -46,7 +43,7 @@ public class CommandEndDungeonCreation extends DDCommandBase { return DDCommandResult.TOO_FEW_ARGUMENTS; } - if (command.length > 5) + if (command.length > 4) { return DDCommandResult.TOO_MANY_ARGUMENTS; } @@ -77,21 +74,12 @@ public class CommandEndDungeonCreation extends DDCommandBase } //The user must have used the 3-argument version of this command - //Check if the current dimension is a pocket for building custom dungeons or if the override argument was used. - if (!dungeonHelper.isCustomDungeon(sender.worldObj.provider.dimensionId) && - !command[command.length - 1].equalsIgnoreCase("override")) - { - //This dimension may not be exported without overriding! - return new DDCommandResult("Error: The current dimension was not made for dungeon creation. Use the 'override' argument to export anyway."); - } - //TODO: Why do we check remoteness here but not before? And why not for the other export case? //Something feels wrong... ~SenseiKiwi - if (!sender.worldObj.isRemote) { //TODO: This validation should be in DungeonHelper or in another class. We should move it - //once the during the save file format rewrite. ~SenseiKiwi + //during the save file format rewrite. ~SenseiKiwi if (!dungeonHelper.validateDungeonType(command[0])) { @@ -106,29 +94,23 @@ public class CommandEndDungeonCreation extends DDCommandBase return new DDCommandResult("Error: Please specify whether the dungeon is 'open' or 'closed'."); } - //If there are no more argument, export the dungeon. + //If there are no more arguments, export the dungeon. if (command.length == 3) { return exportDungeon(sender, join(command, "_", 0, 3)); } - - //Validate the 4th argument, which might be the weight or might be "override". - try + else { - int weight = Integer.parseInt(command[3]); - if (weight >= 0 && weight <= DungeonHelper.MAX_DUNGEON_WEIGHT) + //Validate the weight argument + try { - return exportDungeon(sender, join(command, "_", 0, 4)); - } - } - catch (Exception e) - { - //The 4th argument could be "override", but only if it's the last argument. - //In that case, we assume the default dungeon weight. - if (command.length == 4 && command[3].equalsIgnoreCase("override")) - { - return exportDungeon(sender, join(command, "_", 0, 3)); + int weight = Integer.parseInt(command[3]); + if (weight >= 0 && weight <= DungeonHelper.MAX_DUNGEON_WEIGHT) + { + return exportDungeon(sender, join(command, "_", 0, 4)); + } } + catch (Exception e) { } } //If we've reached this point, then we must have an invalid weight. diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 6ba33783..268fbd2d 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -61,8 +61,6 @@ public class DungeonHelper }; private Random rand = new Random(); - - private HashMap customDungeonStatus = new HashMap(); public ArrayList customDungeons = new ArrayList(); public ArrayList registeredDungeons = new ArrayList(); @@ -157,18 +155,9 @@ public class DungeonHelper //Place a Warp Door linked to that pocket itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.ExitDoor); - //Register the pocket as a custom dungeon - customDungeonStatus.put(link.destDimID, - dimHelper.instance.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID)); - return link; } - public boolean isCustomDungeon(int dimensionID) - { - return customDungeonStatus.containsKey(dimensionID); - } - public boolean validateDungeonType(String type) { //Check if the dungeon type is valid