Readded commands

Also implemented dungeon regeneration
This commit is contained in:
StevenRS11
2013-10-01 22:50:43 -04:00
parent d046bd88ea
commit eef5117c04
14 changed files with 181 additions and 336 deletions

View File

@@ -470,13 +470,26 @@ public class DDTeleporter
private static boolean initializeDestination(DimLink link, DDProperties properties, Block door)
{
// FIXME: Change this later to support rooms that have been wiped and must be regenerated.
// FIXME: Add code for restoring the destination-side door.
// We might need to implement regeneration for REVERSE links as well.
if (link.hasDestination())
{
//Need to check if the destination is a dungeon, not only the link because non-dungeon links could still link to a dungeon at this point.
if(PocketManager.getDimensionData(link.destination().getDimension()).isDungeon)
{
NewDimData dimData = PocketManager.getDimensionData(link.destination().getDimension());
if(!dimData.isFilled())
{
if(!PocketBuilder.regenerateDungeonPocket(dimData, link, properties))
{
//If we fail to regenerate, send the player to the parent dimension.
return generateSafeExit(link, properties);
}
}
}
return true;
}
// Check the destination type and respond accordingly

View File

@@ -242,14 +242,14 @@ public abstract class NewDimData
}
public DimLink createLink(int x, int y, int z, int linkType)
{
return createLink(new Point4D(x, y, z, id), linkType,-1);
return createLink(new Point4D(x, y, z, id), linkType,0);
}
public DimLink createLink(int x, int y, int z, int linkType,int orientation)
{
return createLink(new Point4D(x, y, z, id), linkType,orientation);
}
private DimLink createLink(Point4D source, int linkType,int orientation)
public DimLink createLink(Point4D source, int linkType,int orientation)
{
//Return an existing link if there is one to avoid creating multiple links starting at the same point.
InnerDimLink link = linkMapping.get(source);

View File

@@ -186,7 +186,7 @@ public class PocketManager
isLoading = false;
}
public boolean resetDungeon(NewDimData target)
public static boolean resetDungeon(NewDimData target)
{
// We can't reset the dimension if it's currently loaded or if it's not a dungeon.
// We cast to InnerDimData so that if anyone tries to be a smartass and create their
@@ -452,6 +452,11 @@ public class PocketManager
return getLink(x, y, z, world.provider.dimensionId);
}
public static DimLink getLink(Point4D point)
{
return getLink(point.getX(), point.getY(), point.getZ(), point.getDimension());
}
public static DimLink getLink(int x, int y, int z, int dimensionID)
{
NewDimData dimension = dimensionData.get(dimensionID);