Progress on Implementing Dungeon Packs
1. Integrated support for dungeon pack config options into the code (i.e. we actually DO what the settings specify) 2. Added random transitions from one dungeon type to another. Dungeons might also begin with a non-default pack. 3. Fixed a config reading bug that caused settings to be ignored and some invalid settings wouldn't trigger exceptions. Also fixed other dungeon pack bugs.
This commit is contained in:
@@ -6,6 +6,8 @@ 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;
|
||||
import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException;
|
||||
@@ -16,8 +18,6 @@ public class SchematicLoader
|
||||
|
||||
public static boolean generateDungeonPocket(LinkData link, DDProperties properties)
|
||||
{
|
||||
//TODO: Phase this function out in the next update. ~SenseiKiwi
|
||||
|
||||
if (link == null || properties == null)
|
||||
{
|
||||
return false;
|
||||
@@ -46,7 +46,7 @@ public class SchematicLoader
|
||||
final long localSeed = world.getSeed() ^ 0x2F50DB9B4A8057E4L ^ computeDestinationHash(link);
|
||||
final Random random = new Random(localSeed);
|
||||
|
||||
dungeonHelper.generateDungeonLink(link, dungeonHelper.RuinsPack, random);
|
||||
dungeonHelper.generateDungeonLink(link, getDimDungeonPack(originDimID), random);
|
||||
}
|
||||
schematicPath = dimList.get(destDimID).dungeonGenerator.schematicPath;
|
||||
|
||||
@@ -98,8 +98,11 @@ public class SchematicLoader
|
||||
{
|
||||
dimHelper helperInstance = dimHelper.instance;
|
||||
helperInstance.moveLinkDataDestination(link, link.destXCoord, fixedY, link.destZCoord, link.destDimID, true);
|
||||
}
|
||||
dungeon.copyToWorld(world, new Point3D(link.destXCoord, link.destYCoord, link.destZCoord), link.linkOrientation, originDimID, destDimID);
|
||||
}
|
||||
DungeonPackConfig packConfig = getDimDungeonPack(destDimID).getConfig();
|
||||
|
||||
dungeon.copyToWorld(world, new Point3D(link.destXCoord, link.destYCoord, link.destZCoord),
|
||||
link.linkOrientation, originDimID, destDimID, packConfig.doDistortDoorCoordinates());
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -109,6 +112,30 @@ 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
|
||||
@@ -141,7 +168,7 @@ public class SchematicLoader
|
||||
|
||||
private static DungeonSchematic checkSourceAndLoad(String schematicPath) throws FileNotFoundException, InvalidSchematicException
|
||||
{
|
||||
//TODO: Change this code once we introduce an isInternal flag in dungeon data
|
||||
//FIXME: Change this code once we introduce an isInternal flag in dungeon data
|
||||
DungeonSchematic dungeon;
|
||||
if ((new File(schematicPath)).exists())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user