Deleting dungeons is still buggy
This commit is contained in:
parent
b9bd42a345
commit
9420b8edf2
4 changed files with 26 additions and 4 deletions
|
@ -86,6 +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
|
||||||
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);
|
||||||
|
|
|
@ -29,6 +29,10 @@ public class CommandResetDungeons extends DDCommandBase
|
||||||
@Override
|
@Override
|
||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
|
if(sender.worldObj.isRemote)
|
||||||
|
{
|
||||||
|
return DDCommandResult.SUCCESS;
|
||||||
|
}
|
||||||
if (command.length > 0)
|
if (command.length > 0)
|
||||||
{
|
{
|
||||||
return DDCommandResult.TOO_FEW_ARGUMENTS;
|
return DDCommandResult.TOO_FEW_ARGUMENTS;
|
||||||
|
@ -39,13 +43,17 @@ public class CommandResetDungeons extends DDCommandBase
|
||||||
ArrayList<Integer> dimsToDelete = new ArrayList<Integer>();
|
ArrayList<Integer> dimsToDelete = new ArrayList<Integer>();
|
||||||
for (NewDimData data : PocketManager.getDimensions())
|
for (NewDimData data : PocketManager.getDimensions())
|
||||||
{
|
{
|
||||||
dungeonCount++;
|
|
||||||
if(DimensionManager.getWorld(data.id())==null&&data.isDungeon())
|
if(DimensionManager.getWorld(data.id())==null&&data.isDungeon())
|
||||||
{
|
{
|
||||||
|
resetCount++;
|
||||||
|
dungeonCount++;
|
||||||
dimsToDelete.add(data.id());
|
dimsToDelete.add(data.id());
|
||||||
}
|
}
|
||||||
else if(data.isDungeon())
|
else if(data.isDungeon())
|
||||||
{
|
{
|
||||||
|
data.setParentToRoot();
|
||||||
|
dungeonCount++;
|
||||||
for(DimLink link : data.links())
|
for(DimLink link : data.links())
|
||||||
{
|
{
|
||||||
if(link.linkType()==LinkTypes.REVERSE)
|
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)
|
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
|
||||||
//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.");
|
||||||
return DDCommandResult.SUCCESS;
|
return DDCommandResult.SUCCESS;
|
||||||
|
|
|
@ -453,7 +453,6 @@ public abstract class NewDimData
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("orientation must be between 0 and 3, inclusive.");
|
throw new IllegalArgumentException("orientation must be between 0 and 3, inclusive.");
|
||||||
}
|
}
|
||||||
|
|
||||||
setDestination(incoming, originX, originY, originZ);
|
setDestination(incoming, originX, originY, originZ);
|
||||||
this.origin = incoming.destination();
|
this.origin = incoming.destination();
|
||||||
this.orientation = orientation;
|
this.orientation = orientation;
|
||||||
|
@ -461,6 +460,16 @@ public abstract class NewDimData
|
||||||
this.packDepth = calculatePackDepth(parent, dungeon);
|
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)
|
public static int calculatePackDepth(NewDimData parent, DungeonData current)
|
||||||
{
|
{
|
||||||
DungeonData predecessor = parent.dungeon();
|
DungeonData predecessor = parent.dungeon();
|
||||||
|
|
|
@ -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
|
//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);
|
setBlockDirectly(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), blockID, blockMeta);
|
||||||
|
world.markBlockForRenderUpdate((pocketPoint.getX()), pocketPoint.getY(), pocketPoint.getZ());
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue