Merging SenseiKiwi's merger

This commit is contained in:
StevenRS11 2014-01-19 00:59:24 -05:00
parent 80d828c252
commit ea2be9b803
5 changed files with 30 additions and 33 deletions

View file

@ -87,7 +87,6 @@ public class DungeonSchematic extends Schematic {
public static DungeonSchematic readFromFile(File schematicFile) throws FileNotFoundException, InvalidSchematicException
{
// TODO: fix resource leak
return readFromStream(new FileInputStream(schematicFile));
}
@ -168,6 +167,7 @@ public class DungeonSchematic extends Schematic {
mapping.put((short) properties.PermaFabricBlockID, STANDARD_ETERNAL_FABRIC_ID);
mapping.put((short) properties.WarpDoorID, STANDARD_WARP_DOOR_ID);
mapping.put((short) properties.DimensionalDoorID, STANDARD_DIMENSIONAL_DOOR_ID);
mapping.put((short) properties.TransientDoorID, STANDARD_TRANSIENT_DOOR_ID);
return mapping;
}

View file

@ -378,7 +378,6 @@ public class Schematic {
{
for (dx = 0; dx < width; dx++)
{
setBlockDirectly(world, x + dx, y + dy, z + dz, blocks[index], metadata[index]);
index++;
}

View file

@ -36,6 +36,8 @@ public class TileEntityRift extends TileEntity
private static final int MAX_ANCESTOR_LINKS = 3;
private static final int ENDERMAN_SPAWNING_CHANCE = 1;
private static final int MAX_ENDERMAN_SPAWNING_CHANCE = 32;
private static final int RIFT_SPREAD_CHANCE = 1;
private static final int MAX_RIFT_SPREAD_CHANCE = 256;
private static Random random = new Random();
@ -299,20 +301,13 @@ public class TileEntityRift extends TileEntity
public void grow(DDProperties properties)
{
if (worldObj.isRemote || hasGrownRifts || !properties.RiftSpreadEnabled || random.nextInt(5) == 0)
if (worldObj.isRemote || hasGrownRifts || !properties.RiftSpreadEnabled
|| random.nextInt(MAX_RIFT_SPREAD_CHANCE) < RIFT_SPREAD_CHANCE)
{
return;
}
NewDimData dimension = PocketManager.getDimensionData(worldObj);
if(random.nextInt(dimension.findRiftsInRange(this.worldObj, 5, xCoord, yCoord, zCoord).size()+1)<2)
{
if(random.nextInt(7)!=0)
{
return;
}
}
DimLink link = dimension.getLink(xCoord, yCoord, zCoord);
if (countAncestorLinks(link) > MAX_ANCESTOR_LINKS)
@ -320,8 +315,11 @@ public class TileEntityRift extends TileEntity
return;
}
//FIXME: This condition would prevent people from creating rooms of densely packed rifts... ~SenseiKiwi
if (updateNearestRift())
// 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
// Also, single rifts CANNOT spread.
int nearRifts = dimension.findRiftsInRange(this.worldObj, 5, xCoord, yCoord, zCoord).size();
if (nearRifts == 0 || random.nextInt(nearRifts) == 0)
{
return;
}
@ -343,7 +341,7 @@ public class TileEntityRift extends TileEntity
{
dimension.createChildLink(x, y, z, link);
hasGrownRifts = true;
return;
break;
}
else
{

View file

@ -54,9 +54,8 @@ public abstract class BaseGateway
public BaseGateway(DDProperties properties)
{
//not using DD properties because sometimes its IDS can be wrong, but require it so we dont init too early
filter = new GatewayBlockFilter((short) mod_pocketDim.dimensionalDoor.blockID,
(short) mod_pocketDim.transientDoor.blockID,(short)mod_pocketDim.warpDoor.blockID);
filter = new GatewayBlockFilter((short) properties.DimensionalDoorID, (short) properties.TransientDoorID,
(short) properties.WarpDoorID);
}
/**
@ -70,7 +69,7 @@ public abstract class BaseGateway
{
int orientation = 0;
if(this.hasSchematic())
if (this.hasSchematic())
{
Schematic schematic = this.getSchematicToBuild(world, x, y, z);
@ -78,10 +77,15 @@ public abstract class BaseGateway
Point3D doorLocation = filter.getEntranceDoorLocation();
orientation = filter.getEntranceOrientation();
schematic.copyToWorld(world, x-doorLocation.getX(), y+1-doorLocation.getY(), z-doorLocation.getZ());
// I suspect that the location used below is wrong. Gateways should be placed vertically based on
// the Y position of the surface where they belong. I'm pretty sure including doorLocation.getY()
// messes up the calculation. ~SenseiKiwi
//schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ());
schematic.copyToWorld(world, x - doorLocation.getX(), y + 1 - doorLocation.getY(), z - doorLocation.getZ());
}
this.generateRandomBits(world, x,y,z);
this.generateRandomBits(world, x, y, z);
DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation);
PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, this.getStartingDungeon(world.rand));
@ -152,12 +156,11 @@ public abstract class BaseGateway
public boolean isBiomeValid(BiomeGenBase biome)
{
return !this.isBiomeSpecific||this.biomeNames.contains(biome.biomeName.toLowerCase());
return !this.isBiomeSpecific || this.biomeNames.contains(biome.biomeName.toLowerCase());
}
public boolean hasSchematic()
{
return this.schematicPaths!=null&&this.schematicPaths.size()>0;
return this.schematicPaths != null && !this.schematicPaths.isEmpty();
}
}

View file

@ -15,17 +15,15 @@ public class GatewayBlockFilter extends SchematicFilter {
private Schematic schematic;
private Point3D entranceDoorLocation;
public GatewayBlockFilter(short dimensionalDoorID,short transientDoorID,short warpDoorID)
public GatewayBlockFilter(short dimensionalDoorID, short transientDoorID, short warpDoorID)
{
super("GatewayEnteranceFinder");
this.dimensionalDoorID = dimensionalDoorID;
super("GatewayEntranceFinder");
this.entranceDoorLocation = null;
this.entranceOrientation = 0;
this.schematic = null;
this.transientDoorID=transientDoorID;
this.warpDoorID=warpDoorID;
this.dimensionalDoorID = dimensionalDoorID;
this.transientDoorID = transientDoorID;
this.warpDoorID = warpDoorID;
}
public int getEntranceOrientation() {
@ -79,7 +77,6 @@ public class GatewayBlockFilter extends SchematicFilter {
}
}
return false;
}
@Override