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.
This commit is contained in:
SenseiKiwi 2013-07-26 01:57:18 -04:00
parent 960f9af1a8
commit 1b8d2aed53
2 changed files with 15 additions and 44 deletions

View file

@ -13,7 +13,7 @@ public class CommandEndDungeonCreation extends DDCommandBase
private CommandEndDungeonCreation()
{
super("dd-export", new String[] {
"<dungeon type> <dungeon name> <'open' | 'closed'> [weight] ['override']",
"<dungeon type> <dungeon name> <'open' | 'closed'> [weight]",
"<schematic name> 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.

View file

@ -62,8 +62,6 @@ public class DungeonHelper
private Random rand = new Random();
private HashMap<Integer, LinkData> customDungeonStatus = new HashMap<Integer, LinkData>();
public ArrayList<DungeonGenerator> customDungeons = new ArrayList<DungeonGenerator>();
public ArrayList<DungeonGenerator> registeredDungeons = new ArrayList<DungeonGenerator>();
@ -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