Minor Adjustments to Rift Spread

Made a small correction to the condition on max ancestors. Also
thoroughly tested this code to ensure that it really does limit rift
spread. Currently, 2 initial rifts will cause 4 more rifts to be created
eventually.
This commit is contained in:
SenseiKiwi
2014-03-12 07:05:23 -04:00
parent 8d28dc1517
commit 3a91d9a6ec

View File

@@ -35,6 +35,7 @@ import StevenDimDoors.mod_pocketDim.util.Point4D;
public class TileEntityRift extends TileEntity public class TileEntityRift extends TileEntity
{ {
private static final int RIFT_INTERACTION_RANGE = 5;
private static final int MAX_ANCESTOR_LINKS = 2; private static final int MAX_ANCESTOR_LINKS = 2;
private static final int MAX_CHILD_LINKS = 1; private static final int MAX_CHILD_LINKS = 1;
private static final int ENDERMAN_SPAWNING_CHANCE = 1; private static final int ENDERMAN_SPAWNING_CHANCE = 1;
@@ -327,7 +328,7 @@ public class TileEntityRift extends TileEntity
NewDimData dimension = PocketManager.getDimensionData(worldObj); NewDimData dimension = PocketManager.getDimensionData(worldObj);
DimLink link = dimension.getLink(xCoord, yCoord, zCoord); DimLink link = dimension.getLink(xCoord, yCoord, zCoord);
if (link.childCount() >= MAX_CHILD_LINKS || countAncestorLinks(link) > MAX_ANCESTOR_LINKS) if (link.childCount() >= MAX_CHILD_LINKS || countAncestorLinks(link) >= MAX_ANCESTOR_LINKS)
{ {
return; return;
} }
@@ -335,7 +336,7 @@ public class TileEntityRift extends TileEntity
// The probability of rifts trying to spread increases if more rifts are nearby. // The probability of rifts trying to spread increases if more rifts are nearby.
// Players should see rifts spread faster within clusters than at the edges of clusters. // Players should see rifts spread faster within clusters than at the edges of clusters.
// Also, single rifts CANNOT spread. // Also, single rifts CANNOT spread.
int nearRifts = dimension.findRiftsInRange(worldObj, 5, xCoord, yCoord, zCoord).size(); int nearRifts = dimension.findRiftsInRange(worldObj, RIFT_INTERACTION_RANGE, xCoord, yCoord, zCoord).size();
if (nearRifts == 0 || random.nextInt(nearRifts) == 0) if (nearRifts == 0 || random.nextInt(nearRifts) == 0)
{ {
return; return;