Major Improvements to DungeonHelper, Minor Bug Fixes and Tweaks #25
@@ -4,14 +4,10 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
|
||||
@@ -19,29 +15,13 @@ import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.ByteArrayTag;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.CompoundTag;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.IntTag;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.ListTag;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.NBTOutputStream;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.ShortTag;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.StringTag;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.jnbt.Tag;
|
||||
|
||||
/**
|
||||
|
||||
* @Return
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public class DungeonHelper
|
||||
{
|
||||
|
||||
public DungeonHelper()
|
||||
{
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
}
|
||||
|
||||
private static DDProperties properties = null;
|
||||
|
||||
private Random rand = new Random();
|
||||
@@ -49,39 +29,20 @@ public class DungeonHelper
|
||||
public HashMap<Integer, LinkData> customDungeonStatus = new HashMap<Integer, LinkData>();
|
||||
|
||||
public ArrayList<DungeonGenerator> customDungeons = new ArrayList<DungeonGenerator>();
|
||||
|
||||
public ArrayList<DungeonGenerator> registeredDungeons = new ArrayList<DungeonGenerator>();
|
||||
|
||||
public ArrayList<DungeonGenerator> weightedDungeonGenList = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> simpleHalls = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> complexHalls = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> deadEnds = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> hubs = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> mazes = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> pistonTraps = new ArrayList<DungeonGenerator>();
|
||||
|
||||
|
||||
public ArrayList<DungeonGenerator> exits = new ArrayList<DungeonGenerator>();
|
||||
|
||||
public ArrayList<String> tagList = new ArrayList<String>();
|
||||
|
||||
|
||||
|
||||
public ArrayList metadataFlipList = new ArrayList();
|
||||
|
||||
public ArrayList metadataNextList = new ArrayList();
|
||||
public ArrayList<Integer> metadataFlipList = new ArrayList<Integer>();
|
||||
public ArrayList<Integer> metadataNextList = new ArrayList<Integer>();
|
||||
|
||||
public DungeonGenerator defaultUp = new DungeonGenerator(0, "/schematic/simpleStairsUp.schematic", true);
|
||||
|
||||
@@ -89,7 +50,6 @@ public class DungeonHelper
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if(schematicFile.getName().contains(".schematic"))
|
||||
{
|
||||
String[] name = schematicFile.getName().split("_");
|
||||
@@ -158,19 +118,10 @@ public class DungeonHelper
|
||||
count++;
|
||||
this.weightedDungeonGenList.add(new DungeonGenerator(weight,path,open));
|
||||
}
|
||||
|
||||
|
||||
this.registeredDungeons.add(new DungeonGenerator(weight,path,open));
|
||||
System.out.println("Imported "+schematicFile.getName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
@@ -186,24 +137,13 @@ public class DungeonHelper
|
||||
|
||||
if(schematicNames!=null)
|
||||
{
|
||||
|
||||
|
||||
for(File schematicFile: schematicNames)
|
||||
{
|
||||
|
||||
this.registerCustomDungeon(schematicFile);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void registerFlipBlocks()
|
||||
{
|
||||
this.metadataFlipList.add(Block.dispenser.blockID);
|
||||
@@ -220,10 +160,7 @@ public class DungeonHelper
|
||||
this.metadataFlipList.add(Block.doorWood.blockID);
|
||||
this.metadataFlipList.add(Block.pistonBase.blockID);
|
||||
this.metadataFlipList.add(Block.pistonStickyBase.blockID);
|
||||
|
||||
this.metadataFlipList.add(Block.pistonExtension.blockID);
|
||||
|
||||
|
||||
this.metadataFlipList.add(Block.redstoneComparatorIdle.blockID);
|
||||
this.metadataFlipList.add(Block.redstoneComparatorActive.blockID);
|
||||
this.metadataFlipList.add(Block.signPost.blockID);
|
||||
@@ -235,18 +172,16 @@ public class DungeonHelper
|
||||
this.metadataFlipList.add(Block.chest.blockID);
|
||||
this.metadataFlipList.add(Block.chestTrapped.blockID);
|
||||
this.metadataFlipList.add(Block.hopperBlock.blockID);
|
||||
|
||||
this.metadataFlipList.add(Block.stairsNetherBrick.blockID);
|
||||
this.metadataFlipList.add(Block.stairsCobblestone.blockID);
|
||||
this.metadataFlipList.add(Block.stairsNetherBrick.blockID);
|
||||
this.metadataFlipList.add(Block.stairsNetherQuartz.blockID);
|
||||
this.metadataFlipList.add(Block.stairsSandStone.blockID);
|
||||
|
||||
|
||||
this.metadataNextList.add(Block.redstoneRepeaterIdle.blockID);
|
||||
this.metadataNextList.add(Block.redstoneRepeaterActive.blockID);
|
||||
|
||||
}
|
||||
|
||||
public void registerDungeonTypeTags()
|
||||
{
|
||||
tagList.add("hub");
|
||||
@@ -257,6 +192,7 @@ public class DungeonHelper
|
||||
tagList.add("deadEnd");
|
||||
tagList.add("maze");
|
||||
}
|
||||
|
||||
public void registerBaseDungeons()
|
||||
{
|
||||
this.hubs.add(new DungeonGenerator(0, "/schematics/4WayBasicHall.schematic", false));
|
||||
@@ -269,7 +205,6 @@ public class DungeonHelper
|
||||
this.hubs.add(new DungeonGenerator(0, "/schematics/4WayHallExit.schematic", false));
|
||||
this.hubs.add(new DungeonGenerator(0, "/schematics/4WayHallExit.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));
|
||||
@@ -279,7 +214,6 @@ public class DungeonHelper
|
||||
this.simpleHalls.add(new DungeonGenerator(0, "/schematics/simpleStairsDown.schematic", false));
|
||||
this.simpleHalls.add(new DungeonGenerator(0, "/schematics/simpleSmallT1.schematic", false));
|
||||
|
||||
|
||||
this.complexHalls.add(new DungeonGenerator(0, "/schematics/tntPuzzleTrap.schematic", false));
|
||||
this.complexHalls.add(new DungeonGenerator(0, "/schematics/brokenPillarsO.schematic", true));
|
||||
this.complexHalls.add(new DungeonGenerator(0, "/schematics/buggyTopEntry1.schematic", true));
|
||||
@@ -289,7 +223,6 @@ public class DungeonHelper
|
||||
this.complexHalls.add(new DungeonGenerator(0, "/schematics/ruinsO.schematic", true));
|
||||
this.complexHalls.add(new DungeonGenerator(0, "/schematics/pitStairs.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));
|
||||
@@ -302,37 +235,27 @@ public class DungeonHelper
|
||||
this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallDesert.schematic", true));
|
||||
this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallPond.schematic", true));
|
||||
|
||||
|
||||
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 DungeonGenerator(0, "/schematics/pistonSmasherHall.schematic", false));
|
||||
// this.pistonTraps.add(new DungeonGenerator(0, "/schematics/raceTheTNTHall.schematic", false));
|
||||
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/fallingTNThall.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/lavaPyramid.schematic", true));
|
||||
|
||||
|
||||
|
||||
this.mazes.add(new DungeonGenerator(0, "/schematics/smallMaze1.schematic", false));
|
||||
this.mazes.add(new DungeonGenerator(0, "/schematics/smallMultilevelMaze.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));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.weightedDungeonGenList.addAll(this.simpleHalls);
|
||||
this.weightedDungeonGenList.addAll(this.exits);
|
||||
this.weightedDungeonGenList.addAll(this.pistonTraps);
|
||||
@@ -346,15 +269,12 @@ public class DungeonHelper
|
||||
if(!this.registeredDungeons.contains(data))
|
||||
{
|
||||
this.registeredDungeons.add(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public DungeonGenerator exportDungeon(World world, int xI, int yI, int zI, String file)
|
||||
{
|
||||
|
||||
int xMin;
|
||||
int yMin;
|
||||
int zMin;
|
||||
@@ -401,8 +321,6 @@ public class DungeonHelper
|
||||
short length= (short) (zMax-zMin);
|
||||
|
||||
//ArrayList<NBTTagCompound> tileEntities = new ArrayList<NBTTagCompound>();
|
||||
|
||||
|
||||
ArrayList<Tag> tileEntites = new ArrayList<Tag>();
|
||||
byte[] blocks = new byte[width * height * length];
|
||||
byte[] addBlocks = null;
|
||||
@@ -464,8 +382,6 @@ public class DungeonHelper
|
||||
}
|
||||
**/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,8 +425,6 @@ public class DungeonHelper
|
||||
return new DungeonGenerator(0, file, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void generateDungeonlink(LinkData incoming)
|
||||
{
|
||||
//DungeonGenerator dungeon = mod_pocketDim.registeredDungeons.get(new Random().nextInt(mod_pocketDim.registeredDungeons.size()));
|
||||
@@ -525,7 +439,6 @@ public class DungeonHelper
|
||||
int count=10;
|
||||
try
|
||||
{
|
||||
|
||||
if(dimHelper.dimList.get(incoming.destDimID)!=null&&dimHelper.dimList.get(incoming.destDimID).dungeonGenerator!=null)
|
||||
{
|
||||
mod_pocketDim.loader.init(incoming);
|
||||
@@ -561,9 +474,6 @@ public class DungeonHelper
|
||||
{
|
||||
flag=false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (depth<=3&&(deadEnds.contains(dungeon)||exits.contains(dungeon)||rand.nextBoolean()))
|
||||
{
|
||||
@@ -602,7 +512,6 @@ public class DungeonHelper
|
||||
dungeon = hubs.get(rand.nextInt(hubs.size()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if(depthWeight-depthWeight/2>depth-4&&(deadEnds.contains(dungeon)||exits.contains(dungeon)))
|
||||
{
|
||||
@@ -641,7 +550,6 @@ public class DungeonHelper
|
||||
dungeon = pistonTraps.get(rand.nextInt(pistonTraps.size()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -652,7 +560,6 @@ public class DungeonHelper
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
}
|
||||
while (!flag && count > 0);
|
||||
}
|
||||
@@ -673,22 +580,6 @@ public class DungeonHelper
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
dimHelper.dimList.get(incoming.destDimID).dungeonGenerator = dungeon;
|
||||
//loader.generateSchematic(incoming,0,0,0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user