From f1bfac3e161e42c18508fec4575fd2c92074d399 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Wed, 21 Aug 2013 14:49:41 -0400 Subject: [PATCH] Minor Change Moved the getDimDungeonPack() function from SchematicLoader to DungeonHelper so that DungeonHelper.RuinsPack could be a private variable. --- .../mod_pocketDim/SchematicLoader.java | 29 ++----------------- .../mod_pocketDim/helpers/DungeonHelper.java | 27 +++++++++++++++-- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/SchematicLoader.java b/StevenDimDoors/mod_pocketDim/SchematicLoader.java index 7f4101c..3fce739 100644 --- a/StevenDimDoors/mod_pocketDim/SchematicLoader.java +++ b/StevenDimDoors/mod_pocketDim/SchematicLoader.java @@ -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()); @@ -111,30 +110,6 @@ public class SchematicLoader return false; } } - - 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) { diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 81e06e4..0f4f9f6 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -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 untaggedDungeons = new ArrayList(); private ArrayList registeredDungeons = new ArrayList(); - public DungeonPack RuinsPack; + private DungeonPack RuinsPack; private HashMap dungeonPackMapping = new HashMap(); private ArrayList dungeonPackList = new ArrayList(); @@ -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.