Minor Change

Moved the getDimDungeonPack() function from SchematicLoader to
DungeonHelper so that DungeonHelper.RuinsPack could be a private
variable.
This commit is contained in:
SenseiKiwi 2013-08-21 14:49:41 -04:00
parent 0e67596ca0
commit f1bfac3e16
2 changed files with 27 additions and 29 deletions

View file

@ -6,7 +6,6 @@ import java.util.Random;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@ -46,7 +45,7 @@ public class SchematicLoader
final long localSeed = world.getSeed() ^ 0x2F50DB9B4A8057E4L ^ computeDestinationHash(link);
final Random random = new Random(localSeed);
dungeonHelper.generateDungeonLink(link, getDimDungeonPack(originDimID), random);
dungeonHelper.generateDungeonLink(link, dungeonHelper.getDimDungeonPack(originDimID), random);
}
schematicPath = dimList.get(destDimID).dungeonGenerator.schematicPath;
@ -99,7 +98,7 @@ public class SchematicLoader
dimHelper helperInstance = dimHelper.instance;
helperInstance.moveLinkDataDestination(link, link.destXCoord, fixedY, link.destZCoord, link.destDimID, true);
}
DungeonPackConfig packConfig = getDimDungeonPack(destDimID).getConfig();
DungeonPackConfig packConfig = dungeonHelper.getDimDungeonPack(destDimID).getConfig();
dungeon.copyToWorld(world, new Point3D(link.destXCoord, link.destYCoord, link.destZCoord),
link.linkOrientation, originDimID, destDimID, packConfig.doDistortDoorCoordinates());
@ -112,30 +111,6 @@ public class SchematicLoader
}
}
private static DungeonPack getDimDungeonPack(int dimensionID)
{
//FIXME: This function is a workaround to our current dungeon data limitations. Modify later.
//The upcoming save format change and code overhaul will make this obsolete.
DungeonPack pack;
DungeonGenerator generator = dimHelper.dimList.get(dimensionID).dungeonGenerator;
if (generator != null)
{
pack = generator.getDungeonType().Owner;
//Make sure the pack isn't null. This can happen for dungeons with the special UNKNOWN type.
if (pack == null)
{
pack = DungeonHelper.instance().RuinsPack;
}
}
else
{
pack = DungeonHelper.instance().RuinsPack;
}
return pack;
}
private static int adjustDestinationY(World world, int y, DungeonSchematic dungeon)
{
//The goal here is to guarantee that the dungeon fits within the vertical bounds

View file

@ -50,7 +50,6 @@ public class DungeonHelper
public static final String SCHEMATIC_FILE_EXTENSION = ".schematic";
private static final int MIN_PACK_SWITCH_CHANCE = 0;
private static final int PACK_SWITCH_CHANCE_PER_LEVEL = 1;
private static final int MAX_PACK_SWITCH_CHANCE = 500;
@ -67,7 +66,7 @@ public class DungeonHelper
private ArrayList<DungeonGenerator> untaggedDungeons = new ArrayList<DungeonGenerator>();
private ArrayList<DungeonGenerator> registeredDungeons = new ArrayList<DungeonGenerator>();
public DungeonPack RuinsPack;
private DungeonPack RuinsPack;
private HashMap<String, DungeonPack> dungeonPackMapping = new HashMap<String, DungeonPack>();
private ArrayList<DungeonPack> dungeonPackList = new ArrayList<DungeonPack>();
@ -183,6 +182,30 @@ public class DungeonHelper
return defaultDown;
}
public DungeonPack getDimDungeonPack(int dimensionID)
{
//FIXME: This function is a workaround to our current dungeon data limitations. Modify later.
//The upcoming save format change and code overhaul will make this obsolete.
DungeonPack pack;
DungeonGenerator generator = dimHelper.dimList.get(dimensionID).dungeonGenerator;
if (generator != null)
{
pack = generator.getDungeonType().Owner;
//Make sure the pack isn't null. This can happen for dungeons with the special UNKNOWN type.
if (pack == null)
{
pack = RuinsPack;
}
}
else
{
pack = RuinsPack;
}
return pack;
}
public LinkData createCustomDungeonDoor(World world, int x, int y, int z)
{
//Create a link above the specified position. Link to a new pocket dimension.