Improved and Integrated DungeonSchematic
Improved DungeonSchematic to the point that it can replace SchematicLoader as our method of loading dungeons. Some of the code was copied over rather than refactored to save time. It's been subdivided so make it much more readable. Also, we can reimplement portions of it as WorldOperations later on further remove redudancy. Testing shows that there is one problem left to fix: door blocks are not being set up correctly at the moment. Rifts are being set up properly and attaching doors to rifts will show that dungeons continue to generate fine. Added classes to support DungeonSchematic and its additional filtering logic on import and export. SpecialBlockFinder handles listing the entrance, other doors in the dungeon, and end portal frames. FillContainersOperation is a WorldOperation that fills chests and dispensers. BlockRotator is a temporary class to hold transformMetadata() and transformPoint() until we rewrite that code later. Stripped out most of the code from SchematicLoader to ensure it's no longer used. The only remaining function sets up dungeon pockets. We can phase it out in a later version so as not to delay our release. Removed references to SchematicLoader in mod_pocketDim since it no longer needs to be instantiated.
This commit is contained in:
@@ -53,7 +53,7 @@ public class Schematic {
|
||||
this.tileEntities = source.tileEntities;
|
||||
}
|
||||
|
||||
protected int calculateIndex(int x, int y, int z)
|
||||
public int calculateIndex(int x, int y, int z)
|
||||
{
|
||||
if (x < 0 || x >= width)
|
||||
throw new IndexOutOfBoundsException("x must be non-negative and less than width");
|
||||
@@ -64,7 +64,38 @@ public class Schematic {
|
||||
|
||||
return (y * width * length + z * width + x);
|
||||
}
|
||||
|
||||
public Point3D calculatePoint(int index)
|
||||
{
|
||||
int y = index / (width * length);
|
||||
index -= y * width * length;
|
||||
int z = index / width;
|
||||
index -= z * width;
|
||||
int x = index;
|
||||
|
||||
return new Point3D(x, y, z);
|
||||
}
|
||||
|
||||
public int calculateIndexBelow(int index)
|
||||
{
|
||||
return index - (width * length);
|
||||
}
|
||||
|
||||
public short getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public short getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public short getLength()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
public short getBlockID(int x, int y, int z)
|
||||
{
|
||||
return blocks[calculateIndex(x, y, z)];
|
||||
|
||||
Reference in New Issue
Block a user