From 5bfd40f2b20d1244dbff4bdcf02ebe4474e8c65f Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Wed, 9 Oct 2013 23:42:55 -0400 Subject: [PATCH] Temporary workaround for dungeon resetting --- .../commands/CommandCreateDungeonRift.java | 2 +- .../commands/CommandResetDungeons.java | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java index 0eaefaa..2bb8328 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java @@ -86,7 +86,7 @@ public class CommandCreateDungeonRift extends DDCommandBase if (result != null) { //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); link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); PocketManager.getDimensionData(link.destination().getDimension()).initializeDungeon(x, y + 1, z, orientation,link, result); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java b/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java index 7a34c7c..d4353fe 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java @@ -41,6 +41,8 @@ public class CommandResetDungeons extends DDCommandBase int dungeonCount = 0; int resetCount = 0; ArrayList dimsToDelete = new ArrayList(); + ArrayList dimsToFix = new ArrayList(); + for (NewDimData data : PocketManager.getDimensions()) { @@ -52,7 +54,7 @@ public class CommandResetDungeons extends DDCommandBase } else if(data.isDungeon()) { - data.setParentToRoot(); + dimsToFix.add(data.id()); dungeonCount++; 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) { 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 //Notify the user of the results sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset.");