Deleting dungeons is still buggy

This commit is contained in:
StevenRS11 2013-10-09 19:07:58 -04:00
parent b9bd42a345
commit 9420b8edf2
4 changed files with 26 additions and 4 deletions

View file

@ -86,6 +86,7 @@ public class CommandCreateDungeonRift extends DDCommandBase
if (result != null)
{
//Create a rift to our selected dungeon and notify the player
//TODO currently crashes
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);

View file

@ -29,6 +29,10 @@ public class CommandResetDungeons extends DDCommandBase
@Override
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
{
if(sender.worldObj.isRemote)
{
return DDCommandResult.SUCCESS;
}
if (command.length > 0)
{
return DDCommandResult.TOO_FEW_ARGUMENTS;
@ -39,13 +43,17 @@ public class CommandResetDungeons extends DDCommandBase
ArrayList<Integer> dimsToDelete = new ArrayList<Integer>();
for (NewDimData data : PocketManager.getDimensions())
{
dungeonCount++;
if(DimensionManager.getWorld(data.id())==null&&data.isDungeon())
{
resetCount++;
dungeonCount++;
dimsToDelete.add(data.id());
}
else if(data.isDungeon())
{
data.setParentToRoot();
dungeonCount++;
for(DimLink link : data.links())
{
if(link.linkType()==LinkTypes.REVERSE)
@ -59,13 +67,15 @@ 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
//TODO implement blackList
//Notify the user of the results
sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset.");
return DDCommandResult.SUCCESS;

View file

@ -453,7 +453,6 @@ public abstract class NewDimData
{
throw new IllegalArgumentException("orientation must be between 0 and 3, inclusive.");
}
setDestination(incoming, originX, originY, originZ);
this.origin = incoming.destination();
this.orientation = orientation;
@ -461,6 +460,16 @@ public abstract class NewDimData
this.packDepth = calculatePackDepth(parent, dungeon);
}
/**
* effectivly moves the dungeon to the 'top' of a chain as far as dungeon generation is concerend.
*/
public void setParentToRoot()
{
this.depth=1;
this.parent=this.root;
this.root.children.add(this);
}
public static int calculatePackDepth(NewDimData parent, DungeonData current)
{
DungeonData predecessor = parent.dungeon();

View file

@ -202,6 +202,8 @@ public class DungeonSchematic extends Schematic {
//In the future, we might want to make this more efficient by building whole chunks at a time
setBlockDirectly(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), blockID, blockMeta);
world.markBlockForRenderUpdate((pocketPoint.getX()), pocketPoint.getY(), pocketPoint.getZ());
index++;
}
}