Temporary workaround for dungeon resetting

This commit is contained in:
StevenRS11 2013-10-09 23:42:55 -04:00
parent b0c7c03fc6
commit 5bfd40f2b2
2 changed files with 13 additions and 6 deletions

View file

@ -86,7 +86,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
if (result != null) if (result != null)
{ {
//Create a rift to our selected dungeon and notify the player //Create a rift to our selected dungeon and notify the player
//TODO currently crashes //TODO currently crashes, need to create the dimension first
dimension = PocketManager.getDimensionData(sender.worldObj); dimension = PocketManager.getDimensionData(sender.worldObj);
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON);
PocketManager.getDimensionData(link.destination().getDimension()).initializeDungeon(x, y + 1, z, orientation,link, result); PocketManager.getDimensionData(link.destination().getDimension()).initializeDungeon(x, y + 1, z, orientation,link, result);

View file

@ -41,6 +41,8 @@ public class CommandResetDungeons extends DDCommandBase
int dungeonCount = 0; int dungeonCount = 0;
int resetCount = 0; int resetCount = 0;
ArrayList<Integer> dimsToDelete = new ArrayList<Integer>(); ArrayList<Integer> dimsToDelete = new ArrayList<Integer>();
ArrayList<Integer> dimsToFix = new ArrayList<Integer>();
for (NewDimData data : PocketManager.getDimensions()) for (NewDimData data : PocketManager.getDimensions())
{ {
@ -52,7 +54,7 @@ public class CommandResetDungeons extends DDCommandBase
} }
else if(data.isDungeon()) else if(data.isDungeon())
{ {
data.setParentToRoot(); dimsToFix.add(data.id());
dungeonCount++; dungeonCount++;
for(DimLink link : data.links()) for(DimLink link : data.links())
{ {
@ -67,14 +69,19 @@ public class CommandResetDungeons extends DDCommandBase
} }
} }
} }
NewDimData test = PocketManager.getDimensionData(sender.worldObj.provider.dimensionId);
test.parent().depth();
for(Integer dimID:dimsToDelete) for(Integer dimID:dimsToDelete)
{ {
PocketManager.deletePocket(PocketManager.getDimensionData(dimID), true); PocketManager.deletePocket(PocketManager.getDimensionData(dimID), true);
} }
test.parent().depth(); /**
//TODO- for some reason test.parent is null even though I just set like 23 lines earlier, in data.setParentToRoot * temporary workaround
*/
for(Integer dimID: dimsToFix)
{
PocketManager.getDimensionData(dimID).setParentToRoot();
}
//TODO- for some reason the parent field of loaded dimenions get reset to null if I call .setParentToRoot() before I delete the pockets.
//TODO implement blackList //TODO implement blackList
//Notify the user of the results //Notify the user of the results
sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset."); sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset.");