fixed dungeon gen

This commit is contained in:
StevenRS11
2013-06-02 23:49:47 -04:00
parent 004d06ab7d
commit a8ac17f81b
5 changed files with 42 additions and 32 deletions

View File

@@ -182,7 +182,15 @@ public class DungeonGenerator implements Serializable
} }
catch(Exception e) catch(Exception e)
{ {
dungeon = mod_pocketDim.registeredDungeons.get(rand.nextInt(mod_pocketDim.registeredDungeons.size())); if(mod_pocketDim.registeredDungeons.size()>0)
{
dungeon = mod_pocketDim.registeredDungeons.get(rand.nextInt(mod_pocketDim.registeredDungeons.size()));
}
else
{
e.printStackTrace();
return;
}
} }

View File

@@ -33,20 +33,25 @@ public class SchematicLoader
public short height; public short height;
public short length; public short length;
public short[] blocks; public short[] blocks= new short[0];
public byte[] blockData; public byte[] blockData= new byte[0];
public byte[] blockId =new byte[0];
public byte[] addId = new byte[0]; public byte[] addId = new byte[0];
public byte[] blockId;
public NBTTagList entities; public NBTTagList entities;
public NBTTagList tileentities; public NBTTagList tileentities;
private Random rand = new Random(); private Random rand = new Random();
// public World world;
public Point3D incomingLink= new Point3D(0,0,0); public Point3D incomingLink= new Point3D(0,0,0);
public ArrayList<Point3D> sideLinks = new ArrayList<Point3D>(); public ArrayList<Point3D> sideLinks = new ArrayList<Point3D>();
public ArrayList<Point3D> exitLinks = new ArrayList<Point3D>(); public ArrayList<Point3D> exitLinks = new ArrayList<Point3D>();
public int transMeta; public int transMeta;
// public Chunk chunk;
public int cX; public int cX;
public int cZ; public int cZ;
public int cY; public int cY;
@@ -58,7 +63,6 @@ public class SchematicLoader
public SchematicLoader() public SchematicLoader()
{ {
// this.schematic="/schematics/"+filePath;
} }
@@ -85,28 +89,25 @@ public class SchematicLoader
} }
//FileInputStream fileinputstream = new FileInputStream(file); //FileInputStream fileinputstream = new FileInputStream(file);
NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(input); NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(input);
width = nbtdata.getShort("Width");
height = nbtdata.getShort("Height");
width = nbtdata.getShort("Width"); length = nbtdata.getShort("Length");
height = nbtdata.getShort("Height");
length = nbtdata.getShort("Length"); blockId = nbtdata.getByteArray("Blocks");
blockData = nbtdata.getByteArray("Data");
blockId = nbtdata.getByteArray("Blocks");
blockData = nbtdata.getByteArray("Data");
blocks=new short[blockId.length]; blocks=new short[blockId.length];
if(nbtdata.getByteArray("AddBlocks")!=null) addId = nbtdata.getByteArray("AddBlocks");
{
this.addId = nbtdata.getByteArray("AddBlocks");
}
entities = nbtdata.getTagList("Entities"); entities = nbtdata.getTagList("Entities");
tileentities = nbtdata.getTagList("TileEntities"); tileentities = nbtdata.getTagList("TileEntities");
this.didRead=true;
input.close();
this.didRead=true;
input.close();
for (int index = 0; index < blockId.length; index++) for (int index = 0; index < blockId.length; index++)
@@ -114,14 +115,14 @@ public class SchematicLoader
if ((index >> 1) >= addId.length) if ((index >> 1) >= addId.length)
{ {
blocks[index] = (short) (blockId[index] & 0xFF); blocks[index] = (short) (blockId[index] & 0xFF);
} }
else else
{ {
if ((index & 1) == 0) if ((index & 1) == 0)
{ {
blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF));
}
} else else
{ {
blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF));
} }
@@ -769,7 +770,7 @@ public class SchematicLoader
if(Block.blocksList[blockToReplace]==null&&blockToReplace!=0||blockToReplace>158) if(Block.blocksList[blockToReplace]==null&&blockToReplace!=0||blockToReplace>158)
{ {
// blockToReplace=mod_pocketDim.blockDimWall.blockID; blockToReplace=mod_pocketDim.blockDimWall.blockID;
} }
if(blockToReplace>0) if(blockToReplace>0)

View File

@@ -612,7 +612,7 @@ public class mod_pocketDim
this.blocksImmuneToRift.add(Block.blockLapis.blockID); this.blocksImmuneToRift.add(Block.blockLapis.blockID);
this.blocksImmuneToRift.add(Block.bedrock.blockID); this.blocksImmuneToRift.add(Block.bedrock.blockID);
/**
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/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/doorTotemRuins.schematic", true));
@@ -690,7 +690,7 @@ public class mod_pocketDim
this.registeredDungeons.addAll(this.hubs); this.registeredDungeons.addAll(this.hubs);
**/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1 @@
0*7,1*7,2*7,3*7,4*7,5*7,6*7,5*7,4*7,3*7,2*7,1*7