Various Changes, Support for doMobSpawning, Overhauled CommonTickHandler #53
@@ -13,7 +13,7 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
private CommandEndDungeonCreation()
|
private CommandEndDungeonCreation()
|
||||||
{
|
{
|
||||||
super("dd-export", new String[] {
|
super("dd-export", new String[] {
|
||||||
"<dungeon type> <dungeon name> <'open' | 'closed'> [weight] ['override']",
|
"<dungeon type> <dungeon name> <'open' | 'closed'> [weight]",
|
||||||
"<schematic name> override" } );
|
"<schematic name> override" } );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,11 +29,8 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* There are two versions of this command. One version takes 3 to 5 arguments consisting
|
* There are two versions of this command. One version takes 3 to 4 arguments consisting
|
||||||
* of the information needed for a proper schematic name and an optional override argument.
|
* of the information needed for a proper schematic name.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* If the user wishes to name his schematic in a different format, then he will have to use
|
* 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
|
* 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;
|
return DDCommandResult.TOO_FEW_ARGUMENTS;
|
||||||
}
|
}
|
||||||
if (command.length > 5)
|
if (command.length > 4)
|
||||||
{
|
{
|
||||||
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
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
|
//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?
|
//TODO: Why do we check remoteness here but not before? And why not for the other export case?
|
||||||
//Something feels wrong... ~SenseiKiwi
|
//Something feels wrong... ~SenseiKiwi
|
||||||
|
|
||||||
if (!sender.worldObj.isRemote)
|
if (!sender.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
//TODO: This validation should be in DungeonHelper or in another class. We should move it
|
//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]))
|
if (!dungeonHelper.validateDungeonType(command[0]))
|
||||||
{
|
{
|
||||||
@@ -106,13 +94,14 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
return new DDCommandResult("Error: Please specify whether the dungeon is 'open' or 'closed'.");
|
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)
|
if (command.length == 3)
|
||||||
{
|
{
|
||||||
return exportDungeon(sender, join(command, "_", 0, 3));
|
return exportDungeon(sender, join(command, "_", 0, 3));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Validate the 4th argument, which might be the weight or might be "override".
|
{
|
||||||
|
//Validate the weight argument
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int weight = Integer.parseInt(command[3]);
|
int weight = Integer.parseInt(command[3]);
|
||||||
@@ -121,14 +110,7 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
return exportDungeon(sender, join(command, "_", 0, 4));
|
return exportDungeon(sender, join(command, "_", 0, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we've reached this point, then we must have an invalid weight.
|
//If we've reached this point, then we must have an invalid weight.
|
||||||
|
|||||||
@@ -62,8 +62,6 @@ public class DungeonHelper
|
|||||||
|
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
|
|
||||||
private HashMap<Integer, LinkData> customDungeonStatus = new HashMap<Integer, LinkData>();
|
|
||||||
|
|
||||||
public ArrayList<DungeonGenerator> customDungeons = new ArrayList<DungeonGenerator>();
|
public ArrayList<DungeonGenerator> customDungeons = new ArrayList<DungeonGenerator>();
|
||||||
public ArrayList<DungeonGenerator> registeredDungeons = 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
|
//Place a Warp Door linked to that pocket
|
||||||
itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.ExitDoor);
|
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;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomDungeon(int dimensionID)
|
|
||||||
{
|
|
||||||
return customDungeonStatus.containsKey(dimensionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean validateDungeonType(String type)
|
public boolean validateDungeonType(String type)
|
||||||
{
|
{
|
||||||
//Check if the dungeon type is valid
|
//Check if the dungeon type is valid
|
||||||
|
|||||||
Reference in New Issue
Block a user