From b4cc959a35881ef702a8bea398186a72c0d780e2 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Tue, 11 Jun 2013 14:42:11 -0400 Subject: [PATCH] fixed save data --- StevenDimDoors/mod_pocketDim/DimData.java | 2 +- StevenDimDoors/mod_pocketDim/DungeonData.java | 42 ----- .../mod_pocketDim/DungeonGenerator.java | 8 +- .../commands/CommandAddDungeonRift.java | 10 +- .../commands/CommandEndDungeonCreation.java | 4 +- .../mod_pocketDim/helpers/DungeonHelper.java | 156 +++++++++--------- 6 files changed, 92 insertions(+), 130 deletions(-) delete mode 100644 StevenDimDoors/mod_pocketDim/DungeonData.java diff --git a/StevenDimDoors/mod_pocketDim/DimData.java b/StevenDimDoors/mod_pocketDim/DimData.java index fcfaf8b9..8998e835 100644 --- a/StevenDimDoors/mod_pocketDim/DimData.java +++ b/StevenDimDoors/mod_pocketDim/DimData.java @@ -25,7 +25,7 @@ public class DimData implements Serializable public boolean hasBeenFilled=false; public boolean hasDoor=false; public boolean isDimRandomRift=false; - public DungeonData dungeonGenerator = null; + public DungeonGenerator dungeonGenerator = null; //public boolean isPrivatePocket = false; public HashMap>> linksInThisDim=new HashMap(); HashMap dimX; diff --git a/StevenDimDoors/mod_pocketDim/DungeonData.java b/StevenDimDoors/mod_pocketDim/DungeonData.java deleted file mode 100644 index 0d5ff151..00000000 --- a/StevenDimDoors/mod_pocketDim/DungeonData.java +++ /dev/null @@ -1,42 +0,0 @@ -package StevenDimDoors.mod_pocketDim; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; - -import net.minecraft.world.World; - - - -public class DungeonData implements Serializable -{ - - public int weight; - public String schematicPath; - public ArrayList sideRifts = new ArrayList(); - public LinkData exitLink; - public static Random rand = new Random(); - public boolean isOpen; - public int sideDoorsSoFar=0; - public int exitDoorsSoFar=0; - public int deadEndsSoFar=0; - - - - - - public DungeonData(int weight, String schematicPath, Boolean isOpen) - { - this.weight=weight; - this.schematicPath=schematicPath; - this.isOpen=isOpen; - - } - - - - - - -} \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/DungeonGenerator.java b/StevenDimDoors/mod_pocketDim/DungeonGenerator.java index 9e6e93cc..5ea98727 100644 --- a/StevenDimDoors/mod_pocketDim/DungeonGenerator.java +++ b/StevenDimDoors/mod_pocketDim/DungeonGenerator.java @@ -9,7 +9,7 @@ import net.minecraft.world.World; -public class dungeonGenerator implements Serializable +public class DungeonGenerator implements Serializable { public int weight; @@ -26,7 +26,7 @@ public class dungeonGenerator implements Serializable - public dungeonGenerator(int weight, String schematicPath, Boolean isOpen) + public DungeonGenerator(int weight, String schematicPath, Boolean isOpen) { this.weight=weight; this.schematicPath=schematicPath; @@ -35,4 +35,8 @@ public class dungeonGenerator implements Serializable } + + + + } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java index 51d65c6a..a342ee09 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandAddDungeonRift.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import cpw.mods.fml.common.FMLCommonHandler; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.DungeonData; +import StevenDimDoors.mod_pocketDim.DungeonGenerator; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -54,7 +54,7 @@ public class CommandAddDungeonRift extends CommandBase } else if(var2.length!=0&&var2[0].equals("list")) { - for(DungeonData dungeonGen : mod_pocketDim.dungeonHelper.registeredDungeons) + for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.registeredDungeons) { String dungeonName =dungeonGen.schematicPath; if(dungeonName.contains("DimDoors_Custom_schematics")) @@ -69,7 +69,7 @@ public class CommandAddDungeonRift extends CommandBase } - for(DungeonData dungeonGen : mod_pocketDim.dungeonHelper.customDungeons) + for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.customDungeons) { String dungeonName =dungeonGen.schematicPath; if(dungeonName.contains("DimDoors_Custom_schematics")) @@ -89,7 +89,7 @@ public class CommandAddDungeonRift extends CommandBase else if(var2.length!=0) { - for(DungeonData dungeonGen : mod_pocketDim.dungeonHelper.registeredDungeons) + for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.registeredDungeons) { String dungeonName =dungeonGen.schematicPath.toLowerCase(); @@ -113,7 +113,7 @@ public class CommandAddDungeonRift extends CommandBase } - for(DungeonData dungeonGen : mod_pocketDim.dungeonHelper.customDungeons) + for(DungeonGenerator dungeonGen : mod_pocketDim.dungeonHelper.customDungeons) { String dungeonName =dungeonGen.schematicPath.toLowerCase(); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java index 351540f5..f9a5122c 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java @@ -1,6 +1,6 @@ package StevenDimDoors.mod_pocketDim.commands; -import StevenDimDoors.mod_pocketDim.DungeonData; +import StevenDimDoors.mod_pocketDim.DungeonGenerator; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -53,7 +53,7 @@ public class CommandEndDungeonCreation extends CommandBase } else if(!player.worldObj.isRemote) { - DungeonData newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic"); + DungeonGenerator newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic"); player.sendChatToPlayer("created dungeon schematic in " +mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic"); mod_pocketDim.dungeonHelper.customDungeons.add(newDungeon); diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 117d4a93..9b84f9ea 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -8,7 +8,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; -import StevenDimDoors.mod_pocketDim.DungeonData; +import StevenDimDoors.mod_pocketDim.DungeonGenerator; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.jnbt.ByteArrayTag; @@ -35,32 +35,32 @@ public class DungeonHelper public HashMap customDungeonStatus = new HashMap(); - public ArrayList customDungeons = new ArrayList(); + public ArrayList customDungeons = new ArrayList(); - public ArrayList registeredDungeons = new ArrayList(); + public ArrayList registeredDungeons = new ArrayList(); - public ArrayList weightedDungeonGenList = new ArrayList(); + public ArrayList weightedDungeonGenList = new ArrayList(); - public ArrayList simpleHalls = new ArrayList(); + public ArrayList simpleHalls = new ArrayList(); - public ArrayList complexHalls = new ArrayList(); + public ArrayList complexHalls = new ArrayList(); - public ArrayList deadEnds = new ArrayList(); + public ArrayList deadEnds = new ArrayList(); - public ArrayList hubs = new ArrayList(); + public ArrayList hubs = new ArrayList(); - public ArrayList mazes = new ArrayList(); + public ArrayList mazes = new ArrayList(); - public ArrayList pistonTraps = new ArrayList(); + public ArrayList pistonTraps = new ArrayList(); - public ArrayList exits = new ArrayList(); + public ArrayList exits = new ArrayList(); @@ -68,7 +68,7 @@ public class DungeonHelper public ArrayList metadataNextList = new ArrayList(); - public DungeonData defaultUp = new DungeonData(0, "/schematic/simpleStairsUp.schematic", true); + public DungeonGenerator defaultUp = new DungeonGenerator(0, "/schematic/simpleStairsUp.schematic", true); public void registerCustomDungeon(File schematicFile) { @@ -82,7 +82,7 @@ public class DungeonHelper if(name.length<4) { System.out.println("Importing custom dungeon gen mechanics failed, adding to secondary list"); - this.customDungeons.add(new DungeonData(0,schematicFile.getAbsolutePath(),true)); + this.customDungeons.add(new DungeonGenerator(0,schematicFile.getAbsolutePath(),true)); System.out.println("Imported "+schematicFile.getName()); @@ -101,44 +101,44 @@ public class DungeonHelper { if(name[0].equals("hub")) { - this.hubs.add(new DungeonData(weight,path,open)); + this.hubs.add(new DungeonGenerator(weight,path,open)); } else if(name[0].equals("simpleHall")) { - this.simpleHalls.add(new DungeonData(weight,path,open)); + this.simpleHalls.add(new DungeonGenerator(weight,path,open)); } else if(name[0].equals("complexHall")) { - this.complexHalls.add(new DungeonData(weight,path,open)); + this.complexHalls.add(new DungeonGenerator(weight,path,open)); } else if(name[0].equals("trap")) { - this.pistonTraps.add(new DungeonData(weight,path,open)); + this.pistonTraps.add(new DungeonGenerator(weight,path,open)); } else if(name[0].equals("deadEnd")) { - this.deadEnds.add(new DungeonData(weight,path,open)); + this.deadEnds.add(new DungeonGenerator(weight,path,open)); } else if(name[0].equals("exit")) { - this.exits.add(new DungeonData(weight,path,open)); + this.exits.add(new DungeonGenerator(weight,path,open)); } else if(name[0].equals("mazes")) { - this.mazes.add(new DungeonData(weight,path,open)); + this.mazes.add(new DungeonGenerator(weight,path,open)); } count++; - this.weightedDungeonGenList.add(new DungeonData(weight,path,open)); + this.weightedDungeonGenList.add(new DungeonGenerator(weight,path,open)); } - this.registeredDungeons.add(new DungeonData(weight,path,open)); + this.registeredDungeons.add(new DungeonGenerator(weight,path,open)); System.out.println("Imported "+schematicFile.getName()); } @@ -215,73 +215,73 @@ public class DungeonHelper public void registerBaseDungeons() { - this.hubs.add(new DungeonData(0, "/schematics/4WayBasicHall.schematic", false)); - this.hubs.add(new DungeonData(0, "/schematics/4WayBasicHall.schematic", false)); - this.hubs.add(new DungeonData(0, "/schematics/doorTotemRuins.schematic", true)); - this.hubs.add(new DungeonData(0, "/schematics/hallwayTrapRooms1.schematic", false)); - this.hubs.add(new DungeonData(0, "/schematics/longDoorHallway.schematic", false)); - this.hubs.add(new DungeonData(0, "/schematics/smallRotundaWithExit.schematic", false)); - this.hubs.add(new DungeonData(0, "/schematics/fortRuins.schematic", true)); - this.hubs.add(new DungeonData(0, "/schematics/4WayHallExit.schematic", false)); - this.hubs.add(new DungeonData(0, "/schematics/4WayHallExit.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/4WayBasicHall.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/4WayBasicHall.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/doorTotemRuins.schematic", true)); + this.hubs.add(new DungeonGenerator(0, "/schematics/hallwayTrapRooms1.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/longDoorHallway.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/smallRotundaWithExit.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/fortRuins.schematic", true)); + this.hubs.add(new DungeonGenerator(0, "/schematics/4WayHallExit.schematic", false)); + this.hubs.add(new DungeonGenerator(0, "/schematics/4WayHallExit.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/collapsedSingleTunnel1.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/singleStraightHall1.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/smallBranchWithExit.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/smallSimpleLeft.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/smallSimpleRight.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/simpleStairsUp.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/simpleStairsDown.schematic", false)); - this.simpleHalls.add(new DungeonData(0, "/schematics/simpleSmallT1.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/collapsedSingleTunnel1.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/singleStraightHall1.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/smallBranchWithExit.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/smallSimpleLeft.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/smallSimpleRight.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/simpleStairsUp.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/simpleStairsDown.schematic", false)); + this.simpleHalls.add(new DungeonGenerator(0, "/schematics/simpleSmallT1.schematic", false)); - this.complexHalls.add(new DungeonData(0, "/schematics/brokenPillarsO.schematic", true)); - this.complexHalls.add(new DungeonData(0, "/schematics/buggyTopEntry1.schematic", true)); - this.complexHalls.add(new DungeonData(0, "/schematics/exitRuinsWithHiddenDoor.schematic", true)); - this.complexHalls.add(new DungeonData(0, "/schematics/hallwayHiddenTreasure.schematic", false)); - this.complexHalls.add(new DungeonData(0, "/schematics/mediumPillarStairs.schematic", true)); - this.complexHalls.add(new DungeonData(0, "/schematics/ruinsO.schematic", true)); - this.complexHalls.add(new DungeonData(0, "/schematics/pitStairs.schematic", true)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/brokenPillarsO.schematic", true)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/buggyTopEntry1.schematic", true)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/exitRuinsWithHiddenDoor.schematic", true)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/hallwayHiddenTreasure.schematic", false)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/mediumPillarStairs.schematic", true)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/ruinsO.schematic", true)); + this.complexHalls.add(new DungeonGenerator(0, "/schematics/pitStairs.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/azersDungeonO.schematic", false)); - this.deadEnds.add(new DungeonData(0, "/schematics/diamondTowerTemple1.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/fallingTrapO.schematic", false)); - this.deadEnds.add(new DungeonData(0, "/schematics/hiddenStaircaseO.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/lavaTrapO.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/randomTree.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/smallHiddenTowerO.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/smallSilverfishRoom.schematic", false)); - this.deadEnds.add(new DungeonData(0, "/schematics/tntTrapO.schematic", false)); - this.deadEnds.add(new DungeonData(0, "/schematics/smallDesert.schematic", true)); - this.deadEnds.add(new DungeonData(0, "/schematics/smallPond.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/azersDungeonO.schematic", false)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/diamondTowerTemple1.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/fallingTrapO.schematic", false)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/hiddenStaircaseO.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/lavaTrapO.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/randomTree.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallHiddenTowerO.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallSilverfishRoom.schematic", false)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/tntTrapO.schematic", false)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallDesert.schematic", true)); + this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallPond.schematic", true)); - this.pistonTraps.add(new DungeonData(0, "/schematics/fakeTNTTrap.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/hallwayPitFallTrap.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/hallwayPitFallTrap.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/pistonFallRuins.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/pistonFloorHall.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/pistonFloorHall.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/fakeTNTTrap.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/hallwayPitFallTrap.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/hallwayPitFallTrap.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonFallRuins.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonFloorHall.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonFloorHall.schematic", false)); // this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonHallway.schematic", null)); - this.pistonTraps.add(new DungeonData(0, "/schematics/pistonSmasherHall.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonSmasherHall.schematic", false)); // this.pistonTraps.add(new DungeonGenerator(0, "/schematics/raceTheTNTHall.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/simpleDropHall.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/wallFallcomboPistonHall.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/wallFallcomboPistonHall.schematic", false)); - this.pistonTraps.add(new DungeonData(0, "/schematics/lavaPyramid.schematic", true)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/simpleDropHall.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/wallFallcomboPistonHall.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/wallFallcomboPistonHall.schematic", false)); + this.pistonTraps.add(new DungeonGenerator(0, "/schematics/lavaPyramid.schematic", true)); - this.mazes.add(new DungeonData(0, "/schematics/smallMaze1.schematic", false)); - this.mazes.add(new DungeonData(0, "/schematics/smallMultilevelMaze.schematic", false)); + this.mazes.add(new DungeonGenerator(0, "/schematics/smallMaze1.schematic", false)); + this.mazes.add(new DungeonGenerator(0, "/schematics/smallMultilevelMaze.schematic", false)); - this.exits.add(new DungeonData(0, "/schematics/exitCube.schematic", true)); - this.exits.add(new DungeonData(0, "/schematics/lockingExitHall.schematic", false)); - this.exits.add(new DungeonData(0, "/schematics/smallExitPrison.schematic", true)); - this.exits.add(new DungeonData(0, "/schematics/lockingExitHall.schematic", false)); + this.exits.add(new DungeonGenerator(0, "/schematics/exitCube.schematic", true)); + this.exits.add(new DungeonGenerator(0, "/schematics/lockingExitHall.schematic", false)); + this.exits.add(new DungeonGenerator(0, "/schematics/smallExitPrison.schematic", true)); + this.exits.add(new DungeonGenerator(0, "/schematics/lockingExitHall.schematic", false)); @@ -295,7 +295,7 @@ public class DungeonHelper this.weightedDungeonGenList.addAll(this.complexHalls); this.weightedDungeonGenList.addAll(this.hubs); - for(DungeonData data : this.weightedDungeonGenList) + for(DungeonGenerator data : this.weightedDungeonGenList) { if(!this.registeredDungeons.contains(data)) { @@ -306,7 +306,7 @@ public class DungeonHelper } - public DungeonData exportDungeon(World world, int xI, int yI, int zI, String file) + public DungeonGenerator exportDungeon(World world, int xI, int yI, int zI, String file) { int xMin; @@ -430,7 +430,7 @@ public class DungeonHelper } this.registerCustomDungeon(new File(file)); - return new DungeonData(0,file,true); + return new DungeonGenerator(0,file,true); } @@ -438,7 +438,7 @@ public class DungeonHelper public void generateDungeonlink(LinkData incoming) { //DungeonGenerator dungeon = mod_pocketDim.registeredDungeons.get(new Random().nextInt(mod_pocketDim.registeredDungeons.size())); - DungeonData dungeon; + DungeonGenerator dungeon; int depth = dimHelper.instance.getDimDepth(incoming.locDimID)+2; int depthWeight = rand.nextInt(depth)+rand.nextInt(depth)-2;