Various Updates #144

Merged
SenseiKiwi merged 28 commits from master into master 2014-03-24 18:45:47 +00:00
2 changed files with 20 additions and 5 deletions
Showing only changes of commit d6b07db3d6 - Show all commits

View File

@@ -46,6 +46,7 @@ public class DDTeleporter
private static final int MAX_ROOT_SHIFT_CHANCE = 100;
private static final int START_ROOT_SHIFT_CHANCE = 0;
private static final int ROOT_SHIFT_CHANCE_PER_LEVEL = 5;
private static final String SPIRIT_WORLD_NAME = "Spirit World";
public static int cooldown = 0;
@@ -644,9 +645,7 @@ public class DDTeleporter
for (int attempts = 0; attempts < 10; attempts++)
{
NewDimData selection = roots.get( random.nextInt(roots.size()) );
if (selection.id() != END_DIMENSION_ID &&
selection.id() != properties.LimboDimensionID &&
selection != current.root())
if (selection != current.root() && isValidForDungeonExit(selection, properties))
{
return generateSafeExit(selection, link, properties);
}
@@ -657,6 +656,19 @@ public class DDTeleporter
return generateSafeExit(current.root(), link, properties);
}
private static boolean isValidForDungeonExit(NewDimData destination, DDProperties properties)
{
// Prevent exits to The End and Limbo
if (destination.id() == END_DIMENSION_ID || destination.id() == properties.LimboDimensionID)
{
return false;
}
// Prevent exits to Witchery's Spirit World; we need to load the dimension to retrieve its name.
// This is okay because the dimension would have to be loaded subsequently by generateSafeExit().
World world = PocketManager.loadDimension(destination.id());
return (world != null && !SPIRIT_WORLD_NAME.equals(world.provider.getDimensionName()));
}
private static boolean generateSafeExit(NewDimData destinationDim, DimLink link, DDProperties properties)
{
// A safe exit attempts to place a Warp Door in a dimension with

View File

@@ -32,6 +32,7 @@ public class GatewayGenerator implements IWorldGenerator
private static final int OVERWORLD_DIMENSION_ID = 0;
private static final int NETHER_DIMENSION_ID = -1;
private static final int END_DIMENSION_ID = 1;
private static final String SPIRIT_WORLD_NAME = "Spirit World";
private ArrayList<BaseGateway> gateways;
private BaseGateway defaultGateway;
@@ -58,12 +59,14 @@ public class GatewayGenerator implements IWorldGenerator
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
// Don't generate rifts or gateways if the current world is a pocket dimension or the world is remote.
// Also don't generate anything in the Nether or The End.
// Also don't generate anything in the Nether, The End, or in Witchery's Spirit World.
// We only match against Spirit World using hashing to speed up the process a little (hopefully).
int dimensionID = world.provider.dimensionId;
if (world.isRemote
|| (world.provider instanceof PocketProvider)
|| (dimensionID == END_DIMENSION_ID)
|| (dimensionID == NETHER_DIMENSION_ID))
|| (dimensionID == NETHER_DIMENSION_ID)
|| (world.provider.getDimensionName().hashCode() == SPIRIT_WORLD_NAME.hashCode()))
{
return;
}