chunkTicket.getModData().setInteger("quarryX", xCoord);
chunkTicket.getModData().setInteger("quarryY", yCoord);
chunkTicket.getModData().setInteger("quarryZ", zCoord);
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord >> 4, zCoord >> 4));
IAreaProvider a = null;
if (!useDefault) {
a = Utils.getNearbyAreaProvider(worldObj, xCoord, yCoord, zCoord);
}
if (a == null) {
a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10);
useDefault = true;
}
int xSize = a.xMax() - a.xMin() + 1;
int zSize = a.zMax() - a.zMin() + 1;
if (xSize < 3 || zSize < 3 || ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth()) {
if (placedBy != null) {
placedBy.addChatMessage(new ChatComponentText(
String.format(
"Quarry size is outside of chunkloading bounds or too small %d %d (%d)",
xSize, zSize,
chunkTicket.getMaxChunkListDepth())));
}
a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10);
useDefault = true;
}
xSize = a.xMax() - a.xMin() + 1;
int ySize = a.yMax() - a.yMin() + 1;
zSize = a.zMax() - a.zMin() + 1;
box.initialize(a);
if (ySize < 5) {
ySize = 5;
box.yMax = box.yMin + ySize - 1;
}
if (useDefault) {
int xMin, zMin;
ForgeDirection o = ForgeDirection.values()[worldObj.getBlockMetadata(xCoord, yCoord, zCoord)].getOpposite();
switch (o) {
case EAST:
xMin = xCoord + 1;
zMin = zCoord - 4 - 1;
break;
case WEST:
xMin = xCoord - 9 - 2;
zMin = zCoord - 4 - 1;
break;
case SOUTH:
xMin = xCoord - 4 - 1;
zMin = zCoord + 1;
break;
case NORTH:
default:
xMin = xCoord - 4 - 1;
zMin = zCoord - 9 - 2;
break;
}
box.initialize(xMin, yCoord, zMin, xMin + xSize - 1, yCoord + ySize - 1, zMin + zSize - 1);
}
a.removeFromWorld();
forceChunkLoading(chunkTicket);
}