Fixed Rotation in SchematicLoader

Fixed reference to CommandRegenPocket - should be CommandResetDungeons.
Autofixed indentation in SchematicLoader. I wanted to commit that change
before doing any more code changes but I forgot. Then I fixed the code
that calculates the coordinate offsets so our dungeons rotate right. It
was pretty simple - all I had to do was move the xCooe and zCooe
calculations into the loops so they're recalculated to account for
rotation. I rearranged the loops for optimal performance.
This commit is contained in:
SenseiKiwi
2013-06-26 00:45:20 -04:00
parent 6e3c93fa17
commit 471114415b
2 changed files with 102 additions and 106 deletions

View File

@@ -907,41 +907,37 @@ public class SchematicLoader
}
}
//determines necessary rotation, reflection, and translation to build the .schematic by finding the difference between the
//.schematic incomingLink location which is relative to the .schematic only, and comparing it with the world incoming link coordinates
//must also factor in the orientation of the incoming door.
if(orientation==0) //TODO currently broken, only orientation 3 works atm
{
xCooe=-incomingLink.getX()+incX;
yCooe=-incomingLink.getY()+incY;
zCooe=-incomingLink.getZ()+incZ;
//Compute the Y-axis translation that places our structure correctly
yCooe = incY - incomingLink.getY();
}
if(orientation==1)//TODO currently broken, only orientation 3 works atm
//Loop to actually place the blocks
for ( x = 0; x < width; x++)
{
xCooe=-incomingLink.getX()+incX;
yCooe=-incomingLink.getY()+incY;
zCooe=-incomingLink.getZ()+incZ;
}
if(orientation==2)//TODO currently broken, only orientation 3 works atm
for ( z = 0; z < length; z++)
{
xCooe=-incomingLink.getX()+incX;
yCooe=-incomingLink.getY()+incY;
zCooe=-incomingLink.getZ()+incZ;
}
if(orientation==3)//TODO this only works because it is the default orientation of the pocket dim
//Compute the X-axis and Z-axis translations that will shift
//and rotate our structure properly.
switch (orientation)
{
case 0:
xCooe = -incomingLink.getX() + incX;
yCooe=-incomingLink.getY()+incY;
zCooe = -incomingLink.getZ() + incZ;
break;
case 1:
xCooe = -incomingLink.getX() + incX;
zCooe = -incomingLink.getZ() + incZ;
break;
case 2:
xCooe = -incomingLink.getX() + incX;
zCooe = -incomingLink.getZ() + incZ;
break;
case 3:
xCooe = -incomingLink.getX() + incX;
zCooe = -incomingLink.getZ() + incZ;
break;
}
//loop to actually place the blocks
for ( x = 0; x < width; ++x)
{
for ( y = 0; y < height; ++y)
{
for ( z = 0; z < length; ++z)
for ( y = 0; y < height; y++)
{
int index = y * width * length + z * width + x;

View File

@@ -391,7 +391,7 @@ public class mod_pocketDim
@ServerStarting
public void serverStarting(FMLServerStartingEvent event)
{
CommandRegenPocket.instance().register(event);
CommandResetDungeons.instance().register(event);
CommandCreateDungeonRift.instance().register(event);
CommandDeleteAllLinks.instance().register(event);
CommandDeleteDimensionData.instance().register(event);